[poppler] poppler/poppler: PSOutputDev.cc, 1.1.1.1, 1.2 PSOutputDev.h, 1.1.1.1, 1.2

Martin Kretzschmar m_kretzschmar at freedesktop.org
Thu Jul 28 05:21:10 EST 2005


Update of /cvs/poppler/poppler/poppler
In directory gabe:/tmp/cvs-serv6864/poppler

Modified Files:
	PSOutputDev.cc PSOutputDev.h 
Log Message:
* poppler/PSOutputDev.cc (PSOutputDev): change the constructor to
take paper size and duplex setting parameters.
(init): add paper size and duplex parameters.
(writeDocSetup): add duplex parameter.

* poppler/PSOutputDev.h: update declarations.

* glib/poppler-private.h (struct _PopplerPSFile): store necessary
information to eventually construct a PSOutputDev.

* glib/poppler-page.cc (poppler_page_render_to_ps): initialize the
output dev if it doesn't exist yet.

* glib/poppler-document.cc (poppler_ps_file_new): don't create the
PSOutputDev here, just store filename and page range.
(poppler_ps_file_set_paper_size, poppler_ps_file_set_duplex): new
functions.
(poppler_ps_file_free): free the filename which we strdup now.

* glib/poppler-document.h: add prototypes.


Index: PSOutputDev.cc
===================================================================
RCS file: /cvs/poppler/poppler/poppler/PSOutputDev.cc,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- PSOutputDev.cc	3 Mar 2005 19:46:04 -0000	1.1.1.1
+++ PSOutputDev.cc	27 Jul 2005 19:21:08 -0000	1.2
@@ -662,6 +662,7 @@
 
 PSOutputDev::PSOutputDev(char *fileName, XRef *xrefA, Catalog *catalog,
 			 int firstPage, int lastPage, PSOutMode modeA,
+                         int paperWidthA, int paperHeightA, GBool duplexA,
 			 int imgLLXA, int imgLLYA, int imgURXA, int imgURYA,
 			 GBool manualCtrlA) {
   FILE *f;
@@ -713,12 +714,14 @@
 
   init(outputToFile, f, fileTypeA,
        xrefA, catalog, firstPage, lastPage, modeA,
-       imgLLXA, imgLLYA, imgURXA, imgURYA, manualCtrlA);
+       imgLLXA, imgLLYA, imgURXA, imgURYA, manualCtrlA,
+       paperWidthA, paperHeightA, duplexA);
 }
 
 PSOutputDev::PSOutputDev(PSOutputFunc outputFuncA, void *outputStreamA,
 			 XRef *xrefA, Catalog *catalog,
 			 int firstPage, int lastPage, PSOutMode modeA,
+                         int paperWidthA, int paperHeightA, GBool duplexA,
 			 int imgLLXA, int imgLLYA, int imgURXA, int imgURYA,
 			 GBool manualCtrlA) {
   underlayCbk = NULL;
@@ -738,14 +741,16 @@
 
   init(outputFuncA, outputStreamA, psGeneric,
        xrefA, catalog, firstPage, lastPage, modeA,
-       imgLLXA, imgLLYA, imgURXA, imgURYA, manualCtrlA);
+       imgLLXA, imgLLYA, imgURXA, imgURYA, manualCtrlA,
+       paperWidthA, paperHeightA, duplexA);
 }
 
 void PSOutputDev::init(PSOutputFunc outputFuncA, void *outputStreamA,
 		       PSFileType fileTypeA, XRef *xrefA, Catalog *catalog,
 		       int firstPage, int lastPage, PSOutMode modeA,
 		       int imgLLXA, int imgLLYA, int imgURXA, int imgURYA,
-		       GBool manualCtrlA) {
+		       GBool manualCtrlA, int paperWidthA, int paperHeightA,
+                       GBool duplexA) {
   Page *page;
   PDFRectangle *box;
 
@@ -757,8 +762,8 @@
   xref = xrefA;
   level = globalParams->getPSLevel();
   mode = modeA;
-  paperWidth = globalParams->getPSPaperWidth();
-  paperHeight = globalParams->getPSPaperHeight();
+  paperWidth = paperWidthA;
+  paperHeight = paperHeightA;
   imgLLX = imgLLXA;
   imgLLY = imgLLYA;
   imgURX = imgURXA;
@@ -838,7 +843,7 @@
       writePS("%%EndProlog\n");
       writePS("%%BeginSetup\n");
     }
