summaryrefslogtreecommitdiff
path: root/source/pdf/pdf-xref-aux.c
blob: aac323def9f008214724b79f11aec3711580a8eb (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
#include "mupdf/pdf.h"

/*
	These functions have been split out of pdf_xref.c to allow tools
	to be linked without pulling in the interpreter. The interpreter
	references the built-in font and cmap resources which are quite
	big. Not linking those into the tools saves roughly 6MB in the
	resulting executables.
*/

pdf_document *
pdf_open_document_with_stream(fz_context *ctx, fz_stream *file)
{
	pdf_document *doc = pdf_open_document_no_run_with_stream(ctx, file);
	doc->super.run_page_contents = (fz_document_run_page_contents_fn *)pdf_run_page_contents;
	doc->super.run_annot = (fz_document_run_annot_fn *)pdf_run_annot;
	doc->update_appearance = pdf_update_appearance;
	return doc;
}

pdf_document *
pdf_open_document(fz_context *ctx, const char *filename)
{
	pdf_document *doc = pdf_open_document_no_run(ctx, filename);
	doc->super.run_page_contents = (fz_document_run_page_contents_fn *)pdf_run_page_contents;
	doc->super.run_annot = (fz_document_run_annot_fn *)pdf_run_annot;
	doc->update_appearance = pdf_update_appearance;
	return doc;
}

fz_document_handler pdf_document_handler =
{
	(fz_document_recognize_fn *)&pdf_recognize,
	(fz_document_open_fn *)&pdf_open_document,
	(fz_document_open_with_stream_fn *)&pdf_open_document_with_stream
};