Print Page | Close Window

Original PDF’s coordinate system

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=2977
Printed Date: 17 Jul 25 at 4:08PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Original PDF’s coordinate system
Posted By: Marat.Chariev
Subject: Original PDF’s coordinate system
Date Posted: 27 Sep 14 at 4:23PM
Hi,
Is there a way to determine an Original PDF file coordinate system? I mean the Origin (Bottom-Left, Top-Left, Top-Right, Bottom-Right) which were used when PDF file was created
I tried to use function GetOrigin(), but it always returned 0. My guess - it just returns default Origin of newly created DPL object.
The reason why I need it to know – I try to create a function/procedure that handles a PDF that is rotated : downside-up or left/right turned 90 degrees, and rotate it back to a PDF which is upside-up, and save it to disc Any help is appreciated.
   




Replies:
Posted By: mLipok
Date Posted: 28 Sep 14 at 12:18AM
If I understand you well you just want to rotate them back ?
Reference Guide say:
"
The rotation is
absolute, for example calling the function twice with a parameter of 90 will result in a page rotated
by 90 degrees, not 180 degrees.
"

So if I understand you well, the only one thing what you need to do is rotate all page using:

RotatePage(0)




-------------
Here you can find description how to test my examples:
http://www.quickpdf.org/forum/forum_posts.asp?TID=2932&PID=12600&title=drawcapturedpagematrix-matrix-howto#12600


Posted By: Marat.Chariev
Date Posted: 28 Sep 14 at 12:53AM

Thank you for your input mLipok

Yes, you understand me right. I am dealing with scanned to PDF files documents (one page PDF file with one non searchable image in it). Some of them scanned downside-up or left/right turned 90 degrees, some of them scanned upside-up. But all of them

have  /Rotate 270 (PageRotation() function returns 270 for all scanned files) I need to determine if PDF file needs to be rotated or not, and since PageRotation() function returns 270 for all scanned files I cannot based my decision on that.

Is there anybody who has an experience with this kind of task?



Posted By: AndrewC
Date Posted: 01 Oct 14 at 1:55PM
Marat,

To reset the rotation back to 0 degrees you can use NormalizePage(0); and this is required for many PDF's if you wish to add any type of text to the PDF.

To automatically determine if a scanned image needs to be rotated then you will need to use some type of Document Imaging library.  The image will usually be converted to TIFF and then the pixels will be analysed.  There are certain parameters and formulas used to give a best guess estimate of the true orientation and these routines usually work reasonably well.

You may want to check your scanner driver to see if there is an option to do this while scanning.

Most OCR solutions require this functionality so these libraries will usually have some type of function to do this work.

Andrew.


Posted By: Marat.Chariev
Date Posted: 01 Oct 14 at 3:02PM
Assuming that page should have Portrait layout I decided to use Width and Height of the page to determine if page needs to be rotated.


Posted By: Ekta
Date Posted: 12 Nov 15 at 8:04AM
Thanks Andrew. I needed to change the rotation of coordinate system of my pdf. It worked well.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk