Skip to Content
0

Download Multiple Page PDF (From Adobe Form)

Dec 21, 2016 at 02:52 PM

141

avatar image

Hi,

I have developed an Adobe from for a countries tax certificates. All the employees certificates needs to be in 1 PDF.

When you do a print preview, everything looks 100% and you can see page 1, 2 etc etc.

The problems is when I try do download this, it seems almost impossible. I have read everything that I could find on the forums but none of the solutions work:

1) My first option would be to use the logic as described in FP_CHECK_BATCH_PDF_RETURN. The problem when you use function 'FP_GET_PDF_TABLE' you end up with two XSTRING rows. I tried to convert this to Binary by using the following:

CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
buffer = ls_pdf
append_to_table = 'X'
IMPORTING
output_length = lv_filelength
TABLES
binary_tab = lt_pdf_content.

DESCRIBE TABLE lt_pdf_content LINES lin.

lv_filelength = lin * sy-tleng .

And then download the binary by either using GUI_DOWNLOAD or OPEN DATASET lv_file FOR OUTPUT IN BINARY MODE MESSAGE lv_msg but keep on getting a message that the PDF file has been damaged and cannot be repaired.

If I add only 1 page, it works. If I add the whole binary table (multiple pages), with the field length the same as 1 page.. to works. How do I get multiple XSTRING to convert correctly into binary so that it downloads correctly??

2) I have tried Function FPCOMP_CREATE_PDF_FROM_SPOOL but it only returns 1 page at a time, which leaves me again with a fustrating sinlge XSTRING again.

3) RSTXPDFT4 does not work

4) I don't want to install a third party tool. I surely must be possible to do it in ABAP.

Any suggestions or solutions would be appreciated. Someone must have done this before?

Kind Regards

Deon

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
Gideon van Zyl Jan 05, 2017 at 01:33 PM
0

To whom ever have the same problem...

I could not find a way to covert multiple xstrings into 1 binary and get it to download correctly.

I was however able to get the single pdf working with another solution. I changed the logic of my adobe form to use my whole internal table with employees and create a new page for each row entry in my table. You basically add the internal table to your interface and context. You then link your table row to your main subform that is used in your Main Content Area and tick 'Repeat Subform for each Data Item' and tick this as well in your table (if you have one... I created my form display structure as a table). It will then create a certificate for each employee within a single form, and when you exit the function module, you will have 1 xstring containing all the data which you then convert to binary and download.. and tadaaaa :) happy client :)

-d

Show 1 Share
10 |10000 characters needed characters left characters exceeded
Former Member

You saved my day. Thanks man.

Regards,

Prasenjit

1