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
9
10
11  exports.runRectTest = () => {
12    const PDFNet = exports.Core.PDFNet;
13
14    const main = async () => {
15      let ret = 0;
16      try {
17        console.log('Beginning Rect Test. This test will take the rect box of an image and move/translate it');
18
19        const inputPath = '../TestFiles/';
20        const doc = await PDFNet.PDFDoc.createFromURL(inputPath + 'tiger.pdf');
21        doc.initSecurityHandler();
22        doc.lock();
23        console.log('PDF document initialized and locked');
24
25        const pgItr1 = await doc.getPageIterator();
26        const mediaBox = await (await pgItr1.current()).getMediaBox();
27        mediaBox.x1 -= 200; // translate page 200 units left(1 uint = 1/72 inch)
28        mediaBox.x2 -= 200;
29
30        await mediaBox.update();
31
32        const docbuf = await doc.saveMemoryBuffer(PDFNet.SDFDoc.SaveOptions.e_linearized);
33        saveBufferAsPDFDoc(docbuf, 'tiger_shift.pdf');
34        console.log('Done.');
35      } catch (err) {
36        console.log(err);
37        ret = 1;
38      }
39      return ret;
40    };
41    // add your own license key as the second parameter, e.g. PDFNet.runWithCleanup(main, 'YOUR_LICENSE_KEY')
42    PDFNet.runWithCleanup(main);
43  };
44})(window);
45// eslint-disable-next-line spaced-comment
46//# sourceURL=AnnotationTest.js