| PDFsharp & MigraDoc Forum https://forum.pdfsharp.net/ |
|
| Possible bug in PdfPage's WriteObject() Method https://forum.pdfsharp.net/viewtopic.php?f=2&t=2160 |
Page 1 of 1 |
| Author: | PandaKiwi [ Fri Oct 05, 2012 1:59 am ] |
| Post subject: | Possible bug in PdfPage's WriteObject() Method |
Hi, I have discovered the following code in PdfPage.WriteObject(PdfWriter writer): Code: // HACK: temporarily flip media box if Landscape PdfRectangle mediaBox = MediaBox; // TODO: Take /Rotate into account if (orientation == PageOrientation.Landscape) MediaBox = new PdfRectangle(mediaBox.X1, mediaBox.Y1, mediaBox.Y2, mediaBox.X2); This causes a bug in our application when the input PDF contains: Code: /Type /Page /Rotate 90 /MediaBox [ 0 0 595 842 ] /CropBox [ 0 0 595 842 ] but outputs as: Code: /CropBox [0 0 595 842] /MediaBox [0 0 842 595] /Rotate 90 /Type /Page effectively cropping the page into a 595x595 square. My current fix is to remove "Hack" code, can someone please advice any "unwanted side effects" out of this? Thanks |
|
| Author: | Thomas Hoevel [ Mon Oct 08, 2012 7:39 am ] |
| Post subject: | Re: Possible bug in PdfPage's WriteObject() Method |
PandaKiwi wrote: My current fix is to remove "Hack" code, can someone please advice any "unwanted side effects" out of this? If it works for you, leave it like that.Maybe the MediaBox must also be flipped while reading the file. I can't tell without a deep dive into the source code. |
|
| Page 1 of 1 | All times are UTC |
| Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |
|