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

The core JS file and its libraries (.zip) directly related to this add-on are found under /Resources/addon/ and Resources/dist/{win|mac|linux}/


NOTE: In v14.2, the PDF Rasterizer is installed with Dynamsoft Service and you won't be able to find the ZIPs mentioned above in /Resources/

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

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

<script src="Resources/dynamsoft.webtwain.initiate.js"> </script>
<script src="Resources/dynamsoft.webtwain.config.js"> </script>
<script 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.

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