#ifndef MUPDF_PDF_PAGE_H1#define MUPDF_PDF_PAGE_H23int pdf_lookup_page_number(fz_context *ctx, pdf_document *doc, pdf_obj *pageobj);4int pdf_count_pages(fz_context *ctx, pdf_document *doc);5pdf_obj *pdf_lookup_page_obj(fz_context *ctx, pdf_document *doc, int needle);67/*8pdf_load_page: Load a page and its resources.910Locates the page in the PDF document and loads the page and its11resources. After pdf_load_page is it possible to retrieve the size12of the page using pdf_bound_page, or to render the page using13pdf_run_page_*.1415number: page number, where 0 is the first page of the document.16*/17pdf_page *pdf_load_page(fz_context *ctx, pdf_document *doc, int number);1819void pdf_drop_page(fz_context *ctx, pdf_page *page);2021fz_link *pdf_load_links(fz_context *ctx, pdf_page *page);2223/*24pdf_bound_page: Determine the size of a page.2526Determine the page size in user space units, taking page rotation27into account. The page size is taken to be the crop box if it28exists (visible area after cropping), otherwise the media box will29be used (possibly including printing marks).3031Does not throw exceptions.32*/33fz_rect *pdf_bound_page(fz_context *ctx, pdf_page *page, fz_rect *);3435/*36pdf_run_page: Interpret a loaded page and render it on a device.3738page: A page loaded by pdf_load_page.3940dev: Device used for rendering, obtained from fz_new_*_device.4142ctm: A transformation matrix applied to the objects on the page,43e.g. to scale or rotate the page contents as desired.44*/45void pdf_run_page(fz_context *ctx, pdf_page *page, fz_device *dev, const fz_matrix *ctm, fz_cookie *cookie);4647/*48pdf_run_page: Interpret a loaded page and render it on a device.4950page: A page loaded by pdf_load_page.5152dev: Device used for rendering, obtained from fz_new_*_device.5354ctm: A transformation matrix applied to the objects on the page,55e.g. to scale or rotate the page contents as desired.5657cookie: A pointer to an optional fz_cookie structure that can be used58to track progress, collect errors etc.59*/60void pdf_run_page_with_usage(fz_context *ctx, pdf_document *doc, pdf_page *page, fz_device *dev, const fz_matrix *ctm, char *event, fz_cookie *cookie);6162/*63pdf_run_page_contents: Interpret a loaded page and render it on a device.64Just the main page contents without the annotations6566page: A page loaded by pdf_load_page.6768dev: Device used for rendering, obtained from fz_new_*_device.6970ctm: A transformation matrix applied to the objects on the page,71e.g. to scale or rotate the page contents as desired.72*/73void pdf_run_page_contents(fz_context *ctx, pdf_page *page, fz_device *dev, const fz_matrix *ctm, fz_cookie *cookie);7475/*76pdf_page_contents_process_fn: A function used for processing the77cleaned page contents/resources gathered as part of78pdf_clean_page_contents.7980buffer: A buffer holding the page contents.8182res: A pdf_obj holding the page resources.8384arg: An opaque arg specific to the particular function.85*/86typedef void (pdf_page_contents_process_fn)(fz_context *ctx, fz_buffer *buffer, pdf_obj *res, void *arg);8788/*89pdf_clean_page_contents: Clean a loaded pages rendering operations,90with an optional post processing step.9192Firstly, this filters the PDF operators used to avoid (some cases93of) repetition, and leaves the page in a balanced state with an94unchanged top level matrix etc. At the same time, the resources95used by the page contents are collected.9697Next, the resources themselves are cleaned (as appropriate) in the98same way.99100Next, an optional post processing stage is called.101102Finally, the page contents and resources in the documents page tree103are replaced by these processed versions.104105Annotations remain unaffected.106107page: A page loaded by pdf_load_page.108109dev: Device used for rendering, obtained from fz_new_*_device.110111cookie: A pointer to an optional fz_cookie structure that can be used112to track progress, collect errors etc.113*/114void pdf_clean_page_contents(fz_context *ctx, pdf_document *doc, pdf_page *page, fz_cookie *cookie,115pdf_page_contents_process_fn *proc, void *proc_arg);116117/*118Presentation interface.119*/120fz_transition *pdf_page_presentation(fz_context *ctx, pdf_page *page, float *duration);121122/*123* Page tree, pages and related objects124*/125126struct pdf_page_s127{128fz_page super;129pdf_document *doc;130131fz_matrix ctm; /* calculated from mediabox and rotate */132fz_rect mediabox;133int rotate;134int transparency;135pdf_obj *resources;136pdf_obj *contents;137fz_link *links;138pdf_annot *annots;139pdf_annot **annot_tailp;140pdf_annot *changed_annots;141pdf_annot *deleted_annots;142pdf_annot *tmp_annots;143pdf_obj *me;144float duration;145int transition_present;146fz_transition transition;147int incomplete;148};149150enum151{152PDF_PAGE_INCOMPLETE_CONTENTS = 1,153PDF_PAGE_INCOMPLETE_ANNOTS = 2154};155156#endif157158159