ImageEn, unit iexBitmaps

TIOParams.PDF_PageMargin

TIOParams.PDF_PageMargin


Declaration

property PDF_PageMargin: Integer


Description

Specifies the size of margins (blank area) on all sides of the page when saving to PDF. Value is in Adobe PDF points (1 point = 1/72 of inch).

Notes:
- This property is only used when saving PDF files natively, e.g. using TImageEnIO.SaveToFilePDF or TImageEnMIO.SaveToFilePDF (and the PDFium PlugIn is disabled). It is NOT used when saving with PDFium
- If you are using a TIEMultiBitmap or TImageEnMView, you can use DuplicateCompressionInfo to propogate the parameter to all frames

Default: 0 (no margins, i.e. image touches side of page)


Examples

// Save using A4 paper size with 1cm margins
ImageEnView1.IO.Params.PDF_PaperSize := iepLetter;
ImageEnView1.IO.Params.PDF_PageMargin := Round( 1 * Inches_Per_CM * 72 );
ImageEnView1.IO.SaveToFile('D:\output.pdf');

// Save image in TImageEnMView as PDF with "US Letter" paper size and 0.5 inch margins
ImageEnView1.IO.Params.PDF_PaperSize := iepLetter;
ImageEnView1.IO.Params.PDF_PageMargin := Round( 0.5 * 72 );
ImageEnView1.IO.SaveToFile('D:\output.pdf');

// Save multi-frame image in TImageEnMView as PDF with "US Letter" paper size and 0.5 inch margins
for I := 0 to ImageEnMView1.MIO.ParamsCount - 1 do
begin
  ImageEnMView1.MIO.Params[ I ].PDF_PaperSize := iepLetter;
  ImageEnMView1.MIO.Params[ I ].PDF_PageMargin := Round( 0.5 * 72 );
end;
ImageEnMView1.MIO.SaveToFile('D:\output.pdf');

// Save all pages to PDF (A4) with centered images (and no scaling of small images)
ImageEnMView1.MIO.Params[0].PDF_PaperSize := iepA4;
ImageEnMView1.MIO.Params[0].PDF_PageMargin := Round( 0.25 * 72 ); // 1/4 inch
ImageEnMView1.MIO.Params[0].PDF_ImageOptions := [iepioShrinkOnly, iepioCentered];
ImageEnMView1.MIO.DuplicateCompressionInfo(TRUE);
ImageEnMView1.MIO.SaveToFilePDF('d:\test.pdf');

// Convert a TIFF to PDF with "US Letter" paper size and 0.5 inch margins
mbmp := TIEMultiBitmap.Create;
mbmp.ParamsEnabled := True;
mbmp.Read('D:\Input.tif');
for I := 0 to mbmp.Count-1 do
begin
  mbmp.Params[ I ].PDF_PaperSize := iepLetter;
  mbmp.Params[ I ].PDF_PageMargin := Round( 0.5 * 72 );
  mbmp.Params[ I ].PDF_Compression := ioPDF_Jpeg;
end;
mbmp.Write('D:\Output.pdf');
mbmp.Free;