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 - DrawText
  FAQ FAQ  Forum Search   Register Register  Login Login

DrawText

 Post Reply Post Reply
Author
Message
moakley View Drop Down
Beginner
Beginner


Joined: 23 Oct 12
Status: Offline
Points: 9
Post Options Post Options   Thanks (0) Thanks(0)   Quote moakley Quote  Post ReplyReply Direct Link To This Post Topic: DrawText
    Posted: 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);
 
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3530
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
moakley View Drop Down
Beginner
Beginner


Joined: 23 Oct 12
Status: Offline
Points: 9
Post Options Post Options   Thanks (0) Thanks(0)   Quote moakley Quote  Post ReplyReply Direct Link To This Post 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();
Back to Top
AndrewC View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 08 Dec 10
Location: Geelong, Aust
Status: Offline
Points: 841
Post Options Post Options   Thanks (0) Thanks(0)   Quote AndrewC Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3530
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post 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
 
Back to Top
moakley View Drop Down
Beginner
Beginner


Joined: 23 Oct 12
Status: Offline
Points: 9
Post Options Post Options   Thanks (0) Thanks(0)   Quote moakley Quote  Post ReplyReply Direct Link To This Post 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...
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