Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!

Debenu Quick PDF Library - PDF SDK Community Forum Homepage
Forum Home Forum Home > For Users of the Library > I need help - I can help
  New Posts New Posts RSS Feed - Page Orientation
  FAQ FAQ  Forum Search   Register Register  Login Login

Page Orientation

 Post Reply Post Reply
Author
Message
Jimeni View Drop Down
Beginner
Beginner
Avatar

Joined: 09 Apr 10
Status: Offline
Points: 10
Post Options Post Options   Thanks (0) Thanks(0)   Quote Jimeni Quote  Post ReplyReply Direct Link To This Post Topic: Page Orientation
    Posted: 09 Apr 10 at 6:40AM
Hi all,
This is my first post.

I am having an issue when using DrawText and DrawRotatedText with certain PDFs. How does the tool determine the page orientation?
With certain PDFs its drawing the text in the wrong place, it seems to think that a landscape image is portrait and so draws the text that should be along the bottom along the left hand side.

I've checked the PDF and I cant see what is different in it that might be causing this. Out of five images two have placed the text in the incorrect rotation and position.

Anyone have any ideas why this might be? How does it calculate what the bottom of the image is?

I'd post examples but unfortunately I'm working with classified documents.

Thanks in advance,

Jim
Back to Top
Jimeni View Drop Down
Beginner
Beginner
Avatar

Joined: 09 Apr 10
Status: Offline
Points: 10
Post Options Post Options   Thanks (0) Thanks(0)   Quote Jimeni Quote  Post ReplyReply Direct Link To This Post Posted: 09 Apr 10 at 6:42AM
I'm not sure its a code issue as it works fine in most PDFs but my code is below:

$qp->SetMeasurementUnits(1); /* Set as measured in mm */
echo $r = $qp->LoadFromFile($FilePath);

$intPageCount = 1;
for ( $qp->SelectPage($intPageCount); $intPageCount <= $qp->PageCount; $intPageCount ++) { /* Loop through all pages in doc */
    $qp->SelectPage($intPageCount);
   
    $pageheight  = $qp->PageHeight;
    $pagewidth = $qp->PageWidth;
   
    $myheight = (($pageheight/2) - ($pageheight * .05)); /* Define center - 5% of height to accomodate angle */
    $mywidth = ($pagewidth/2);
    $WatermarkSize = ( ($myheight + $mywidth) / strLen($Watermark) ); /* This should calc the correct text size relative to the document and amount of text */
    $EPCNTextSize = ( ($myheight + $mywidth) / 60 );
   
    $qp->SetTextAlign(1);/* Align text center */
   
   
   
   
    $qp->SetTransparency(70);
    $qp->SetTextSize($WatermarkSize);
    echo $r = $qp->DrawRotatedText($mywidth, $myheight, 45, $Watermark); /* Draw Watermark at center */
    $qp->SetTextAlign(2); /* Align text right */
   
    $qp->SetTransparency(0);
    $qp->SetTextSize($EPCNTextSize);
    echo $r = $qp->DrawText($pagewidth -20, 1, "Open EPCN Number: " . $EPCN); /* Draw EPCN at bottom right with 20 padding */

}

$result = $qp->SaveToFile($OutputPath);
if ($result == 1)
{
    header("Location: /Output/MyTest2.pdf");
}
else
{
    echo "File could not be saved to disk.";
    echo "<br /><br />";
}
$qp = null;


Edited by Jimeni - 09 Apr 10 at 6:42AM
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3529
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 09 Apr 10 at 6:59AM
Hi!

You should use SetOrigin to tell the system where you want to begin (top left, bottom right, ...).
A document can be created in portrait-format and later changed to landscape (then it's rotated). Then you begin to draw in this document and all positions are the other way round (you must change your thinking in this case ;-)    If you want to write on a document rotated with 180 degree your top left should be top right and so on ...
Even if you don't understand my "german english" you should understand now where's the problem in this case ;-)
Here's the complete user reference:
http://www.quickpdflibrary.com/help/quickpdf/FunctionGroups.php
Please read my post in the general section (...the first steps...).

Cheers and welcome here,
Ingo

 
Back to Top
Jimeni View Drop Down
Beginner
Beginner
Avatar

Joined: 09 Apr 10
Status: Offline
Points: 10
Post Options Post Options   Thanks (0) Thanks(0)   Quote Jimeni Quote  Post ReplyReply Direct Link To This Post Posted: 09 Apr 10 at 7:13AM
Ingo thanks for your help.

You've pointed me in the right direction. It turns out the pages have been rotated and saved, the program is picking out the original orientation rather than the current view.

I can see how much they have been rotated using the PageRotation function and then find a way to correct the problem.

Once again thanks for your help and your English is great, so no problems there!

Regards

Jim
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.01
Copyright ©2001-2014 Web Wiz Ltd.

Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. AboutContactBlogSupportOnline Store