Normalize PDF Page Sizes in a Document

We’re working on PDFs from an external source that are a concatenation of multiple scanned and digital documents. Occasionally some of these documents have much larger page sizes, resulting in a final PDF with wild variations in page size which then becomes a pain when viewing in WebViewer as you have to change zoom constantly.

Obviously there is scaling functionality we can use to adjust this, but is there a recommended pattern or a single function that will let us normalize or make more consistent the page sizes of a PDF, either via editing or viewing?

If it matters, I believe the problematic pages come from manual scans and are image PDFs.

Hello,

I don’t believe there is a recommended pattern or a single function in WebViewer to accomplish this. One option you do you have is to switch to single page viewing mode and adjust the zoom level based on the size of the next page.

Otherwise, you will have to perform some sort of document processing before you load and view in WebViewer. This can be done within WebViewer, but I would recommend using our PDFNet SDK instead to process the document on upload. You would probably look for a function similar to this one in PDFNet: PDFTron WebViewer Class: Page.

1 Like