diff options
-rw-r--r-- | glib/poppler-document.cc | 2 | ||||
-rw-r--r-- | poppler/PDFDoc.cc | 7 | ||||
-rw-r--r-- | poppler/PDFDoc.h | 8 | ||||
-rw-r--r-- | qt/poppler-document.cc | 4 | ||||
-rw-r--r-- | qt4/src/poppler-document.cc | 4 | ||||
-rw-r--r-- | utils/pdfinfo.cc | 4 |
6 files changed, 16 insertions, 13 deletions
diff --git a/glib/poppler-document.cc b/glib/poppler-document.cc index dfdfb803..6b46fc03 100644 --- a/glib/poppler-document.cc +++ b/glib/poppler-document.cc @@ -646,7 +646,7 @@ poppler_document_get_property (GObject *object, case PROP_FORMAT: str = g_strndup("PDF-", 15); /* allocates 16 chars, pads with \0s */ g_ascii_formatd (str + 4, 15 + 1 - 4, - "%.2g", document->doc->getPDFVersion ()); + "%.2g", document->doc->getPDFMajorVersion () + document->doc->getPDFMinorVersion() / 10.0); g_value_take_string (value, str); break; case PROP_AUTHOR: diff --git a/poppler/PDFDoc.cc b/poppler/PDFDoc.cc index 463488fa..435ad100 100644 --- a/poppler/PDFDoc.cc +++ b/poppler/PDFDoc.cc @@ -304,7 +304,8 @@ void PDFDoc::checkHeader() { char *p; int i; - pdfVersion = 0; + pdfMajorVersion = 0; + pdfMinorVersion = 0; for (i = 0; i < headerSearchSize; ++i) { hdrBuf[i] = str->getChar(); } @@ -323,7 +324,7 @@ void PDFDoc::checkHeader() { error(-1, "May not be a PDF file (continuing anyway)"); return; } - pdfVersion = gatof(p); + sscanf(p, "%d.%d", &pdfMajorVersion, &pdfMinorVersion); // We don't do the version check. Don't add it back in. } @@ -578,7 +579,7 @@ void PDFDoc::saveIncrementalUpdate (OutStream* outStr) void PDFDoc::saveCompleteRewrite (OutStream* outStr) { - outStr->printf("%%PDF-%.1f\r\n",pdfVersion); + outStr->printf("%%PDF-%d.%d\r\n",pdfMajorVersion,pdfMinorVersion); XRef *uxref = new XRef(); uxref->add(0, 65535, 0, gFalse); for(int i=0; i<xref->getNumObjects(); i++) { diff --git a/poppler/PDFDoc.h b/poppler/PDFDoc.h index 94229b79..75273160 100644 --- a/poppler/PDFDoc.h +++ b/poppler/PDFDoc.h @@ -14,7 +14,7 @@ // under GPL version 2 or later // // Copyright (C) 2005, 2006, 2008 Brad Hards <bradh@frogmouth.net> -// Copyright (C) 2005 Albert Astals Cid <aacid@kde.org> +// Copyright (C) 2005, 2009 Albert Astals Cid <aacid@kde.org> // Copyright (C) 2008 Julien Rebetez <julienr@svn.gnome.org> // Copyright (C) 2008 Pino Toscano <pino@kde.org> // Copyright (C) 2008 Carlos Garcia Campos <carlosgc@gnome.org> @@ -199,7 +199,8 @@ public: Object *getDocInfoNF(Object *obj) { return xref->getDocInfoNF(obj); } // Return the PDF version specified by the file. - double getPDFVersion() { return pdfVersion; } + int getPDFMajorVersion() { return pdfMajorVersion; } + int getPDFMinorVersion() { return pdfMinorVersion; } // Save this file with another name. int saveAs(GooString *name, PDFWriteMode mode=writeStandard); @@ -234,7 +235,8 @@ private: FILE *file; BaseStream *str; void *guiData; - double pdfVersion; + int pdfMajorVersion; + int pdfMinorVersion; XRef *xref; Catalog *catalog; #ifndef DISABLE_OUTLINE diff --git a/qt/poppler-document.cc b/qt/poppler-document.cc index 4c47e625..fe746760 100644 --- a/qt/poppler-document.cc +++ b/qt/poppler-document.cc @@ -1,6 +1,6 @@ /* poppler-document.cc: qt interface to poppler * Copyright (C) 2005, Net Integration Technologies, Inc. - * Copyright (C) 2005-2008, Albert Astals Cid <aacid@kde.org> + * Copyright (C) 2005-2009, Albert Astals Cid <aacid@kde.org> * Copyright (C) 2006, Stefan Kebekus <stefan.kebekus@math.uni-koeln.de> * Copyright (C) 2006, Wilfried Huss <Wilfried.Huss@gmx.at> * @@ -270,7 +270,7 @@ bool Document::okToAddNotes() const double Document::getPDFVersion() const { - return data->doc.getPDFVersion(); + return data->doc.getPDFMajorVersion () + data->doc.getPDFMinorVersion() / 10.0; } QDomDocument *Document::toc() const diff --git a/qt4/src/poppler-document.cc b/qt4/src/poppler-document.cc index 4eb1abaf..3e4b086c 100644 --- a/qt4/src/poppler-document.cc +++ b/qt4/src/poppler-document.cc @@ -1,7 +1,7 @@ /* poppler-document.cc: qt interface to poppler * Copyright (C) 2005, Net Integration Technologies, Inc. * Copyright (C) 2005, 2008, Brad Hards <bradh@frogmouth.net> - * Copyright (C) 2005-2008, Albert Astals Cid <aacid@kde.org> + * Copyright (C) 2005-2009, Albert Astals Cid <aacid@kde.org> * Copyright (C) 2006-2009, Pino Toscano <pino@kde.org> * * This program is free software; you can redistribute it and/or modify @@ -379,7 +379,7 @@ namespace Poppler { double Document::pdfVersion() const { - return m_doc->doc->getPDFVersion(); + return m_doc->doc->getPDFMajorVersion () + m_doc->doc->getPDFMinorVersion() / 10.0; } Page *Document::page(const QString &label) const diff --git a/utils/pdfinfo.cc b/utils/pdfinfo.cc index 9063f87d..bfbe0b3d 100644 --- a/utils/pdfinfo.cc +++ b/utils/pdfinfo.cc @@ -14,7 +14,7 @@ // under GPL version 2 or later // // Copyright (C) 2006 Dom Lachowicz <cinamod@hotmail.com> -// Copyright (C) 2007-2008 Albert Astals Cid <aacid@kde.org> +// Copyright (C) 2007-2009 Albert Astals Cid <aacid@kde.org> // // To see a description of the changes please see the Changelog file that // came with your tarball or type make ChangeLog if you are building from git @@ -303,7 +303,7 @@ int main(int argc, char *argv[]) { printf("Optimized: %s\n", doc->isLinearized() ? "yes" : "no"); // print PDF version - printf("PDF version: %.1f\n", doc->getPDFVersion()); + printf("PDF version: %d.%d\n", doc->getPDFMajorVersion(), doc->getPDFMinorVersion()); // print the metadata if (printMetadata && (metadata = doc->readMetadata())) { |