PDF.DocumentPDF documents.
val create : unit -> tval open_document : string -> tOpen a PDF document.
Open a PDF document by reading its cross reference table, so MuPDF can locate PDF objects inside the file. Upon an broken cross reference table or other parse errors MuPDF will restart parsing the file from the beginning to try to rebuild a (hopefully correct) cross reference table to allow further processing of the file.
The returned pdf_document should be used when calling most other PDF functions. Note that it wraps the context, so those functions implicitly get access to the global state in context.
val close : t -> unitClose document.
val save : t -> string -> unitWrite out the document to a file with all changes finalised.
val count_pages : t -> intCount number of pages.
val delete_page : t -> int -> unitDelete a page from the page tree of a document. This does not remove the page contents or resources from the file.
val delete_page_range : t -> int -> int -> unitDelete a range of pages from the page tree of a document. This does not remove the page contents or resources from the file.
Graft a page (and its resources) from the src document to the destination document of the graft. This involves a deep copy of the objects in question.
val minimize : t -> unitMinimize the memory used by a document.
We walk the in memory xref tables, evicting the PDF objects therein that aren't in use.
This reduces the current memory use, but any subsequent use of these objects will load them back into memory again.