aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/QPDF.cc
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2012-06-22 05:06:48 +0200
committerJay Berkenbilt <ejb@ql.org>2012-06-22 05:09:05 +0200
commita0768e419064b66ea6eb3e06a4398806b24311e8 (patch)
tree6ecfa1f080bdab2ee4573d14dd71c06507b84bdd /libqpdf/QPDF.cc
parent9eb8c9159b97b500e0ecb36271b663cafc89d932 (diff)
downloadqpdf-a0768e419064b66ea6eb3e06a4398806b24311e8.tar.zst
Add QPDF::emptyPDF() and pdf_from_scratch test code
Diffstat (limited to 'libqpdf/QPDF.cc')
-rw-r--r--libqpdf/QPDF.cc24
1 files changed, 24 insertions, 0 deletions
diff --git a/libqpdf/QPDF.cc b/libqpdf/QPDF.cc
index e97da295..b0a8741c 100644
--- a/libqpdf/QPDF.cc
+++ b/libqpdf/QPDF.cc
@@ -17,6 +17,24 @@
std::string QPDF::qpdf_version = "2.3.1";
+static char const* EMPTY_PDF =
+ "%PDF-1.3\n"
+ "1 0 obj\n"
+ "<< /Type /Catalog /Pages 2 0 R >>\n"
+ "endobj\n"
+ "2 0 obj\n"
+ "<< /Type /Pages /Kids [] /Count 0 >>\n"
+ "endobj\n"
+ "xref\n"
+ "0 3\n"
+ "0000000000 65535 f \n"
+ "0000000009 00000 n \n"
+ "0000000058 00000 n \n"
+ "trailer << /Size 3 /Root 1 0 R >>\n"
+ "startxref\n"
+ "110\n"
+ "%%EOF\n";
+
void
QPDF::InputSource::setLastOffset(qpdf_offset_t offset)
{
@@ -350,6 +368,12 @@ QPDF::processMemoryFile(char const* description,
}
void
+QPDF::emptyPDF()
+{
+ processMemoryFile("empty file", EMPTY_PDF, strlen(EMPTY_PDF));
+}
+
+void
QPDF::setIgnoreXRefStreams(bool val)
{
this->ignore_xref_streams = val;