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!
![]() |
DrawText |
Post Reply
|
| Author | |
moakley
Beginner
Joined: 23 Oct 12 Status: Offline Points: 9 |
Post Options
Thanks(0)
Quote Reply
Topic: DrawTextPosted: 09 Apr 13 at 9:07PM |
|
Simple task is to draw text, add an annotation, in one of the 4 corners of the page. This annotation will be added to either just the first page or all pages. Please note that I do not control how the PDFs are created. I am using the code at the bottom.
The issue I am having is that some pages contain a single object and if that image is rotated 90 degrees clockwise, then an annotation added to the bottom-left corner will run up the bottom right corner when displayed in a PDF viewer, Adobe or FoxIt. Using the API is there a way to account for the single object pages and recognize page orientation in order to draw the text as required for display in a viewer.
Thanks, Mike...
double XOffset = 0.0;
double YOffset = 0.0; int fontId = 0; for (int i = 1; i <= iNumPages; i++)
{ if (i == 1 || endorseData.AllPages) { qp.SelectPage(i); qp.SetMeasurementUnits(0); qp.SetOrigin(endorseData.Origin); fontId = qp.AddTrueTypeFont(endorseData.FontName, 0);
qp.SelectFont(fontId); qp.SetTextSize(endorseData.FontSize); if (endorseData.Origin == 1)
{ // top-left XOffset = endorseData.XMargin; YOffset = endorseData.YMargin + qp.GetTextHeight(); } else if (endorseData.Origin == 2) { // top-right XOffset = endorseData.XMargin + qp.GetTextWidth(endorseData.Text); YOffset = endorseData.YMargin + qp.GetTextHeight(); } else if (endorseData.Origin == 3) { // bottom-right XOffset = endorseData.XMargin + qp.GetTextWidth(endorseData.Text); YOffset = endorseData.YMargin; } else { // bottom-left is the default XOffset = endorseData.XMargin; YOffset = endorseData.YMargin; } qp.DrawText(XOffset, YOffset, endorseData.Text);
} } qp.SaveToFile(fullFileName);
|
|
![]() |
|
Ingo
Moderator Group
Joined: 29 Oct 05 Status: Offline Points: 3530 |
Post Options
Thanks(0)
Quote Reply
Posted: 09 Apr 13 at 9:16PM |
|
Hi!
You can check if there's rotation on the page and then you have to calculate... These links will give you an idea what to do: http://www.quickpdflibrary.com/faq/image-rotation-can-it-be-an-angle-like-60.php http://www.quickpdflibrary.com/faq/a3-stamping-rotation.php http://www.quickpdflibrary.com/help/quickpdf/PageRotation.php Cheers, Ingo |
|
![]() |
|
moakley
Beginner
Joined: 23 Oct 12 Status: Offline Points: 9 |
Post Options
Thanks(0)
Quote Reply
Posted: 09 Apr 13 at 9:50PM |
|
What is the direction of rotation? Appearance is 90 degrees clockwise, top of the page at 3oclock. When I ran the following command it returned 270.
int pr = qp.PageRotation();
|
|
![]() |
|
AndrewC
Moderator Group
Joined: 08 Dec 10 Location: Geelong, Aust Status: Offline Points: 841 |
Post Options
Thanks(0)
Quote Reply
Posted: 10 Apr 13 at 8:18AM |
|
After QP.SelectPage(i) add a call to QP.NormalizePage(0); This will reset the page rotation to 0 so that you can safely add Annots an DrawText commands.
Andrew.
|
|
![]() |
|
Ingo
Moderator Group
Joined: 29 Oct 05 Status: Offline Points: 3530 |
Post Options
Thanks(0)
Quote Reply
Posted: 10 Apr 13 at 8:44AM |
|
Hi!
"What is the direction of rotation?" Rotation 0 means 12 o'clock... and it goes clockwise (right): Rotation 90 means 3 o'clock, 180 means 6 o'clock and 270 means 9 o'clock. Rotation 360 isn't possible 'cause that's again 0 and 12 o'clock ;-) Regarding your issue rotation 270 means that the page was mirrored. Cheers, Ingo |
|
![]() |
|
moakley
Beginner
Joined: 23 Oct 12 Status: Offline Points: 9 |
Post Options
Thanks(0)
Quote Reply
Posted: 11 Apr 13 at 8:30PM |
|
We receive a lot of PDFs produced by scanners and some by fax machines. It is my understanding that the scanners produce the PDFs based on templates. Typically, one for B&W and one for Color. What is the advantage of using templates to produce PDFs that use color inversion, rotation, or mirroring of the scanned images?
Thanks, Mike...
|
|
![]() |
|
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