DocumentWriter#
This class represents a utility which can output various document types supported by MuPDF.
Only used for outputting PDF documents whose pages are populated by Story DOMs.
Using DocumentWriter also for other document types might happen in the future.
Method / Attribute |
Short Description |
|---|---|
Start a new output page |
|
Finish the current output page |
|
Flush pending output and close the file |
Class API
- class DocumentWriter#
- DocumentWriter(string path, string options: null)#
Create a document writer object, passing file path. Options to use when saving the file may also be passed.
This class can also be used as a context manager.
- Parameters:
path – the output file. This may be a string file name.
options (string) – specify saving options for the output PDF. Typical are “compress” or “clean”. More possible values may be taken from help output of the
mutool convertCLI utility.
- BeginPage(Rect mediabox)#
Start a new output page of a given dimension.
- Parameters:
mediabox (Rect) – a rectangle specifying the page size. After this method, output operations may write content to the page.
- EndPage()#
Finish a page. This flushes any pending data and appends the page to the output document.
- Close()#
Close the output file. This method is required for writing any pending data.
For usage examples consult the section of Story.
