Send comments on this topic. | Back to Introduction - All Topics | Help Version 16.5.9.25
Programming with the LEADTOOLS Document Writers

The LEADTOOLS Document Writers allows you to create popular multi-page and searchable document formats from standard Windows Enhanced Meta File (EMF) objects.

Support for the following document formats is included:

  • Adobe Portable Document Format (PDF). With support for PDF/A and optional image over text overlays. The PDF document support requires unlocking an extra key before it can be used. For more information, refer to RasterSupportType and Unlocking Special LEAD Features

  • Microsoft Open XML Paper Specification (XPS)

  • Microsoft Word document format (DOC)

  • Microsoft Rich Text Format (RTF)

  • The EMF object is a standard Windows Enhanced Meta File object. An EMF is a collection of structures that store a picture in a device-independent format. Device independence is the one feature that sets metafiles apart from raster images. Unlike a raster image, a metafile guarantees device independence. The EMF can contain various objects such as Text, Lines and raster images. EMF also contains Dots/Inch (DPI) information that is used to calculate the real size of the picture stored inside.

The Windows Enhanced Meta File (EMF) objects can be obtained from various sources, for example:

  • The LEADTOOLS Annotations toolkit has support for creating an EMF file representation of the annotation objects in a container. Therefore, you can use the Annotations toolkit to create a document and populate it with various annotations objects and then save the result as a PDF file for example using the DocumentWriter class. The Document Writer demo shipping with the LEADTOOLS Toolkit shows how an example on this scenario. For more information, refer to Programming With LEADTOOLS Annotations

To create a document from EMF, you do the following:

Many of the document formats supported by DocumentWriter contain extra options and functionality that can be controlled through the use of the DocumentWriter.GetOptions and DocumentWriter.SetOptions methods. These options can be set and then saved to an external XML file using the DocumentWriter.SaveOptions method. Later, you can re-load these options using the DocumentWriter.LoadOptions method.

Support is provided to monitor the document creation operation through the DocumentWriter.Progress event. Your application can provide a visual feedback using a progress bar and a cancel button to the user to allow both monitoring and abortion of the current operation.

The LEADTOOLS Temporary Document format (DocumentFormat.Ltd) allows you to create a temporary document on disk that you can add pages to in between sessions. This can be helpful when you have large amount of pages to add to a PDF document for example or when not all the pages can be obtained at the same time (for example, in a server scenario when the client sends one page to the server at a time). After all pages are added to the temporary file on disk, you can use the DocumentWriter.Convert method to convert this file to the final document (for example PDF or DOC).

The Dots/Inch (DPI) of the page is the same as the DPI stored in the DocumentPage.EmfHandle property. Therefore, to create a page with 300 DPI, you must add a document page with an EMF that has a DPI of 300 (both horizontally or vertically although the LEADTOOLS Document Writer supports different values for the DPI). If you are using the PDF with image/text feature, you must set the DPI of the RasterImage object to the same DPI as the EMF handle using the RasterImage.XResolution and RasterImage.YResolution properties.

See Also