How To Convert Image Files To PDF Using eDocEngine VCL
Do you want to convert image formats such as EMF, WMF, BMP and JPEG to PDF?
By R. Vyshakh and D. Ashwini
In this article, we will demonstrate how to use eDocEngine VCL to convert several image files to a single or multiple PDF documents.
Use gtPDFEngine component for creating PDF document
- Drop
gtPDFEngine component on the form from the eDocEngine palette in Delphi.
- Drop a button component on the form.
- Handle
OnClick event of the button and use gtPDFEngine component to start creating the PDF.
Set properties of gtPDFEngine for setting page size
- Set
ProcessAfterEachPage property to True.
- Set
MeasurementUnit to muPixels.
...
gtPDFEngine1.Preferences.ProcessAfterEachPage := True;
gtPDFEngine1.MeasurementUnit := muPixels;
...
Page.PaperSize := Custom;
Page.Width := Image1.Picture.Width;
Page.Height := Image1.Picture.Height;
...
Render images to a single or multiple PDF files
- Add image files (BMP, JPEG, WMF or EMF) which need to be rendered.
- Use method
gtPDFEngine1.DrawImage(...) to render the image on PDF file.
- If an image is a metafile it will be rendered as a raster image.
- Use method
gtPDFEngine1.PlayMetafile(...) to render the metafile as vector image on the PDF.
The complete source code is available in downloads section.
---oO0Oo---
Downloads
This site is best viewed on a screen with minimum resolution of 1152 x 864 pixels.
Windows users are advised to use Microsoft ClearType Tuning for optimal experience.
Linux and other users can enable font smoothing, as supported by their OS.
Also, please use the latest version of a standards-compliant browser such as Opera, FireFox, Chrome or Safari.