summaryrefslogtreecommitdiff
path: root/xps/muxps.h
blob: c784a01a233aaf05d1c82d12b6e5081da184cd3a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#ifndef MUXPS_H
#define MUXPS_H

#include "fitz.h"

typedef struct xps_document_s xps_document;
typedef struct xps_page_s xps_page;

/*
 * XML document model
 */

typedef struct fz_xml_s fz_xml;

fz_xml *fz_parse_xml(fz_context *doc, unsigned char *buf, int len);
fz_xml *fz_xml_next(fz_xml *item);
fz_xml *fz_xml_down(fz_xml *item);
char *fz_xml_tag(fz_xml *item);
char *fz_xml_att(fz_xml *item, const char *att);
char *fz_xml_text(fz_xml *item);
void fz_free_xml(fz_context *doc, fz_xml *item);
void fz_print_xml(fz_xml *item, int level);
void fz_detach_xml(fz_xml *node);

/*
	xps_open_document: Open a document.

	Open a document for reading so the library is able to locate
	objects and pages inside the file.

	The returned xps_document should be used when calling most
	other functions. Note that it wraps the context, so those
	functions implicitly get access to the global state in
	context.

	filename: a path to a file as it would be given to open(2).
*/
xps_document *xps_open_document(fz_context *ctx, char *filename);

/*
	xps_open_document_with_stream: Opens a document.

	Same as xps_open_document, but takes a stream instead of a
	filename to locate the document to open. Increments the
	reference count of the stream. See fz_open_file,
	fz_open_file_w or fz_open_fd for opening a stream, and
	fz_close for closing an open stream.
*/
xps_document *xps_open_document_with_stream(fz_context *ctx, fz_stream *file);

/*
	xps_close_document: Closes and frees an opened document.

	The resource store in the context associated with xps_document
	is emptied.

	Does not throw exceptions.
*/
void xps_close_document(xps_document *doc);

int xps_count_pages(xps_document *doc);
xps_page *xps_load_page(xps_document *doc, int number);
fz_rect xps_bound_page(xps_document *doc, xps_page *page);
void xps_run_page(xps_document *doc, xps_page *page, fz_device *dev, fz_matrix ctm, fz_cookie *cookie);
fz_link *xps_load_links(xps_document *doc, xps_page *page);
void xps_free_page(xps_document *doc, xps_page *page);

fz_outline *xps_load_outline(xps_document *doc);

#endif