Visual Basic (Declaration) | |
---|---|
Public Property EmfHandle As IntPtr |
Visual Basic (Usage) | Copy Code |
---|---|
|
C# | |
---|---|
public IntPtr EmfHandle {get; set;} |
Return Value
An IntPtr structure that contains the unmanaged handle to the Windows Enhanced Meta File object.The EmfHandle property must contain a valid Windows Enhanced Meta File handle (EMF)--it cannot be IntPtr.Zero. This EMF handle is used in the DocumentWriter.AddPage method to create the visual representation of the new page added to the document being created.
The LEADTOOLS Document Writer toolkit will not use the EmfHandle after the call to DocumentWriter.AddPage returns. This handle needs to be deleted to free the resources associated with it (for example, using the Windows API DeleteEnhMetaFile).
The Windows Enhanced Meta File (EMF) objects can be obtained from various sources as shown in the following list:
The LEADTOOLS Annotations toolkit has support for creating an EMF file representation of the annotation objects in a container. Therefore, the Annotations toolkit can be used to create a document and populate it with various annotations objects. The result can then be saved as a PDF file (for example using the DocumentWriter class). The Document Writer demo shipping with the LEADTOOLS Toolkit shows an example of this scenario. For more information, refer to Programming With LEADTOOLS Annotations. The LEADTOOLS Virtual Printer Driver toolkit allows you to capture output from any Windows application as an EMF handle. Next, use the DocumentWriter class to convert this output to a PDF, HTML or a DOC document. For more information, refer to LEADTOOLS Virtual Printer Driver. The Windows Enhanced Meta File (EMF) is a standard format in Microsoft Windows. Many other applications and frameworks provide support for outputting as EMF. You can convert the output from any such application or framework to any of the document formats supported by the DocumentWriter.
The Dots/Inch (DPI) of the page is the same as the DPI stored in the 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). When using the PDF with image and text feature, set the DPI of the RasterImage object to the same DPI as the EMF handle using the RasterImage.XResolution and RasterImage.YResolution properties.
The LEADTOOLS Document Writer supports creating documents with zero or more empty pages inside them. Simply add a page with the DocumentPage.EmfHandle property set to the default value of IntPtr.Zero and call the DocumentWriter.AddPage method. The dimension of the empty page must be set before hand in the DocumentOptions.EmptyPageWidth and DocumentOptions.EmptyPageHeight and its resolution set to DocumentOptions.EmptyPageResolution. As many empty pages as desired can be added and in any index desired. To use empty pages, make sure the DocumentOptions.PageRestriction property is set to DocumentPageRestriction.Relaxed.
Target Platforms: Microsoft .NET Framework 3.0, Windows XP, Windows Server 2003 family, Windows Server 2008 family