r15162 by jghali - #9135 : embedded PDF shows upside down on exported output

scribus-commit scribus-commit at lists.scribus.net
Sat Jun 5 16:00:41 CEST 2010


Revision: 15162
Author: jghali
Date: 2010-06-05T13:51:59.104919Z
Commit message: #9135 : embedded PDF shows upside down on exported output

Changeset: 
M  /trunk/Scribus/scribus/pdflib_core.cpp

Diffs:
Index: scribus/pdflib_core.cpp
===================================================================
--- scribus/pdflib_core.cpp	(revision 15161)
+++ scribus/pdflib_core.cpp	(revision 15162)
@@ -8735,15 +8735,15 @@
 			QTransform pageM;
 			pageM.scale(1.0/pagesize.GetWidth(), 1.0/pagesize.GetHeight());
 			pageM.rotate(-rotation);
-			PutDoc("\n/BBox [" + QString::number(pagesize.GetLeft()));
-			PutDoc(" " + QString::number(pagesize.GetBottom()));
-			PutDoc(" " + QString::number(pagesize.GetLeft() + pagesize.GetWidth()));
-			PutDoc(" " + QString::number(pagesize.GetBottom() + pagesize.GetHeight()));
+			PutDoc("\n/BBox [" + QString::number(pagesize.GetLeft(), 'f'));
+			PutDoc(" " + QString::number(pagesize.GetBottom(), 'f'));
+			PutDoc(" " + QString::number(pagesize.GetLeft() + pagesize.GetWidth(), 'f'));
+			PutDoc(" " + QString::number(pagesize.GetBottom() + pagesize.GetHeight(), 'f'));
 			PutDoc("]");
-			PutDoc("\n/Matrix [" + QString::number(pageM.m11()) + " "
-								 + QString::number(pageM.m12()) + " "
-								 + QString::number(pageM.m21()) + " "
-								 + QString::number(pageM.m22()) + " ");
+			PutDoc("\n/Matrix [" + QString::number(pageM.m11(), 'f') + " "
+								 + QString::number(pageM.m12(), 'f') + " "
+								 + QString::number(pageM.m21(), 'f') + " "
+								 + QString::number(pageM.m22(), 'f') + " ");
 			if (rotation == 0)
 				PutDoc("0 0");
 			else if (rotation == 90)
@@ -8751,7 +8751,7 @@
 			else if (rotation == 180)
 				PutDoc("1 1");
 			else if (rotation == 270)
-				PutDoc(QString::number(pagesize.GetHeight() / pagesize.GetWidth()) + " " + QString::number(1.0 - 1.0 / (pagesize.GetHeight() / pagesize.GetWidth())));
+				PutDoc(QString::number(pagesize.GetHeight() / pagesize.GetWidth(), 'f') + " " + QString::number(1.0 - 1.0 / (pagesize.GetHeight() / pagesize.GetWidth()), 'f'));
 			else
 				PutDoc("0 0");
 			PutDoc("]");
@@ -8855,12 +8855,30 @@
 			StartObj(xObj);
 			PutDoc("<<\n/Type /XObject\n/Subtype /Form\n/FormType 1");
 			PoDoFo::PdfRect pagesize = page->GetPageSize();
-			PutDoc("\n/BBox [" + QString::number(pagesize.GetLeft()));
-			PutDoc(" " + QString::number(pagesize.GetBottom()));
-			PutDoc(" " + QString::number(pagesize.GetLeft() + pagesize.GetWidth()));
-			PutDoc(" " + QString::number(pagesize.GetBottom() + pagesize.GetHeight()));
+			int rotation = page->GetRotation();
+			QMatrix pageM;
+			pageM.scale(1.0/pagesize.GetWidth(), 1.0/pagesize.GetHeight());
+			pageM.rotate(-rotation);
+			PutDoc("\n/BBox [" + QString::number(pagesize.GetLeft(), 'f'));
+			PutDoc(" " + QString::number(pagesize.GetBottom(), 'f'));
+			PutDoc(" " + QString::number(pagesize.GetLeft() + pagesize.GetWidth(), 'f'));
+			PutDoc(" " + QString::number(pagesize.GetBottom() + pagesize.GetHeight(), 'f'));
 			PutDoc("]");
-			PutDoc("\n/Matrix [" + QString::number(1.0/pagesize.GetWidth()) + " 0 0 " + QString::number(1.0/pagesize.GetHeight()) + " 0 0]");
+			PutDoc("\n/Matrix [" + QString::number(pageM.m11(), 'f') + " "
+								 + QString::number(pageM.m12(), 'f') + " "
+								 + QString::number(pageM.m21(), 'f') + " "
+								 + QString::number(pageM.m22(), 'f') + " ");
+			if (rotation == 0)
+				PutDoc("0 0");
+			else if (rotation == 90)
+				PutDoc("0 1");
+			else if (rotation == 180)
+				PutDoc("1 1");
+			else if (rotation == 270)
+				PutDoc(QString::number(pagesize.GetHeight() / pagesize.GetWidth(), 'f') + " " + QString::number(1.0 - 1.0 / (pagesize.GetHeight() / pagesize.GetWidth()), 'f'));
+			else
+				PutDoc("0 0");
+			PutDoc("]");
 			PutDoc("\n/Resources " + QString::number(xResources) + " 0 R");
 			nextObj = page->GetObject()->GetIndirectKey("Group");
 			if (nextObj)




More information about the scribus-commit mailing list