galkahana / HummusJS

Node.js module for high performance creation, modification and parsing of PDF files and streams
http://www.pdfhummus.com
Other
1.14k stars 169 forks source link

Is it possible to nest dictionaries ? #288

Open xostap opened 6 years ago

xostap commented 6 years ago

I was wondering if someone has a working example of how to nest dictionaries. I need to create a dictionary "MK" with 2 keys "BC" (Array) and BG (Array) as part of "Annot" dictionary

Annot (Dictionary)
      .....
      MK (Dictionary)
          BC (Array)
               0.90916
               0.90916
               0.90916
         BG  (Array)
              0.90916
              0.90916
             0.90916
      .....
chunyenHuang commented 6 years ago

This script should help you to achieve your request.

https://github.com/galkahana/HummusJS/blob/8c8c540f72a5f49875f15f0b94ede23c53fb413d/tests/ModifyingExistingFileContent.js#L39

https://github.com/galkahana/HummusJS/blob/8c8c540f72a5f49875f15f0b94ede23c53fb413d/tests/ModifyingExistingFileContent.js#L189