Addon.PDF.IsTextBasedPDF()

Description

Judges whether the local PDF is text-based or not.

Syntax

.Addon.PDF.IsTextBasedPDF(localFile)

Parameters

<string> localFile: specifies the local path of the target PDF.

Return value

bool

true indicates the PDF is text-based. false indicates the PDF is not text-based.

Example

function LoadImage() {
    if (DWObject) {
        DWObject.IfShowFileDialog = false;
        DWObject.ShowFileDialog(false, "PDF| *.pdf", 0, "", "", false, true, 0);
    }
}

function OnGetFilePath(bSave, filesCount, index, path, name) {
    fileName = path + "\\" + name;
    if (DWObject.Addon.PDF.IsTextBasedPDF(fileName)) {
        //Turn on PDF Rasterizer to Load text-based PDF files.    				
        DWObject.Addon.PDF.SetResolution(200);
        DWObject.Addon.PDF.SetConvertMode(EnumDWT_ConverMode.CM_RENDERALL);

        DWObject.LoadImage(fileName);
    }
    else {
        //Use Normal way instead of PDF Raterizer to load image-based PDF files.
        DWObject.Addon.PDF.SetConvertMode(EnumDWT_ConverMode.CM_DEFAULT);

        DWObject.LoadImage(fileName);
    }
}

See also

Addon.PDF.SetConvertMode() ShowFileDialog() OnGetFilePath