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), e.g. 72 would be 1 inch margins.

Note:
This property is only used when saving PDF files natively, e.g. using TImageEnIO.SaveToFilePDF or TImageEnMIO.SaveToFilePDF (and the PdfViewer 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
The maximum horizontal margin would be PDF_PaperWidth / 2. The maximum vertical margin would be PDF_PaperHeight / 2. You should not specify a margin that exceeds the lesser of these two values

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.LoadFromFile('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;
  mbmp.Params[i].JPEG_Quality    := 90;
end;
mbmp.SaveToFile('D:\Output.pdf');
mbmp.Free;