Application Development 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: 

Examine the page format of PDF files from the archive

jrgkraus
Active Contributor

When issuing SD invoices on paper, we also fetch attachments in PDF format from the archive with ALINK_RFC_TABLE_GET.

Since our printers get stuck when the documents have the wrong page format (no A4), we would like to sort out documents that have different formats.

Therefore, I need to find out about the page formats used in the PDF. Is there any possibility to do this in ABAP?

1 REPLY 1

Sandra_Rossi
Active Contributor

Maybe you could scan the PDF for /MediaBox texts e.g.

/MediaBox[0 0 612 792]

where numbers are "[llx lly urx ury] specifying the lower-left x, lower-left y, upper-right x, and upper-right y", expressed in default "user space units".

In PDF 1.7 spec 7.7.3.3 Page Objects, Table 30, "UserUnit" : "A positive number that shall give the size of default user space units, in multiples of 1⁄72 inch."

In PDF 1.7 spec 8.3.2.3 User Space: "The length of a unit along both the x and y axes is set by the UserUnit entry (PDF 1.6) in the page dictionary (see Table 30). If that entry is not present or supported, the default value of 1⁄72 inch is used. This coordinate system is called default user space."

So, if UserUnit is absent or 1, 612 means 8.5 inches, 792 means 11 inches, which is US Letter.A4 should be 210 × 297 mm (approximetaly 8.3 × 11.7 inches), so something like
/MediaBox[0 0 595 842]

I couldn't find a paper orientation concept in PDF 1.7 spec.