Commit a0adb006 authored by Pino Toscano's avatar Pino Toscano Committed by Albert Astals Cid
Browse files

Added a saveAs() overload which takes a plain OutStream

parent fcdd5c51
......@@ -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;
}
......
......@@ -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; }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment