1<html>
2 <script src="../lib/core/CoreControls.js"></script>
3 <script src="../lib/core/pdf/PDFNet.js"></script>
4 <script>
5 (async function() {
6 CoreControls.setWorkerPath('../lib/core');
7
8 // In case you have PDFDoc you can always access
9 // SDF/Cos document using PDFDoc.GetSDFDoc() method
10 const pdf_doc = await PDFNet.PDFDoc.createFromURL(filename);
11 const doc = await pdf_doc.getSDFDoc();
12 const trailer = await doc.getTrailer(); // Get the trailer
13
14 // Create an Info dictionary
15 const info = await trailer.putDict('Info');
16 info.putString('Producer', 'Apryse PDFNet');
17
18 // Create a custom inline dictionary within Infor dictionary
19 const customDict = await info.putDict('My Direct Dict');
20 customDict.putNumber('My Number', 100);
21 })()
22 </script>
23</html>