[poppler] poppler/PDFDoc.cc poppler/PDFDoc.h
Albert Astals Cid
aacid at kemper.freedesktop.org
Sun Jan 20 10:56:09 PST 2008
poppler/PDFDoc.cc | 9 +++++++--
poppler/PDFDoc.h | 2 ++
2 files changed, 9 insertions(+), 2 deletions(-)
New commits:
commit a0adb006c38ea07f010a01d9c0bb07ca0f48939d
Author: Pino Toscano <pino at kde.org>
Date: Sun Jan 20 19:55:55 2008 +0100
Added a saveAs() overload which takes a plain OutStream
diff --git a/poppler/PDFDoc.cc b/poppler/PDFDoc.cc
index b3336a0..afafd92 100644
--- a/poppler/PDFDoc.cc
+++ b/poppler/PDFDoc.cc
@@ -439,13 +439,20 @@ GBool PDFDoc::isLinearized() {
GBool PDFDoc::saveAs(GooString *name, PDFWriteMode mode) {
FILE *f;
OutStream *outStr;
+ GBool res;
if (!(f = fopen(name->getCString(), "wb"))) {
error(-1, "Couldn't open file '%s'", name->getCString());
return gFalse;
}
outStr = new FileOutStream(f,0);
+ res = saveAs(outStr, mode);
+ delete outStr;
+ fclose(f);
+ return res;
+}
+GBool PDFDoc::saveAs(OutStream *outStr, PDFWriteMode mode) {
if (mode == writeForceRewrite) {
saveCompleteRewrite(outStr);
} else if (mode == writeForceIncremental) {
@@ -472,8 +479,6 @@ GBool PDFDoc::saveAs(GooString *name, PDFWriteMode mode) {
}
}
- delete outStr;
- fclose(f);
return gTrue;
}
diff --git a/poppler/PDFDoc.h b/poppler/PDFDoc.h
index 2336694..d411037 100644
--- a/poppler/PDFDoc.h
+++ b/poppler/PDFDoc.h
@@ -176,6 +176,8 @@ public:
// Save this file with another name.
GBool saveAs(GooString *name, PDFWriteMode mode=writeStandard);
+ // Save this file in the given output stream.
+ GBool saveAs(OutStream *outStr, PDFWriteMode mode=writeStandard);
// Return a pointer to the GUI (XPDFCore or WinPDFCore object).
void *getGUIData() { return guiData; }
More information about the poppler
mailing list