Declaration
procedure SaveToFilePDF(const FileName: WideString);
Description
Saves the current image or
layers to a file in Adobe PDF format.
FileName is the file name including extension.
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◼For text layers, only 90 deg.
rotations are supported.
Rich text formatting is not supported. To work around this,You might want to
convert the text layers to images before saving.
The engine used to save PDF files (either using
PDFium or ImageEn native code) is specified by
PDFEngine.
Note:
◼If
PdfViewer is enabled, all pages of the
PdfViewer will be saved
◼Otherwise the created file will have only one page. See
CreatePDFFile to create multi-page PDF files.
◼If an internal save error is encountered
Aborting will return true. Saving issues due to insufficient write permissions and disk write failures will raise an exception.
◼To abort while saving set
Aborting to true
◼Read more about
ImageEn PDF SupportExample 1
// Convert a BMP image to PDF
ImageEnView1.IO.LoadFromFile('C:\input.bmp');
ImageEnView1.IO.SaveToFilePDF('D:\output.pdf');
Example 2
// Create a scalable PDF document containing text and a shape
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( 'This is an Explosion', 42, clRed, 'Arial Black', [fsBold] );
ImageEnView1.CurrentLayer.PosX := IELayer_Pos_HCenter;
ImageEnView1.CurrentLayer.PosY := IELayer_Pos_VCenter;
ImageEnView1.Update();
// Save it
ImageEnView1.IO.SaveToFilePDF('D:\Explosion.pdf');
Example 3
// Merge two PDF documents
ImageEnView1.PdfViewer.Enabled := True;
ImageEnView1.IO.LoadFromFilePDF( 'C:\document.pdf' );
ImageEnView1.PdfViewer.ImportPages( 'C:\morepages.pdf' );
ImageEnView1.IO.SaveToFilePDF( 'C:\merged.pdf' );
Compatibility Information
Prior to v13.2.0, ImageEn would always use native code to save PDF files. From v13.2.0, the saving engine is controlled by
PDFEngine. If the
PDFium DLL (iepdf*.dll) is located in the EXE folder, ImageEn will now default to using PDFium for saving. To avoid this, set IEGlobalSettings().PDFEngine := ieenNative;
See Also
◼CreatePDFFile◼SaveToPDF◼IECreatePDFFromFileList