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

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


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

Changeset: 
M  /branches/Version135/Scribus/scribus/pdflib_core.cpp

Diffs:
Index: scribus/pdflib_core.cpp
===================================================================
--- scribus/pdflib_core.cpp	(revision 15160)
+++ scribus/pdflib_core.cpp	(revision 15161)
@@ -6327,15 +6327,15 @@
 			QMatrix 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)
@@ -6443,12 +6443,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