DocumentWriter#
DocumentWriter objects are used to create new documents in several formats.
CONSTRUCTOR METHODS
- DocumentWriter(buffer: Buffer, format: string, options: string)#
Create a new document writer to create a document with the specified format and output options. The
options
argument is a comma separated list of flags and key-value pairs.The output
format
&options
are the same as in the mutool convert command.- Parameters:
buffer – Buffer. The buffer to output to.
format –
string
. The file format.options –
string
. The options as key-value pairs.
- Returns:
EXAMPLE
var writer = new mupdfjs.DocumentWriter(buffer, "PDF", "");
INSTANCE METHODS
- beginPage(mediabox: Rect)#
Begin rendering a new page. Returns a Device that can be used to render the page graphics.
EXAMPLE
var device = writer.beginPage([0,0,100,100]);
- endPage()#
Finish the page rendering.
EXAMPLE
writer.endPage();
- close()#
Finish the document and flush any pending output.
EXAMPLE
writer.close();
Code samples
Code samples are in TypeScript and assume that the following requirements are defined in your TypeScript file header as follows:
import * as fs from "fs"
import * as mupdfjs from "mupdf/mupdfjs"