summaryrefslogtreecommitdiff
path: root/src/pdf_doc.h
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2017-12-21 23:49:13 +0000
committerVincent Sanders <vince@kyllikki.org>2017-12-21 23:49:13 +0000
commit897a8900bf77db2d804b0f78bc4b41371e05347f (patch)
tree31dfd1c54ceaef746bfb867a4657b7cdcc3d5c61 /src/pdf_doc.h
parentb22daf7d9b39210a0c7f8b5522a884a828b656b0 (diff)
downloadlibnspdf-897a8900bf77db2d804b0f78bc4b41371e05347f.tar.gz
libnspdf-897a8900bf77db2d804b0f78bc4b41371e05347f.tar.bz2
split code up a bit
Diffstat (limited to 'src/pdf_doc.h')
-rw-r--r--src/pdf_doc.h42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/pdf_doc.h b/src/pdf_doc.h
new file mode 100644
index 0000000..696c121
--- /dev/null
+++ b/src/pdf_doc.h
@@ -0,0 +1,42 @@
+/** indirect object */
+struct xref_table_entry {
+ /* reference identifier */
+ struct cos_reference ref;
+
+ /** offset of object */
+ uint64_t offset;
+
+ /* indirect object if already decoded */
+ struct cos_object *o;
+};
+
+
+/** pdf document */
+struct pdf_doc {
+ uint8_t *buffer;
+ uint64_t buffer_length;
+
+ uint8_t *start; /* start of pdf document in input stream */
+ uint64_t length;
+
+ int major;
+ int minor;
+
+ /**
+ * Indirect object cross reference table
+ */
+ uint64_t xref_size;
+ struct xref_table_entry *xref_table;
+
+ struct cos_object *root;
+ struct cos_object *encrypt;
+ struct cos_object *info;
+ struct cos_object *id;
+
+};
+
+/* byte data acessory, allows for more complex buffer handling in future */
+#define DOC_BYTE(doc, offset) (doc->start[(offset)])
+
+int doc_skip_ws(struct pdf_doc *doc, uint64_t *offset);
+int doc_skip_eol(struct pdf_doc *doc, uint64_t *offset);