usePdfPrinting Property

Summary

Indicates whether PDF printing should be used.

Syntax
TypeScript
JavaScript
Object.defineProperty(PrintDocumentOptions.prototype, 'usePdfPrinting', 
	get: function(), 
	set: function(value) 
) 
usePdfPrinting: boolean; 

Property Value

true to enable PDf printing; otherwise, false. The default value is false.

Remarks

PDF printing leverages a browser's native support for PDF files to streamline the printing process.

When this property is set to true, the Document Viewer will call PDFPrinter.asPrintablePDF to generate a PDF-compatible version of the document currently loaded into the viewer. For browsers that support creating local PDF URL resources, the PDF URL will be created by calling createObjectUrl. The parent for the print options needs to be set to an IFrame for these browsers. If autoOpenBrowserPrint is set to true, the life cycle of these objects will be handled internally; otherwise, DocumentViewer.print will resolve to a PDFPrintResult object.

Internet Explorer is a special case as far as PDF printing is concerned. CreateObjectUrl is not supported for PDF objects, and it is not possible to directly call print on an IFrame containing a PDF resource. Native PDF printing in IE still leverages an ActiveX Adobe control as well. Due to this, the workflow in IE has to be handled slightly differently, as follows:

  1. Instead of creating a local PDF resource, use the PDF's data directly from the Document Service.
  2. Instead of setting the src on an IFrame to the PDF URL, create a new HTML object and set its data property.
    • If the web application is running in an IFrame, or is using a framework that mutates the DOM such as React, the parent should be set to the document body. This allows the print to be invoked without worrying about the DOM node being removed while IE's ActiveX PDF plug-in is invoked.
  3. Since there is no way of determining when the print dialog is opened and closed, DocumentViewer.print will fire a progress event indicating that IE's ActiveX control has been invoked. This is an ideal place to bind any logic that affects the application's UI, such as hiding a loading dialog.

✎ NOTE

Firefox does not support printing PDFs directly due to an internal issue with their PDFJS configurations. Trying to call DocumentViewer.print with this flag set to true in Firefox will throw a "feature not supported" exception.

Requirements

Target Platforms

Help Version 22.0.2023.4.18
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Document.Viewer Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.