Addon.PDF.SetConvertMode()

Description

Sets the image convert mode for the PDF Rasterizer.

Data type

EnumDWT_ConvertMode

Syntax

.Addon.PDF.SetConvertMode(EnumDWT_ConvertMode.CM_RENDERALL);

Remarks

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

Value Description
CM_DEFAULT (0) It's the default mode. In this mode, the PDF Rasterizer is turned off.
CM_RENDERALL (1) 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.

The default mode is CM_DEFAULT (0).

When an error occurs, check ErrorCode or ErrorString for error information.

See also

Addon.PDF.SetResolution()
LoadImage()

Example

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

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

  function LoadImage() {
      if (DWObject) {
          // Call DWObject.Addon.PDF.Download(url) to download PDF Rasterizer module to local.
          DWObject.Addon.PDF.SetConvertMode(EnumDWT_ConvertMode.CM_RENDERALL);
          DWObject.Addon.PDF.SetResolution(100);  

          // Open the system's file dialog to load image
          DWObject.IfShowFileDialog = true;

          // Load images in all supported formats (.bmp, .jpg, .tif, .png, .pdf). 
          // OnSuccess or OnFailure will be called after the operation.
          DWObject.LoadImageEx("", EnumDWT_ImageType.IT_PDF, OnSuccess, OnFailure);
      }
  }
Is this page helpful?

Leave a Reply

Your email address will not be published.