Supported File Formats
GemBox.Pdf supports multiple file formats with varying degree of support.
File format support
GemBox.Pdf supports the following file formats:
Input and output:
- Adobe Portable Document Format (PDF).
- Image formats (PNG, JPEG, GIF, BMP, TIFF and WMP).
- Microsoft XML Paper Specification (XPS).
Supporting a file format as an input file format means that GemBox.Pdf is able to read the specified file format and supporting it as an output file format means that GemBox.Pdf is able to write to the specified file format.
GemBox.Pdf support for file formats depends on the used framework as following:
Additional conversion outputs
In addition to exporting to a file or a stream, GemBox.Pdf also supports printing a PDF file (Print() method) and converting a PDF file to the following types:
- XpsDocument using the PdfDocument.ConvertToXpsDocument(XpsSaveOptions) method and
- ImageSource using the PdfDocument.ConvertToImageSource(ImageSaveOptions) method.
These outputs are especially useful in WPF applications, by providing a means to embed a PDF file in your WPF application with DocumentViewer and Image controls, as shown in our GemBox.Pdf WPF examples.
// Assign a PdfDocument instance to DocumentViewer control. documentViewer.Document = pdfDocument.ConvertToXpsDocument(SaveOptions.Xps).GetFixedDocumentSequence(); // Assign a PdfDocument instance to Image control. image.Source = pdfDocument.ConvertToImageSource(SaveOptions.Image);
Support for Partially Trusted applications
Most of the Internet Service Providers restrict hosted ASP.NET applications to Medium Level Trust and by doing so, disable accessing files outside the application directory, among other things, as explained in trust Element (ASP.NET Settings Schema) level Attribute.
GemBox.Pdf support for Partially Trusted applications depends on the used file formats as follows:
- Adobe Portable Document Format (PDF) is fully supported in Partially Trusted applications.
- Writing text is supported in Partially Trusted applications if font location is set to a directory that is available to the Partially Trusted application.
Setting the font location directory is necessary for Partially Trusted applications because they can only access files inside the application directory, and font files are, by default, located in C:\Windows\Fonts, which is restricted to Partially Trusted applications. For more information on how to set font location directory, see the Private Fonts example. Font files are, usually, copyrighted, so make sure you conform to the font license, before copying a font file to another location.
- Creating a digitally signed PDF file is not supported in Partially Trusted applications because ComputeSignature() does not work in partial trust.
- Image formats (PNG, JPEG, GIF, BMP, TIFF and WMP) are not supported in Partially Trusted applications because BitmapEncoder class and its derived classes, used for writing image data to the specific image file format, do not work in partial trust.
- Microsoft XML Paper Specification (XPS) is not supported in Partially Trusted applications because ReachFramework.dll assembly, where most of the XPS implementation resides, is not decorated with AllowPartiallyTrustedCallersAttribute.
- Printing is not supported in Partially Trusted applications because it uses XPS infrastructure.