1//---------------------------------------------------------------------------------------
2// Copyright (c) 2001-2023 by Apryse Software Inc. All Rights Reserved.
3// Consult legal.txt regarding legal and license information.
4//---------------------------------------------------------------------------------------
5
6(exports => {
7
8  exports.runPDFDrawTest = () => {
9    const PDFNet = exports.Core.PDFNet;
10
11    const main = async () => {
12      console.log('Beginning Test');
13      const ret = 0;
14      const inputUrl = '../TestFiles/';
15      const doc = await PDFNet.PDFDoc.createFromURL(inputUrl + 'newsletter.pdf');
16      doc.initSecurityHandler();
17      doc.lock();
18
19      console.log('PDFNet and PDF document initialized and locked');
20
21      const pdfdraw = await PDFNet.PDFDraw.create(92);
22      const itr = await doc.getPageIterator(1);
23      const currPage = await itr.current();
24      const pngBuffer = await pdfdraw.exportStream(currPage, 'PNG');
25      saveBufferAsPNG(pngBuffer, 'newsletter.png');
26      const tifBuffer = await pdfdraw.exportStream(currPage, 'TIFF');
27      saveBufferAsPNG(tifBuffer, 'newsletter.tif');
28
29      console.log('Done');
30      return ret;
31    };
32
33    // add your own license key as the second parameter, e.g. PDFNet.runWithCleanup(main, 'YOUR_LICENSE_KEY')
34    PDFNet.runWithCleanup(main);
35  };
36})(window);
37// eslint-disable-next-line spaced-comment
38//# sourceURL=PDFDrawTest.js