Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Masamichi Hosoda
poppler
Commits
5491d16d
Commit
5491d16d
authored
Aug 17, 2009
by
Albert Astals Cid
Browse files
Move poppler core away from using a double as PDF file version
Frontends are yet to come
parent
efd5dd63
Changes
6
Hide whitespace changes
Inline
Side-by-side
glib/poppler-document.cc
View file @
5491d16d
...
...
@@ -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
->
getPDF
Major
Version
()
+
document
->
doc
->
getPDFMinorVersion
()
/
10.0
);
g_value_take_string
(
value
,
str
);
break
;
case
PROP_AUTHOR
:
...
...
poppler/PDFDoc.cc
View file @
5491d16d
...
...
@@ -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
"
,
pdf
MajorVersion
,
pdfMinor
Version
);
XRef
*
uxref
=
new
XRef
();
uxref
->
add
(
0
,
65535
,
0
,
gFalse
);
for
(
int
i
=
0
;
i
<
xref
->
getNumObjects
();
i
++
)
{
...
...
poppler/PDFDoc.h
View file @
5491d16d
...
...
@@ -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
...
...
qt/poppler-document.cc
View file @
5491d16d
/* poppler-document.cc: qt interface to poppler
* Copyright (C) 2005, Net Integration Technologies, Inc.
* Copyright (C) 2005-200
8
, Albert Astals Cid <aacid@kde.org>
* Copyright (C) 2005-200
9
, 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
.
getPDF
MajorVersion
()
+
data
->
doc
.
getPDFMinor
Version
()
/
10.0
;
}
QDomDocument
*
Document
::
toc
()
const
...
...
qt4/src/poppler-document.cc
View file @
5491d16d
/* 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-200
8
, Albert Astals Cid <aacid@kde.org>
* Copyright (C) 2005-200
9
, 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
->
getPDF
MajorVersion
()
+
m_doc
->
doc
->
getPDFMinor
Version
()
/
10.0
;
}
Page
*
Document
::
page
(
const
QString
&
label
)
const
...
...
utils/pdfinfo.cc
View file @
5491d16d
...
...
@@ -14,7 +14,7 @@
// under GPL version 2 or later
//
// Copyright (C) 2006 Dom Lachowicz <cinamod@hotmail.com>
// Copyright (C) 2007-200
8
Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2007-200
9
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
->
getPDF
MajorVersion
(),
doc
->
getPDFMinor
Version
());
// print the metadata
if
(
printMetadata
&&
(
metadata
=
doc
->
readMetadata
()))
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment