cancel
Showing results for 
Search instead for 
Did you mean: 

Sending PDF file through PI

former_member204873
Contributor
0 Kudos

hi all,

I followed one blog to create PDF file using file adapter and custom adapter module : http://www.sdn.sap.com/irj/scn/weblogs;jsessionid=(J2EE3414700)ID1540235550DB11887853428651970314End...

As per this 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:

document.add(table);

document.close();

String xmlpld = document.toString();

xpld.setText(xmlpld);

inputModuleData.setPrincipalData(msg);

return inputModuleData;

Please help!

thanks,

mayank

Accepted Solutions (1)

Accepted Solutions (1)

MichalKrawczyk
Active Contributor
0 Kudos

hi,

>>>But file created at ftp location contains only name com.lowagie.text.Document6e42c8a3 & also i am not able to open it as PDF.

that can mean onlz one thing - you didn't prepare the correct PDF as shown in this wiki by Shabz:

http://wiki.sdn.sap.com/wiki/display/XI/CODE%20-%20Create%20a%20PDF%20File%20via%20the%20iText%20Lib...

Regards,

Michal Krawczyk

Answers (2)

Answers (2)

Shabarish_Nair
Active Contributor
0 Kudos

there is another way of doing it.. instead of the module use the logic in a java mapping (provided you can do the parsing and build the data)

and yeah this reference code should help - http://wiki.sdn.sap.com/wiki/display/XI/CODE%20-%20Create%20a%20PDF%20File%20via%20the%20iText%20Lib...

former_member204873
Contributor
0 Kudos

using java mapping ,, how to get the required target structure for a PDF file,

Shabarish_Nair
Active Contributor
0 Kudos

your outputstream will have the pdf file format ...

just use the file adapter and it will do the rest to write it out... (not confirmed .. but by theory should work)

former_member204873
Contributor
0 Kudos

hi shabarish,

As i am trying through Custom modules, need to know one thing,

PdfWriter.getInstance(document,oos);

after creating PDF file according to your code, how to set oos stream to inputModuleData, i feel that i am doing something wrong in converting oos to inputModuleData

as of now my code is:

String xmlpld = oos.toString();

xpld.setText(xmlpld);

inputModuleData.setPrincipalData(msg);

return inputModuleData;

Please help!

Mayank

former_member204873
Contributor
0 Kudos

it got resolved by using following code:

ByteArrayOutputStream baos = new ByteArrayOutputStream();

PdfWriter.getInstance(document,baos);

byte byt[] = baos.toByteArray();

xpld.setContent(byt);

msg.setDocument(xpld);

inputModuleData.setPrincipalData(msg);

Former Member
0 Kudos