ImageEn, unit imageenio

TImageEnIO.SaveToPDF

TImageEnIO.SaveToPDF


Declaration

procedure SaveToPDF();


Description

Saves the current image to the active Adobe PDF file, opened using CreatePDFFile. If your image contains layers, then the layers will be output as scalable PDF objects.
The size of the page will be specified by PDF_PaperWidth and PDF_PaperHeight. Margins are specified by PDF_PageMargin.
Image position and size is affected by PDF_ImageOptions.

The following TIELayer features are not supported when exporting to PDF:
 Gradient fills
 Mask layers

Note:
 Images in the PDF file will be aligned to the upper-left corner of the page
 To abort while saving set Aborting to true
 Read more about ImageEn PDF Support
 The created PDF will be v1.4 format


Demo

Demo  Demos\InputOutput\PDFBuilder\PdfBuilder.dpr


Example 1

ImageEnView1.IO.CreatePDFFile( 'D:\output.pdf' );

// load and save page 1
ImageEnView1.IO.LoadFromFile('C:\page1.tiff');
ImageEnView1.IO.Params.PDF_Compression := ioPDF_G4FAX;  // G4Fax compression
ImageEnView1.IO.SaveToPDF();

// load and save page 2
ImageEnView1.IO.LoadFromFile('C:\page2.tiff');
ImageEnView1.IO.Params.PDF_Compression := ioPDF_G4FAX;  // G4Fax compression
ImageEnView1.IO.SaveToPDF();

...Other pages...

// Close PDF file
ImageEnView1.IO.ClosePDFFile();


Example 2

// Create a scalable PDF document containing ten pages with text and a shape
ImageEnView1.IO.CreatePDFFile( 'D:\Explosion.pdf' );

For I := 1 to 10 do
begin
  ImageEnView1.Blank;

  // Add a yellow explosion shape layer at size 220 x 120
  ImageEnView1.LayersAdd( iesExplosion, 50, 50, 220, 120 );
  ImageEnView1.CurrentLayer.FillColor    := clYellow;
  ImageEnView1.CurrentLayer.BorderWidth  := 0;

  // Add a text layer
  ImageEnView1.LayersAdd( ielkText );
  ImageEnView1.LayersAdd( 'Explosion on page ' + IntToStr( I ), 25, clRed, 'Arial Black', [fsBold] );
  ImageEnView1.CurrentLayer.PosX := IELayer_Pos_HCenter;
  ImageEnView1.CurrentLayer.PosY := IELayer_Pos_VCenter;
  ImageEnView1.Update();

  // Add as a page
  ImageEnView1.IO.SaveToPDF();
end;

// Close PDF file
ImageEnView1.IO.ClosePDFFile();


See Also

 CreatePDFFile
 ClosePDFFile
 SaveToFilePDF
 IECreatePDFFromFileList