Skip to Content

In an earlier blog, I tried to capture the various alternatives of Excel Files – How to handle them in SAP XI/PI (The Alternatives). In this blog the focus will be on PDF Files.


Let me first try and document some of the options that we already know through SDN.


1. Obviously Mr. Conversion Agent – Capable of literally taking any kind of data in and transforming out into any data. PDFs, the bugger processes them too 🙂

2.  XSL-FOP and the Apache FOP way – It is described as per this XI: Generate PDF file out of file adapter

3. Now some other work arounds to achieve our objective is use of Java proxies and executing scripts which I havnt tried yet. 

But then what I have tried and would like to recommend is the use of a very simple JAVA library I tumbled upon while doing some R&D on this front.


iText is a free java PDF library. You can read about the library and download the jar file from here


Lets take a typical scenario (I think I will take the exact one I used for the Excel development). So here you have a bunch of employee details that needs to be written out to a PDF format. We need to have tables and lets put in some simple formatting, you know add some colours and stuff 🙂


Anyway, the simplest design I propose is to have your mapping done, create the target XML with the employee details and then pass this to the Adapter (FILE/MAIL etc). Now use the MessageTransformBean and convert the XML to a FLAT format. Now insert your custom module with the code to create the PDF. The advantage I find here is that you have your inputstream in a flat string and its very easy to do string manipulations.

Well if you dont use the MessageTransformBean then in the module you will have your target XML as input and then you know go through the hustle and buzzle to parse it and then… well I really dont want to do down that path cos I aint that brave enough. So I will stick to my simple to use String functions and leave the parsing to the standard bean by SAP.


So to summarize, the message flow I propose is

Target XML -> Adapter -> MessageTransformBean -> Our Custom Module

It is all quite similar to the earlier Excel story I wrote, aint it? Only thing that changes towards the end is the library that will do the trick, the conversion of the inputstream to a PDF format.


I have created a Wiki that will show you the code that will demonstate the ease of use of this particular library.

Click Here for more details.


Hope this blog provides you insight into options that you can work on and suit your requirements when it comes to PDFs in XI/PI. Exploring the iText library you will also find various interfaces and methods to help you read a PDF also. Maybe when the time of need arises, you can have a look and explore more 🙂

To report this post you need to login first.


You must be Logged on to comment or reply to a post.

  1. Former Member
    Hi, thanks for this blog and your wiki. As good as the excel example.

    I was thinking if PI could use the ADS-Service on NetWeaver Host to generate PDFs. Do you think this is possible?
    And how difficult it might be to develop custom forms for orders etc with your given JAR?


    1. Shabarish Vijayakumar Post author

      I m really not sure of the ADS option 🙁
      But about custom forms/pdfs … i guess it shouldnt be that tough with the Library … the interfaces are very simple to use .. so a lil bit of R&D should do the trick …

      can you tell me more of the ADS option u mentioned .. i am totally unaware of that :-/


      1. Former Member
        Well ADS is the Adobe Document Service which is a service to generate PDFs i.e. from Orders out of the ERP-System. You can access this service via print-control in ERP-System but you have to connect the print-control to ADS, which is actually a service on a NetWeaver. This service can generate stand-alone PDFs as well as Interactive one’s with Input fields etc. I guess you know this.

        I thought of calling this service to generate a PDF through SAP PI and this one is maybe stored to a document server of the customer. Just an idea perhaps it’s possible.


  2. Former Member
    I have to create an custom module for sending PDF file, i have checked the sample code created by you. In that i would like to understand how can i get payload from MessageTransformBean, since this value is taken as constant value in your code.How to get the dynamic values from MessageTransformBean.(String input = “100,Anakin Skywalker,EAS).Also what changes i am supposed to do the process method of module development for output.In your code it is: new OutputStream(“output.pdf”). Do i have to add anything to inputModuleData.setPrincipalData(msg).
    Please help!
  3. Former Member
    As per your blog ,, my processing sequence in communication channel is: custom adapter module (module created for converting xml to pdf file) -> CallSapAdapter (stores file with pdf extension to an ftp location). I had added audit logs in module and i am able to see them in RWB.
    But file created at ftp location contains only name com.lowagie.text.Document6e42c8a3 & also i am not able to open it as PDF.

    my last few lines of code are:
    String xmlpld = document.toString();
    return inputModuleData;

    Please help!

  4. Former Member

    I have checked the blog which is very good. I have a scenario where I need to convert the pdf file to xml.

    Can u suggest me on this?

    thanks & regards,


  5. Former Member

    Hi Shabbarish,

    I have gone through the blog,it is very good.Just I have one query,I saw that you are taking your input as a string,I tried using your blog to create a pdf file where the source data will be from xml file.I was able to read the data from the xml file but couldnot able to write it into the output pdf file.The header structure I am generating but the data from the xml file is not getting populated in the pdf file.Can you please help me on this?


    Atanu Mazumdar


Leave a Reply