Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

How can I Split the PDF File into different pages?


My requirment is to split the pdf file , which is obtained by using FM "convert_otf" , into seperate PDF file for each employee data(PERNR).

Please suggest me the way to slipt the PDF file that has to be downloaded into the presentation server.

Former Member


Ok, looking at that programm didn't actually help me very much to understand what's going on, or where you have the CONVERT_OTF call... Regardless, if the suggestion by Raymond is not feasible in your scenario, the thing I'd try to do is - splitting the spool (OTF) contents before calling CONVERT_OTF into individual documents (feeding it to convert FM piecemeal)... The link to OTF format and commands documentation is here.

Again, it's difficult to give a good algorithm without knowing the exact OTF contents (could you perhaps somehow export the display of spool in RAW format and attach here?) but it would boil down to approximately following:

1) set the &first_page per PERNR = 1;

2) run through OTF lines until the &end_page for PERNR has been identified somehow (hopefully there are Begin/End Form OTF commands '//' in that spool... and they correspond to the split of spool you need...);

3) extract the otf contents from &first_page to the EP command of &end_page into separate OTF itab and, if necessary, add // (End of form) command at the end of itab;

4) call CONVERT_OTF on the table and download;

5) set the &first_page per PERNR = &end page + 1;

6) repeat from 2) until end of spool OTF data

Something like that... Depending how the Sapscript translates into OTF, you may also need to prepend a few commands found at the very beginning of the spool to each extracted invividual OTF document...

I Hope you can get the gist of what I'm suggesting... splitting OTF is definetly easier than trying to split PDF, I feel. It's not ideal solution, because - what if the structure of OTF contents you would be realying on changes for some reason..?



1 View this answer in context

Helpful Answer

Not what you were looking for? View more on this topic or Ask a question