How to use the PDF Rasterizer

The PDF Rasterizer was designed to support non-image PDF files. The key APIs are

Addon.PDF.DownloadAddon.PDF.SetResolution, Addon.PDF.SetConvertModeAddon.PDF.SetPassword

There are 3 JS files and 4 zip files directly related to this add-on, they are found under /Resources/addon/


In order to use this add-on, the steps are

1.  Reference the file dynamsoft.webtwain.addon.pdf.js in your code.

<script type="text/javascript" src="Resources/dynamsoft.webtwain.initiate.js"> </script>
<script type="text/javascript" src="Resources/dynamsoft.webtwain.config.js"> </script>
<script type="text/javascript" src="Resources/addon/dynamsoft.webtwain.addon.pdf.js"> </script>

2.  Download the necessary DLL file and Set up the add-on, please note you'll need to make sure the url to download the Zip is correct based on your project structure.

function Dynamsoft_OnReady() {
  DWObject = Dynamsoft.WebTwainEnv.GetWebTwain('dwtcontrolContainer');
  if (DWObject) {
    var _pdfPath = "http://localhost/dwt/addon/";
      _pdfPath = "http://localhost/dwt/addon/";
    else if (Dynamsoft.Lib.env.bLinux)
      _pdfPath = "http://localhost/dwt/addon/";
      function () { console.log('Successfully Downloaded PDF add-on');},      
      function (errorCode, errorString) {alert(errorString); }

How it works

Dynamsoft has optimized this PDF Rasterizer internally so that when you have done the 2 steps above, the PDF rasterizer will be ready to work in your application. Basically, when you try to load or download any PDF file, the rasterizer will be called automatically to convert the PDF into images before loading them. In other words, the feature is turned on and you don’t need to write any extra code to use it.

Below we'll demonstrate how the 'download' method works on Windows, it's similar on Mac/Linux.

.Addon.PDF.Download(remoteFile, [optionalAsyncSuccessFunc, optionalAsyncFailureFunc])



Is this page helpful?

Leave a Reply

Your email address will not be published.