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
Having problems with above sample? Please do not hesitate to contact us via the webform below.
Aloaha Software / Knowledge Base / PDF SDK / Normalize Pages