the required image. But today’s topic is different.
How can we merge an image to an existing Adobe PDF form??
But how we can merge an image in existing forms in Adobe? Recently, one of our telegram group members asked solution for this case and solution possibilities.His requirement was to attach the images saved in PO Generic Object Services (GOS) and display along with PO Output Form. If there are 2 image files (mostly in “.jpg”) saved at Purchase Order, these should be merged with PO Output form and send it back to vendor. In short, the requirement was to merge the image files in GOS of PO along with the PDF PO Output Form.
After some head scratching and cool thinking, the below two steps looked a good start:
- Convert a JPG file into PDF Raw Data.
- Merge the Image PDF Raw Data with existing Adobe form.
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 follow:
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.
LO_CL_MERGE is an object of class cl_rspo_pdf_merge. For more details about this class and other functionalities, please refer the below link:
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:
Execute the driver program. Select an image file from your local system (I preferred to choose SAPYARD image) and save the merged PDF in your local drive:
Hope you could take home the solution. As usual, there might be other better ways to do the same thing, but this is the first and the simplest solution I can think of.
If you have some other thoughts, please feel free to write in the comments section below.
In this development, we did not do anything new. We just implemented what we have learnt and performed independently in other business requirements. We knew how to convert the data to RAW. We knew how to create Adobe Forms. We new how to get RAW data of the Adobe Forms. We knew how to merge PDF files. What we did was just bringing together all this answers to one. When we combined all the stand alone tricks it became one solution and this makes you the technical architect of your team. ?
We have a very active Telegram (App) SAP Technical Group with more than 4990+ SAP Technical Practitioners from 6 Continents of the SAP World. Please join it using below link.
Telegram SAP Technical Discuss Group. You need to install the Telegram App first on your mobile device. Once you have it on your mobile, you can join the group and also access it from the Web on your computer and laptop.
Free Step by Step Course on Interactive Adobe Forms
- SAP Adobe Interactive Form Tutorial. Part I. First Adobe Form
- SAP Adobe Interactive Form Tutorial. Part II. Tables in Adobe Form
- SAP Adobe Interactive Form Tutorial. Part III. Date Time and Floating Fields
- SAP Adobe Interactive Form Tutorial. Part V. Images, Graphics and Logo in Adobe Forms
- SAP Adobe Interactive Form Tutorial. Part VI. Printing Address in Adobe Form
- SAP Adobe Interactive Form Tutorial. Part VII. Displaying Text Module Texts in Adobe forms
- SAP Adobe Interactive Form Tutorial. Part VIII. Displaying Include Texts in Adobe forms
- SAP Adobe Interactive Form Tutorial. Part IX. Displaying Dynamic Text in Adobe Forms
- SAP Adobe Form Tutorial. Part X. Alternative in Adobe Forms
- SAP Adobe Form Tutorial. Part XI. Configuring Adobe Forms in NACE, OPK8 and SPRO
- SAP Adobe Form Tutorial. Part XII. How to Convert Smartform to Adobe Form?
- SAP Adobe Form Tutorial. Part XIII. How to Print two Tables Adjacent to each other?
- SAP Adobe Form Tutorial. Part XIV. How to Generate Barcode in Adobe
- SAP Adobe Form Tutorial. Part XV. Different Background Color for Label & Content Text
- Interactive Adobe. Part 17. How to Execute URL Dynamically by Button Click Event?
- Interactive Adobe. Part 19. How to Merge an Image File with an Adobe PDF?