PDFsharp & MigraDoc Foundation http://forum.pdfsharp.de/ |
|
Porblem with scanned page (Size / Orientation / Rotation) http://forum.pdfsharp.de/viewtopic.php?f=2&t=2155 |
Page 1 of 1 |
Author: | ToniM [ Tue Oct 02, 2012 1:34 pm ] |
Post subject: | Porblem with scanned page (Size / Orientation / Rotation) |
hi guys, i have a question to scanned PDF. I hope somebody here can help me find a way to solve this problem. i imported a scanned PDF (1 image, no other content): page.Size: Undefined page.Orientation: Landscape page.Width: {595pt} page.Width.Centimeter: 20.990 page.Height: {837pt} page.Height.Centimeter: 295.275 page.Rotate: 90 (before Orientation has been set, the Width and Height are swapped! see below!) Its orientation is Landscape, but it is Portrait in every viewer. So far no problem, but if i modify it (add watermark) and save, its cutted to a square of 210x210mm (and the water mark on the bottom right isnt visible of course!) I debugged it and i see that the Width and Height depends on the Orientation, but why? Any ideas what im doing wrong? Or is it a bug? Its strange that there is a rotation since its not landscape. but i think thats the way this old scanner worked in the 90's. Any idea how to convert this type of PDF to "standard"? Thanks in advance and BR ToniM edit_001: the images are of type CCITTFaxDecode but unfortunatelly it seems there is no support from PdfSharp up to now ... (http://forum.pdfsharp.net/viewtopic.php?f=4&t=82) |
Author: | ToniM [ Wed Oct 03, 2012 8:23 am ] |
Post subject: | Re: Porblem with scanned page (Size / Orientation / Rotation |
It has nothing to do with the CCITTFaxDecode ![]() i searched in the PDF file and there is following content (extract): /CropBox [ 0 0 837 595 ] /MediaBox [ 0 0 837 595 ] /Rotate 90 and as i found out while debugging: the page is per default Portrait, it ignores the width and height of the sheet, but in my opinion it should be Landscape. (btw: Is there a PDF standard which says something about the orientation? or is it just used in PdfSharp?) in my understanding it should be like this: Width > Height = Landscape others: Portrait Please correct me if im wrong. BR Martin |
Author: | Thomas Hoevel [ Thu Oct 04, 2012 10:04 am ] |
Post subject: | Re: Porblem with scanned page (Size / Orientation / Rotation |
Hi! ToniM wrote: in my understanding it should be like this: Sounds plausible.Width > Height = Landscape others: Portrait But with Width > Height and Rotation = 90° you would have Protrait again, wouldn't you? I do not know what the PDF Reference says about this. But I know from experience that not all PDF creators fully adhere to the PDF Reference. And yes, there could be bug in PDFsharp with respect to Size, Rotation, Orientation. |
Author: | ToniM [ Thu Oct 04, 2012 11:41 am ] |
Post subject: | Re: Porblem with scanned page (Size / Orientation / Rotation |
Thomas Hoevel wrote: But with Width > Height and Rotation = 90° you would have Protrait again, wouldn't you? yes and there i think is the problem, because with this constellation its Landscape instead of Portrait! Initially the PdfPage.Orientation is by default Portrait. Then the logic of the internal ctor makes it to Landscape despite Width > Height. So i see the problem while reading the MediaBox. Here should we also set the initial Orientation and (as i think) we are done! Or implement the logic to the internal ctor ... what do you think? |
Author: | ToniM [ Fri Nov 30, 2012 11:50 am ] |
Post subject: | Re: Porblem with scanned page (Size / Orientation / Rotation |
Are there any news for me? Or maybe a good idea to start? BR ToniM |
Page 1 of 1 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |