Crop PDF Page

The Crop Box in PDF terms describes the area of the PDF pages displayed by the PDF Reader or printed by the printer.


Setting a crop box with Aloaha is very easy. Please see the sample code below:

dim pdf
set pdf = createobject("aloahapdf.edit")

if pdf.load_pdf_to_mem(cstr(file_to_load)) = true then

     call pdf.set_CropBox(clng(CropPage), clng(cLeft), clng(cTop), clng(cWidth), clng(cHeight)) 
     
     call pdf.save_pdf_to_file(cstr(TargetFile))

end if

set pdf = nothing


Please ask...

Although we really tried hard, there are always questions left open. But perhaps somebody else had already put the same question?
Please check!
  • Does Crop function really delete the contents outside the crop box or just masks it? If it just masks, how do i delete the unwanted portion to reduce my file size?
    The crop function does only mask the area as defined in the PDF specication. There is no way of delete the unwanted portion.
    Answered 11.11.2009
If not, please do not hesitate to 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