Interactive Adobe. Part IXX. How to Merge an Image File with an Adobe PDF?

Merging an image file with an Adobe PDF using Interactive Adobe tools.

Interactive Adobe. Part IXX. How to Merge an Image File with an Adobe PDF?

Adding a picture (jpg, bmp, etc.) in Adobe format is a common business scenario. We may bind the necessary image using Image Field UI. However, today’s subject is distinct.

How can we merge an image to an existing Adobe PDF form??

However, how can we combine an image in Adobe’s pre-existing formats?  One of the members of our Telegram group recently inquired about the case’s solution and potential solutions. He needed the photographs saved in PO Generic Object Services (GOS) to be attached and shown with 

the PO Output Form. When two picture files (usually in “.jpg” format) are saved at the Purchase Order, they should be 

combined with the PO Output form and returned to the vendor. To put it briefly, the task was to combine the PDF PO Output Form with the image files in the GOS of the PO.

After some head scratching and cool thinking, the below two steps looked a good start:

Let us dig into the actual technicalities now.

1. Create an Adobe form ZPB_TEST_CONVERT_JPG, interface ZPB_TEST_CONVERT_JPG with an import parameter as GV_CONTENT of type XSTRING.

2. In context of form, create a Graphics Node as follows :

3. Set the graphics node properties as follow:

4. Create an Image field UI in form layout and bind it with GRAPHICS node created in the context.

We are done with creation of 1st Adobe form in which any image from driver program can be uploaded as PDF and then it needs to be merged with any existing Adobe form.

Next, I have created another Adobe form ZPB_HIDE_TABLE_COLUMN with simple table display. Just create one adobe and hard code some table values. This will act like our 2nd PDF file which we want to merge.

5. Create a driver program with the below steps:

i. Call FP_JOB_OPEN

ii. Generate FM for 1st Adobe form:

iii. Upload an image file from local system.

iv. Convert Binary data into Raw data :

v. Call FM for 1st Adobe Form from step 1 and collect it’s Raw data into an internal table GT_PDF:

vi. Call 2nd Adobe form in which we want to merge the image as PDF and collect it’s Raw data in the internal table GT_PDF:

vii. Now, merge both the PDFs (1st Image, 2nd Adobe Form PDF) into one PDF.

viii. Close the form processing as:

ix. Now, you can generate the result merged PDF (GV_MERGE) from above step vii with the following code:

Testing Time:

Run the driver software. Save the combined PDF to your local computer after selecting an image file from your system (I liked the ELEARNING image):

I hope you are able to bring the solution home. As usual, this is the first and most straightforward approach that comes to mind, but there may be other ways to accomplish the same goal. Please feel free to leave a remark below if you have any other ideas. In this development, we did not do anything new. We just implemented what we have learnt and performed independently in other business requirements. knew how to convert the data to RAW. We knew how to create Adobe Forms. Knew how to get RAW data of the Adobe Forms. knew how to merge PDF files. What we did was just bringing together all this answers to one.

YOU MAY LIKE THIS

SAP ABAP Checkpoint Group – Chase the Mysterious SAP Issues with a Smile

Best Practices for SAP ABAP Development: A Comprehensive Guide

4 Useful Tips on ABAP and ABAP on HANA