Skip to Content
author's profile photo Former Member
Former Member

Splitting of a PDF file to multiple PDF Using Java Mapping / Custom Module in SAP PI

Hi,

I am new to PI. Hence kindly excuse me for any ignorance / mistakes.

My requirement is :

To pick a pdf file from a file server location, split it into multiple pdf files and place it in the Target file server location. Splitting of PDF is per page. i.e. if the PDF input file has 4 pages, then i need to create 4 PDF files for each page and place these files in the target location.

Would like to know if this is something acheivable in PI?

I have tried the below approach:

Custom Module Development

Pik up the pdf file from file location using file adapter, read it, get the number of pages, loop in for each page and create a pdf attachment, considering i will write a custom code to get the attachments at the receiver end.

I am able to create 4 pdf attachments along with the main payload but PDF file is not opening.

attachment.setContentType("application/pdf");

Also would like to know how i can get these attachment and write it to the Target directory.

Or please let me know how this can be acheived otherwise.

Second Approach:

Java Mapping was suggested by few people. Would like to know how to split the file and send all the splitted files to the receiver.

Thanks

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    Posted on Dec 19, 2013 at 09:20 AM

    Hi Jessy,

    As you are able to achieve payload with 4 attachment.

    then you can go for multi mapping and create 4 messages with 1 attachment & 1 main payload for each,

    Then in Receiver CC you can use the swap module to swap attachment with module.

    Regards

    Gagan


    pastedImage_0.png (11.7 kB)
    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 19, 2013 at 08:58 AM

    Hi Jessy,

    Would like to know if this is something acheivable in PI?

    Custom Module Development

    Pik up the pdf file from file location using file adapter, read it, get the number of pages, loop in for each page and create a pdf attachment, considering i will write a custom code to get the attachments at the receiver end.

    I am able to create 4 pdf attachments along with the main payload but PDF file is not opening.

    Where are you opening the PDF file? Did you download it first before opening? Have you tried your code locally (without PI)? It should be possible via adapter module or Java mapping though. What is the adapter of the receiving system? Because your approach will be based on that.

    Regards,

    Mark

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Mark

      Both Source & Target - File Adapter. Tried downloading the file and then also its not opening. When i created a text attachment, it is fine.

      Also I need not to create an attachment. i just tried this way.

      All i needed is to split the pdf into multiple and pass all the newly created PDF's to the target file directory.

      Please let me know how this can be acheived.

  • author's profile photo Former Member
    Former Member
    Posted on Jan 11, 2014 at 10:57 AM

    Hi

    Client has now come back and said they cannot handle zip file, and they need the splitted PDF files placed on the target file location seperately.

    I could think of the File Adapter OS Command Line Feature to unzip the files , but that would require unzip installation. Would like to know the Pros and Cons of this approach.

    Also let me know if there is any other approach to acheive this.

    Thanks

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.