[poppler] poppler/qt4/src: poppler-document.cc, 1.24, 1.25 poppler-qt4.h, 1.37, 1.38

Albert Astals Cid aacid at kemper.freedesktop.org
Sat Nov 18 09:08:07 PST 2006


Update of /cvs/poppler/poppler/qt4/src
In directory kemper:/tmp/cvs-serv20816/qt4/src

Modified Files:
	poppler-document.cc poppler-qt4.h 
Log Message:
        * qt4/src/poppler-document.cc
        * qt4/src/poppler-qt4.h: Add int marginRight, int marginBottom, int
        marginLeft, int marginTop, bool strictMargins to Document::print()



Index: poppler-document.cc
===================================================================
RCS file: /cvs/poppler/poppler/qt4/src/poppler-document.cc,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- poppler-document.cc	15 Nov 2006 21:07:50 -0000	1.24
+++ poppler-document.cc	18 Nov 2006 17:08:05 -0000	1.25
@@ -386,9 +386,16 @@
         return ld;
     }
     
-    bool Document::print(const QString &file, const QList<int> pageList, double hDPI, double vDPI, int rotate, int paperWidth, int paperHeight)
+    bool Document::print(const QString &file, const QList<int> pageList, double hDPI, double vDPI, int rotate, int paperWidth, int paperHeight, int marginRight, int marginBottom, int marginLeft, int marginTop, bool strictMargins)
     {
-        PSOutputDev *psOut = new PSOutputDev(file.toLatin1().data(), m_doc->doc.getXRef(), m_doc->doc.getCatalog(), 1, m_doc->doc.getNumPages(), psModePS, paperWidth, paperHeight, gFalse);
+        PSOutputDev *psOut = new PSOutputDev(file.toLatin1().data(), m_doc->doc.getXRef(), m_doc->doc.getCatalog(), 1, m_doc->doc.getNumPages(), psModePS, paperWidth, paperHeight, gFalse, marginRight, marginBottom, paperWidth - marginLeft, paperHeight - marginTop);
+
+        if (strictMargins)
+        {
+            double xScale = ((double)paperWidth - (double)marginLeft - (double)marginRight) / (double)paperWidth;
+            double yScale = ((double)paperHeight - (double)marginBottom - (double)marginTop) / (double)paperHeight;
+            psOut->setScale(xScale, yScale);
+        }
 
         if (psOut->isOk())
         {

Index: poppler-qt4.h
===================================================================
RCS file: /cvs/poppler/poppler/qt4/src/poppler-qt4.h,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -d -r1.37 -r1.38
--- poppler-qt4.h	16 Nov 2006 21:03:27 -0000	1.37
+++ poppler-qt4.h	18 Nov 2006 17:08:05 -0000	1.38
@@ -667,6 +667,10 @@
 	
 	/**
 	  Prints the document to the PostScript file \p fileName
+	  Sizes have to be in Points (1/72 inch)
+	  \param strictMargins defines if margins have to be scrictly
+	                       followed (even if that means changing aspect ratio) or
+	                       if the margins can be adapted to keep aspect ratio
 
 	  If you are using QPrinter you can get paper size by doing:
 	  \code
@@ -677,7 +681,7 @@
 height = dummy.height();
 	  \endcode
 	*/
-	bool print(const QString &fileName, const QList<int> pageList, double hDPI, double vDPI, int rotate, int paperWidth, int paperHeight);
+	bool print(const QString &fileName, const QList<int> pageList, double hDPI, double vDPI, int rotate, int paperWidth, int paperHeight, int marginRight, int marginBottom, int marginLeft, int marginTop, bool strictMargins);
 	
 	/**
 	  Sets the paper color



More information about the poppler mailing list