Normalize PDF Pages

In some cases a PDF document contains pages with different page sizes. For example if the document was merged together out of a couple documents.

With the function set_pagesize it is possible to bring all pages of a document to the same width or lenght. The aspect ratio will be kep.

The API is pretty simple. Just see a sample below.


Dim pdf
Dim PWidth
Dim i

InFile = "d:\mymerged-notok.pdf"
OutFile = "d:\out.pdf"
PWidth = 595                                    'A4

Set pdf = CreateObject("aloahapdf.edit")

If pdf.load_pdf_to_mem(CStr(InFile)) = true Then
     pages = pdf.pdfpages
     If pages>0 Then
          For i = 1 to pages
                    Call pdf.set_pagesize(CDbl(PWidth), CLng(i), false) 
          Next
          If pdf.save_pdf_to_file(CStr(OutFile)) = true Then
     End If
     Call pdf.unload_pdf_from_mem
End If 

Set pdf = nothing



Please ask...

Although we really tried hard, there are always questions left open.

Please send us your question.
We would be glad to answer it.
PDF SDKPDF Signature APICertificate PropertiesSample CodeText StampsPDF AttachmentsImage 2 PDFPDF to Multipage TIFFAppend PDFInsert Blank PageRender ImageStamp PDF with PDFDraw PDF as LetterheadApply LetterheadPDF BackgroundsAdd NotesURL HotspotSecure PDF ViewerPDF OptimizerPDF Encryption APIPDF Printing APIPDF BookmarksPDF BarcodingMerge PDF DocumentsSample APIsResize PDFCrop PDF PagePDF InformationPDF2TXTNormalize PagesDirect PDF ConversionPDF Form Saver SDKSmart Card APIAloaha Web ServicesAloaha Print MonitorAloaha Remote ConfigurationWebDAVLDAP ClientProgramming Office MacrosIIS Event Sinks