diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2017-04-07 16:16:56 +0200 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2017-04-13 13:16:21 +0200 |
commit | 9c805cc9f934cd12e89014db8ad70e3191cdaf2d (patch) | |
tree | 5aece10eaccc25d060b2803c4d201341048caf96 /docs/mutool/examples/pdf-create.js | |
parent | 49d5a9856020627af1fc4063ff5a26b26e9270cf (diff) | |
download | mupdf-9c805cc9f934cd12e89014db8ad70e3191cdaf2d.tar.xz |
Move all examples to docs/examples directory.
Diffstat (limited to 'docs/mutool/examples/pdf-create.js')
-rw-r--r-- | docs/mutool/examples/pdf-create.js | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/docs/mutool/examples/pdf-create.js b/docs/mutool/examples/pdf-create.js deleted file mode 100644 index 290d1737..00000000 --- a/docs/mutool/examples/pdf-create.js +++ /dev/null @@ -1,35 +0,0 @@ -// Create a PDF from scratch using helper functions. - -// This example creates a new PDF file from scratch, using helper -// functions to create resources and page objects. -// This assumes a basic working knowledge of the PDF file format. - -// Create a new empty document with no pages. -var pdf = new PDFDocument() - -// Load built-in font and create WinAnsi encoded simple font resource. -var font = pdf.addSimpleFont(new Font("Times-Roman")) - -// Load PNG file and create image resource. -var image = pdf.addImage(new Image("example.png")) - -// Create resource dictionary. -var resources = pdf.addObject({ - Font: { Tm: font }, - XObject: { Im0: image }, -}) - -// Create content stream data. -var contents = - "10 10 280 330 re s\n" + - "q 200 0 0 200 50 100 cm /Im0 Do Q\n" + - "BT /Tm 16 Tf 50 50 TD (Hello, world!) Tj ET\n" - -// Create a new page object. -var page = pdf.addPage([0,0,300,350], 0, resources, contents) - -// Insert page object at the end of the document. -pdf.insertPage(-1, page) - -// Save the document to file. -pdf.save("out.pdf", "pretty,ascii,compress-images,compress-fonts") |