I need to find the size of a PDF document, the PDF’s are my source data, but the client also sends A3 (and other sizes) which i need to exclude (only A4 in this run)
I use the below for the number of pages, I just need to size:
’ get number of pages in the PDF
Set MyPDF=Watch.GetPDFEditObject()
Call MyPDF.Open (myPDFfile, true)
Watch.SetVariable “pdfFilePageCount”, MyPDF.Pages.Count()
MyPDF.Close()
A PDF does not have a “size” for the entire file, each page may have different dimensions.
That’s why you have to look at the MediaSize() for each page.
Also, keep in mind that “length” and “width” are arbitrary values that depend not only on page size but also on the orientation of each page. So for an A4 page, the dimensions could be either 595x842 points or 842x595 points.
Yep, that’s pretty much the idea, although I would recommend using the MediaSize() property, which specifies the actual media size as opposed to Size(), which specifies the expected displayable size.
Most times, they’re the same… but not always.