[poppler] 2 commits - qt4/src

Pino Toscano pino at kemper.freedesktop.org
Sat Feb 9 09:26:50 PST 2008


 qt4/src/poppler-pdf-converter.cc |   25 +++++++++++++++++++++++--
 qt4/src/poppler-qt4.h            |   17 +++++++++++++++++
 2 files changed, 40 insertions(+), 2 deletions(-)

New commits:
commit 5347a97e39388ae38cf2ab9c67f953b0f7a02a13
Author: Pino Toscano <pino at kde.org>
Date:   Sat Feb 9 18:26:41 2008 +0100

    Add the operators for the flags we have.

diff --git a/qt4/src/poppler-qt4.h b/qt4/src/poppler-qt4.h
index 6bb7751..0fea24d 100644
--- a/qt4/src/poppler-qt4.h
+++ b/qt4/src/poppler-qt4.h
@@ -1131,4 +1131,7 @@ height = dummy.height();
 
 }
 
+Q_DECLARE_OPERATORS_FOR_FLAGS(Poppler::Document::RenderHints)
+Q_DECLARE_OPERATORS_FOR_FLAGS(Poppler::PDFConverter::PDFOptions)
+
 #endif
commit 329ade4f936bf063539cdc887aaf9a1722a5b8e0
Author: Pino Toscano <pino at kde.org>
Date:   Sat Feb 9 18:23:59 2008 +0100

    Add options for the PDF export; add the WithChanges flag for saving the changes to the document as well.

diff --git a/qt4/src/poppler-pdf-converter.cc b/qt4/src/poppler-pdf-converter.cc
index a1b94cd..6e1868b 100644
--- a/qt4/src/poppler-pdf-converter.cc
+++ b/qt4/src/poppler-pdf-converter.cc
@@ -28,10 +28,12 @@ class PDFConverterPrivate : public BaseConverterPrivate
 {
 	public:
 		PDFConverterPrivate();
+
+		PDFConverter::PDFOptions opts;
 };
 
 PDFConverterPrivate::PDFConverterPrivate()
-	: BaseConverterPrivate()
+	: BaseConverterPrivate(), opts(0)
 {
 }
 
@@ -47,6 +49,18 @@ PDFConverter::~PDFConverter()
 {
 }
 
+void PDFConverter::setPDFOptions(PDFConverter::PDFOptions options)
+{
+	Q_D(PDFConverter);
+	d->opts = options;
+}
+
+PDFConverter::PDFOptions PDFConverter::pdfOptions() const
+{
+	Q_D(const PDFConverter);
+	return d->opts;
+}
+
 bool PDFConverter::convert()
 {
 	Q_D(PDFConverter);
@@ -59,7 +73,14 @@ bool PDFConverter::convert()
 		return false;
 
 	QIODeviceOutStream stream(dev);
-	d->document->doc->saveAs(&stream);
+	if (d->opts & WithChanges)
+	{
+		d->document->doc->saveAs(&stream);
+	}
+	else
+	{
+		d->document->doc->saveWithoutChangesAs(&stream);
+	}
 	d->closeDevice();
 
 	return true;
diff --git a/qt4/src/poppler-qt4.h b/qt4/src/poppler-qt4.h
index 42acf9e..6bb7751 100644
--- a/qt4/src/poppler-qt4.h
+++ b/qt4/src/poppler-qt4.h
@@ -1022,10 +1022,24 @@ height = dummy.height();
         friend class Document;
         public:
             /**
+              Options for the PDF export.
+             */
+            enum PDFOption {
+                WithChanges = 0x00000001        ///< The changes done to the document are saved as well
+            };
+            Q_DECLARE_FLAGS( PDFOptions, PDFOption )
+
+            /**
               Destructor.
             */
             virtual ~PDFConverter();
 
+            /**
+              Options for the PDF export.
+             */
+            void setPDFOptions(PDFOptions options);
+            PDFOptions pdfOptions() const;
+
             bool convert();
 
         private:


More information about the poppler mailing list