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!
![]() |
Page Orientation |
Post Reply ![]() |
Author | |
Jimeni ![]() Beginner ![]() ![]() Joined: 09 Apr 10 Status: Offline Points: 10 |
![]() ![]() ![]() ![]() ![]() 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 |
|
![]() |
|
Jimeni ![]() Beginner ![]() ![]() Joined: 09 Apr 10 Status: Offline Points: 10 |
![]() ![]() ![]() ![]() ![]() |
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 |
|
![]() |
|
Ingo ![]() Moderator Group ![]() ![]() Joined: 29 Oct 05 Status: Offline Points: 3529 |
![]() ![]() ![]() ![]() ![]() |
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 |
|
![]() |
|
Jimeni ![]() Beginner ![]() ![]() Joined: 09 Apr 10 Status: Offline Points: 10 |
![]() ![]() ![]() ![]() ![]() |
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 |
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |
Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. About — Contact — Blog — Support — Online Store