summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/xetexdir/pdfimage.cpp
diff options
context:
space:
mode:
authorJonathan Kew <jfkthame@googlemail.com>2007-11-21 12:32:29 +0000
committerJonathan Kew <jfkthame@googlemail.com>2007-11-21 12:32:29 +0000
commit17aeed8e129118bdb3b7eb0ef3a18241dcda40eb (patch)
treed6faebee2c4a64d8e504650b5cb40d78c0c68b56 /Build/source/texk/web2c/xetexdir/pdfimage.cpp
parent952d69f85d43b087ce9fa79d3fc6f1c076000bc7 (diff)
merged XeTeX 0.997 from SIL repository
git-svn-id: svn://tug.org/texlive/trunk@5537 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/xetexdir/pdfimage.cpp')
-rw-r--r--Build/source/texk/web2c/xetexdir/pdfimage.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/Build/source/texk/web2c/xetexdir/pdfimage.cpp b/Build/source/texk/web2c/xetexdir/pdfimage.cpp
index 21af77c6572..2c60d09c790 100644
--- a/Build/source/texk/web2c/xetexdir/pdfimage.cpp
+++ b/Build/source/texk/web2c/xetexdir/pdfimage.cpp
@@ -82,3 +82,25 @@ pdf_get_rect(char* filename, int page_num, int pdf_box, realrect* box)
return 0;
}
+
+int
+pdf_count_pages(char* filename)
+{
+ int pages = 0;
+ GString* name = new GString(filename);
+ PDFDoc* doc = new PDFDoc(name);
+
+ if (!doc) {
+ delete name;
+ return 0;
+ }
+
+ /* if the doc got created, it now owns name, so we mustn't delete it! */
+
+ if (doc->isOk())
+ pages = doc->getNumPages();
+
+ delete doc;
+
+ return pages;
+}