Dev Center
Table of contents

Thanks for Downloading Dynamic Web TWAIN 30-Day Trial!

Your download will start shortly. If your download does not begin, click here to retry.

{WebTwainObject}.Addon.PDF

{WebTwainObject} denotes the WebTwain instance.

Methods

       
GetConvertMode() GetReaderOptions() IsModuleInstalled() IsTextBasedPDF()
SetConvertMode() SetPassword() SetResolution() Write.Setup()
SetReaderOptions()      

GetConvertMode

This API has been deprecated as of release 18.4. Please use the GetReaderOptions() function.

Return the convert mode.

Syntax

GetConvertMode(): number;

Availability

ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux) Android
not supported v17.2+ v17.2+ v17.2+ v17.2+ v18.2+

GetReaderOptions

Returns the current PDF reader options.

Syntax

GetReaderOptions(): ReaderOptions;

Availability

ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux) Android
not supported v18.4+ v18.4+ v18.4+ v18.4+ v18.4+

IsModuleInstalled

Return whether the PDF module has been installed.

Syntax

IsModuleInstalled(): boolean;

Availability

ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux) Android
v14.1+ v14.1+ v14.1+ v14.1+ v14.1+ v18.2+

IsTextBasedPDF

Detect whether a local PDF file is text based or not.

Syntax

IsTextBasedPDF(path: string): boolean;

Parameters

path: Specify the path of the PDF file.

Availability

ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux) Android
v11.2+ v11.2+ v11.2+ v11.2+ v11.2+ v18.2+

SetConvertMode

This API has been deprecated as of release 18.4. Please use the SetReaderOptions() function.

Set the convert mode.

Syntax

SetConvertMode(mode: Dynamsoft.DWT.EnumDWT_ConvertMode | number): boolean;

Parameters

mode: Specify the mode. The default value is 3 (Dynamsoft.DWT.EnumDWT_ConvertMode.CM_AUTO)

Availability

ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux) Android
v11.2+ v11.2+ v11.2+ v11.2+ v11.2+ v18.2+

Usage notes

There are three conversion modes

  • CM_RENDERALL (1): All the content in the target PDF file will be rasterized.
  • CM_IMAGEONLY (2): The PDF Rasterizer is turned off.
  • CM_AUTO (3): The library automatically detect whether a file needs to be rasterized or not and then process the file accordingly.

Use this method before you import a PDF into the viewer with methods such as LoadImage() , HTTPDownload() and FTPDownload().


SetReaderOptions

Sets the current PDF reader options.

Syntax

SetReaderOptions(options: ReaderOptions): boolean;

Parameters options: Please see the ReaderOptions interface.

Availability

ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux) Android
not supported v18.4+ v18.4+ v18.4+ v18.4+ v18.4+

Usage Notes Use this method before you import a PDF into the viewer with methods such as LoadImage() , HTTPDownload() and FTPDownload().

Example

DWObject.Addon.PDF.SetReaderOptions({
    convertMode: Dynamsoft.DWT.EnumDWT_ConvertMode.CM_RENDERALL,
    renderOptions: {
        renderAnnotations: false,
        renderGrayscale: true,
    }
});

SetPassword

This API has been deprecated as of release 18.4. Please SetReaderOptions() function.

Set the password for reading encrypted PDF files.

Syntax

SetPassword(password: string): boolean;

Parameters

password: Specify the password.

Availability

ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux) Android
v11.2+ v11.2+ v11.2+ v11.2+ v11.2+ v18.2+

Usage notes

Use this method before you import a PDF into the viewer with methods such as LoadImage() , HTTPDownload() and FTPDownload().


SetResolution

This API has been deprecated as of release 18.4. Please use the SetReaderOptions() function.

Set the resolution for rasterizing.

Syntax

SetResolution(resolution: number): boolean;

Parameters

resolution: Specify the resolution.

Availability

ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux) Android
v11.2+ v11.2+ v11.2+ v11.2+ v11.2+ v18.2+

Usage notes

The default resolution for the conversion 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.

Use this method before you import a PDF into the viewer with methods such as LoadImage() , HTTPDownload() and FTPDownload().


Write.Setup()

Set up the PDF writing engine.

Syntax

Write.Setup(settings: PDFWSettings): void;

interface PDFWSettings {
    /**
     * Specify the author.
     */
    author?: string;
    /**
     * Specify the compression type.
     */
    compression?: Dynamsoft.DWT.EnumDWT_PDFCompressionType | number;
     /**
     * Specify the page type.
     */
    pageType?: Dynamsoft.DWT.EnumPDF_Page | number; 
    /**
     * Specify the creator.
     */
    creator?: string;
    /**
     * Specify the creation date.
     * Note that the argument should start with 'D:' like 'D:20181231'.
     */
    creationDate?: string;
    /**
     * Specify the key words.
     */
    keyWords?: string;
    /**
     * Specify the modified date.
     * Note that the argument should start with 'D:' like 'D:20181231'.
     */
    modifiedDate?: string;
    /**
     * Specify the producer.
     */
    producer?: string;
    /**
     * Specify the subject.
     */
    subject?: string;
    /**
     * Specify the title.
     */
    title?: string;
    /**
     * Specify the PDF version. For example, 1.5. The allowed values are 1.1 ~ 1.7.
     * NOTE: If the compression type is PDF_JBig2, the lowest allowed version is 1.4
     * If the compression type is PDF_JP2000, the lowest allowed version is 1.5
     */
    version?: string;
    /**
     * Specify the quality of the images in the file.
     * The value ranges from 0 to 100.
     * Only valid when the {compression} is 'JPEG' or 'JPEG2000'.
     */
    quality?: number;
}

Parameters

settings: Configures how the PDF is generated.

Availability

ActiveX H5(Windows) H5(macOS/TWAIN) H5(macOS/ICA) H5(Linux) Android
not supported v15.0+ v15.1+ v15.1+ v15.1+ v18.2+

Usage notes

Use this method before you create a PDF with methods such as HTTPUpload(), SaveAsPDF(), and SaveAllAsPDF()

Only the core module license is required to use this method.

Is this page helpful?

YesYes NoNo

In this article:

latest version

    • Latest Version (18.4)
    • Version 18.3
    • Version 18.1
    • Version 18.0
    • Version 17.3
    • Version 17.2.1
    • Version 17.1.1
    • Version 17.0
    • Version 16.2
    • Version 16.1.1
    Change +