PDF Read & Write

Addon.PDF.IsModuleInstalled() Addon.PDF.IsTextBasedPDF()
Addon.PDF.SetResolution() Addon.PDF.SetPassword()
Addon.PDF.SetConvertMode() Addon.PDF.Write.Setup()

Code example

The following code example demonstrates how to use the APIs above to perform basic scanning.

    //Callback functions for async APIs
    function OnSuccess() {

    function OnFailure(errorCode, errorString) {

    function LoadImage() {
        if (DWObject) {
            //Please NOTE that the PDF Rasterizer doesn't work for Chrome/Firefox 26-

            DWObject.IfShowFileDialog = true; // Open the system's file dialog to load image
            DWObject.LoadImageEx("", EnumDWT_ImageType.IT_PDF, OnSuccess, OnFailure); 
            // Load images in all supported formats (.bmp, .jpg, .tif, .png, .pdf). OnSuccess or OnFailure will be called after the operation


Detects whether PDF rasterizer library has been installed.
Syntax .Addon.PDF.IsModuleInstalled();
Parameters none
Return value boolean
Usage notes none
Availability v14.1+
Detects whether a local PDF file is text based or not.
Syntax .Addon.PDF.IsTextBasedPDF(localFilePath)
Parameters string localFilePath: Specifies the file to inspect.
Return value boolean
Usage notes none
Availability v11.2+
Sets the output image resolution of the PDF Rasterizer.
Syntax .Addon.PDF.SetResolution(resolution)
Parameters number resolution: specifies the resolution of the output images.
Return value boolean
Usage notes The default value is 200. We recommend that you set a value smaller than 300, otherwise it might slow down the program or cause the process to fail.
Availability v11.2+
Specifies the password needed for rasterizing a password-protected PDF file.
Syntax .Addon.PDF.SetPassword(password)
Parameters string password: Specifies the PDF password.
Return value boolean
Usage notes This API is only available in the HTML5 edition for Windows.
Availability v11.2+
Sets the image convert mode for the PDF Rasterizer.
Syntax .Addon.PDF.SetConvertMode(EnumDWT_ConvertMode.CM_RENDERALL);
Parameters EnumDWT_ConvertMode
EnumDWT_ConvertMode.CM_RENDERALL (1): All the content in the target PDF file will be rasterized in a set resolution in this mode. The value of the resolution is 200 by default but can be set via the method Addon.PDF.SetResolution.
EnumDWT_ConvertMode.CM_IMAGEONLY (2): It's the default mode. In this mode, the PDF Rasterizer is turned off.
EnumDWT_ConvertMode.CM_AUTO (3): When set to auto, the SDK will automatically detect whether a file needs to be rasterized or not and then process the file accordingly. Note that this works for the HTML5 edition on Windows only. On other platforms or when using ActiveX, CM_AUTO is equavalent to CM_IMAGEONLY.
Return value boolean
Usage notes Use this method before you import a PDF into the control with methods such as LoadImage(), HTTPDownload() and FTPDownload().
Availability v11.2+
Sets up the PDF writing engine.
Syntax .Addon.PDF.Write.Setup(Setting);
Parameters WriteSetting: a JSON object like the following (pay attention to "D:" in date related settings).
​      author: 'tom',
​      compression: EnumDWT_PDFCompressionType,
​      creator: 'dwt',
​      creationDate: 'D:20181231',
​      keyWords: 'dwt',
​      modifiedDate: 'D:20181231',
​      producer: 'dynamsoft',
​      subject: 'blah',
​      title: 'dwt',
​      version: 1.4,
​      quality: 80, //only for JPEG & JPEG2000 compression
Return value boolean
Usage notes Use this method before you create a PDF with methods such as HTTPUpload() and FTPUpload(), etc.
Availability v15.0+

results matching ""

    No results matching ""

    results matching ""

      No results matching ""