Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Convert PDF to Base64

preethi_santhanam
Participant
0 Likes
4,041

Hi,

There is a requirement to generate an Adobe Form using SAP Interactive forms, and then, send this PDF to a non-SAP system using Base-64 encoding. The receiving system will decode this file and re-generate a PDF.

I have heard that this could be done in the PI layer, using the Conversion Agent.

Another approach which I can think of is convert PDF to binary and then use the cl_http_utility=>encode_base64 to convert binary to base64. However, I am unaware of converting from PDF to binary.

Have any of you faced a similar issue before, or is aware of another approach of how this could be achieved quickly?

Thanks,

Preethi.

Hi,

There is a requirement to generate an Adobe Form using SAP Interactive forms, and then, send this PDF to a non-SAP system using Base-64 encoding. The receiving system will decode this file and re-generate a PDF.

I have heard that this could be done in the PI layer, using the Conversion Agent.

Another approach which I can think of is convert PDF to binary and then use the cl_http_utility=>encode_base64 to convert binary to base64. However, I am unaware of converting from PDF to binary.

Have any of you faced a similar issue before, or is aware of another approach of how this could be achieved quickly?

Thanks,

Preethi.

5 REPLIES 5
Read only

Former Member
0 Likes
3,040

Preethi,

Refer to this link

Thanks,

Anitha A

Read only

0 Likes
3,040

Hi Anita,

Thanks. I have looked at this link before, but this shows how to convert a pdf which is already in binary format to base 64. I just have a pdf in .pdf format.

Best Regards,

Preethi.

Read only

0 Likes
3,040

Hi Preethi,

this shows how to convert a pdf which is already in binary format to base 64. I just have a pdf in .pdf format.

Generally speaking, PDF is a binary format!

When you retrieve it from Adobe services (lo_pdfobj->get_pdf( IMPORTING pdfdata = l_pdfresult )), the PDFDATA parameter returns an XSTRING data object, which is a binary stream.

Could you explain what you exactly have at the moment you want to convert it to base 64?

Sandra

Read only

0 Likes
3,040

Hi Sandra,

I have an interactive form in the Web Dynpro Component. When I read the pdfsource, I get the XSTRING, which is in base64 encoded binary format. I need to convert this data in an XML format.

Basically, the core requirement is to send an xml file, encoded in base 64 to a non SAP system, which will decode it and generate a pdf. I am currently using "SMUM_XML_PARS" to convert the XSTRING to XML, but doesn't get converted.

Any thoughts on how this can be achieved will be helpful.

Best Regards,

Preethi.

Read only

0 Likes
3,040

Hi Preethi,

Though I could answer any of your questions for converting base64, xstring and so on, your explanation is not clear enough for me, because I don't know web dynpro, so I think this thread would be best to be posted to the web dynpro forum (ask mods to move your thread to this forum).

What is not clear for me is that you have a base64 format and you want to send a base64 format. Base64 is simply an encoding format of something, XML is also a generic wrapper. So, what does this source base64 contains, and what kind of XML do you want to send exactly? Moreover, you say you have a source XSTRING, but what target data type do you need?

(probably web dynpro developers would understand better what you ask for)

Sandra