PDF Rasterizer

Methods
Addon.PDF.Download() Addon.PDF.SetResolution()
Addon.PDF.SetPassword() Addon.PDF.SetConvertMode()

Code example

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

    //Callback functions for async APIs
    function OnSuccess() {
        console.log('successful');
    }

    function OnFailure(errorCode, errorString) {
        alert(errorString);
    }

    function LoadImage() {
        if (DWObject) {
            //Please NOTE that the PDF Rasterizer doesn't work for Chrome/Firefox 26-            
            // Call DWObject.Addon.PDF.Download(url) to download PDF Rasterizer module to local.
            DWObject.Addon.PDF.SetResolution(200);   
            DWObject.Addon.PDF.SetConvertMode(EnumDWT_ConvertMode.CM_RENDERALL);   

            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
        }
    }

Methods

Addon.PDF.Download()
Downloads and installs the PDF add-on (it's typically a zipped dll file) on the local system.
Syntax .Addon.PDF.Download(remoteFile, [optionalAsyncSuccessFunc, optionalAsyncFailureFunc]);
Parameters string remoteFile: specifies the url path of the add-on. E.g. "http://www.dynamsoft.com/DWT/Resources/PDF.zip".
OnSuccess function optional optionalAsyncSuccessFunc: callback function triggered when the file is downloaded successfully.
OnFailure function optional optionalAsyncFailureFunc: callback function triggered when the file failed to be downloaded.
Return value boolean
Only valid when used synchronously.
Usage notes The server version number info is defined in the addon JS file. As long as the defined version number is not the same as the local addon dll, the download method will auto get the dll from server deployed to local.
Availability v11.2+
Addon.PDF.SetResolution()
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+
Addon.PDF.SetPassword()
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+
Addon.PDF.SetConvertMode()
Sets the image convert mode for the PDF Rasterizer.
Syntax .Addon.PDF.SetConvertMode(EnumDWT_ConvertMode.CM_RENDERALL);
Parameters EnumDWT_ConvertMode
EnumDWT_ConvertMode.CM_DEFAULT : It's the default mode. In this mode, the PDF Rasterizer is turned off.
EnumDWT_ConvertMode.CM_RENDERALL : All the content in the target PDF file will converted 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.
Return value boolean
Usage notes Use this method before you import a PDF into the control with methods such as LoadImage() and FTPDownload().
Availability v11.2+

results matching ""

    No results matching ""

    results matching ""

      No results matching ""