-    writeDocSetup(catalog, firstPage, lastPage);
+    writeDocSetup(catalog, firstPage, lastPage, duplexA);
     if (mode != psModeForm) {
       writePS("%%EndSetup\n");
     }
@@ -1003,7 +1008,8 @@
 }
 
 void PSOutputDev::writeDocSetup(Catalog *catalog,
-				int firstPage, int lastPage) {
+				int firstPage, int lastPage,
+                                GBool duplexA) {
   Page *page;
   Dict *resDict;
   Annots *annots;
@@ -1038,8 +1044,7 @@
   if (mode != psModeForm) {
     if (mode != psModeEPS && !manualCtrl) {
       writePSFmt("%d %d %s pdfSetup\n",
-		 paperWidth, paperHeight,
-		 globalParams->getPSDuplex() ? "true" : "false");
+		 paperWidth, paperHeight, duplexA ? "true" : "false");
     }
 #if OPI_SUPPORT
     if (globalParams->getPSOPI()) {

Index: PSOutputDev.h
===================================================================
RCS file: /cvs/poppler/poppler/poppler/PSOutputDev.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- PSOutputDev.h	3 Mar 2005 19:46:01 -0000	1.1.1.1
+++ PSOutputDev.h	27 Jul 2005 19:21:08 -0000	1.2
@@ -52,6 +52,8 @@
   // Open a PostScript output file, and write the prolog.
   PSOutputDev(char *fileName, XRef *xrefA, Catalog *catalog,
 	      int firstPage, int lastPage, PSOutMode modeA,
+              int paperWidthA = -1, int paperHeightA = -1,
+              GBool duplexA = gTrue,
 	      int imgLLXA = 0, int imgLLYA = 0,
 	      int imgURXA = 0, int imgURYA = 0,
 	      GBool manualCtrlA = gFalse);
@@ -60,6 +62,8 @@
   PSOutputDev(PSOutputFunc outputFuncA, void *outputStreamA,
 	      XRef *xrefA, Catalog *catalog,
 	      int firstPage, int lastPage, PSOutMode modeA,
+              int paperWidthA = -1, int paperHeightA = -1,
+              GBool duplexA = gTrue,
 	      int imgLLXA = 0, int imgLLYA = 0,
 	      int imgURXA = 0, int imgURYA = 0,
 	      GBool manualCtrlA = gFalse);
@@ -93,7 +97,7 @@
   void writeXpdfProcset();
 
   // Write the document-level setup.
-  void writeDocSetup(Catalog *catalog, int firstPage, int lastPage);
+  void writeDocSetup(Catalog *catalog, int firstPage, int lastPage, GBool duplexA);
 
   // Write the setup for the current page.
   void writePageSetup();
@@ -196,7 +200,8 @@
 	    PSFileType fileTypeA, XRef *xrefA, Catalog *catalog,
 	    int firstPage, int lastPage, PSOutMode modeA,
 	    int imgLLXA, int imgLLYA, int imgURXA, int imgURYA,
-	    GBool manualCtrlA);
+	    GBool manualCtrlA, int paperWidthA, int paperHeightA,
+            GBool duplexA);
   void setupResources(Dict *resDict);
   void setupFonts(Dict *resDict);
   void setupFont(GfxFont *font, Dict *parentResDict);



More information about the poppler mailing list