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