diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2017-04-10 13:26:28 +0200 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2017-04-13 14:13:31 +0200 |
commit | 708cf16d9259392dab17bdb1eeaefa21baa5a7fe (patch) | |
tree | 9f2aad93a52ee247ee1bc97d313a4de099f2ef44 /docs/examples | |
parent | 6a1f52a68d198df5a054bcb7e8bebc4718e7c975 (diff) | |
download | mupdf-708cf16d9259392dab17bdb1eeaefa21baa5a7fe.tar.xz |
Use addRawStream in pdf-create-lowlevel.js example script.
The more explicit createObject, writeObject, writeRawStream idiom is
shown in pdf-merge.js.
Diffstat (limited to 'docs/examples')
-rw-r--r-- | docs/examples/pdf-create-lowlevel.js | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/docs/examples/pdf-create-lowlevel.js b/docs/examples/pdf-create-lowlevel.js index 658adfb5..c7a299f7 100644 --- a/docs/examples/pdf-create-lowlevel.js +++ b/docs/examples/pdf-create-lowlevel.js @@ -15,22 +15,20 @@ var font = pdf.addObject({ }) // Create and add an image resource: -// Allocate a slot for a new object and get a reference to it. -var image = pdf.createObject() -// Write a dictionary object into the slot. -image.writeObject({ - Type: "XObject", - Subtype: "Image", - Width: 4, - Height: 2, - BitsPerComponent: 8, - ColorSpace: "DeviceGray", - // The compression filter to be used: - Filter: "ASCIIHexDecode", -}) -// Write raw stream data into the slot; hex encoded -// to match the Filter entry in the dictionary. -image.writeRawStream("004488CCEEBB7733>") +var image = pdf.addRawStream( + // The raw stream contents, hex encoded to match the Filter entry: + "004488CCEEBB7733>", + // The image object dictionary: + { + Type: "XObject", + Subtype: "Image", + Width: 4, + Height: 2, + BitsPerComponent: 8, + ColorSpace: "DeviceGray", + Filter: "ASCIIHexDecode", + } +); // Create resource dictionary. var resources = pdf.addObject({ |