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 - How do you center text on a page?
  FAQ FAQ  Forum Search   Register Register  Login Login

How do you center text on a page?

 Post Reply Post Reply
Author
Message
Carneno View Drop Down
Team Player
Team Player
Avatar

Joined: 19 Apr 11
Status: Offline
Points: 24
Post Options Post Options   Thanks (0) Thanks(0)   Quote Carneno Quote  Post ReplyReply Direct Link To This Post Topic: How do you center text on a page?
    Posted: 26 Apr 11 at 12:37AM

Hello,

I'm developing a VB 6.0 printing program using QuickPDF Library 7.24.
 
Something is not making sense about DrawText on a page.
 
If QuickPDF allows you to set the alignment of the text(SetTextAlign) then what does the Xpos do in DrawText?
 
Does anybody know how to do center alignment of text on a page?
 
Any help would be gratefully appreciated.
 
Thanks,
Tony
Stop The World, I want To Get Off.
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: 26 Apr 11 at 1:33PM
Why you don't read the online-reference:
"...
XPos The horizontal position of where to draw the text. The reference point is usually to the left of the first character, unless the SetTextAlign function has been used to change the alignment.
..."

Yyou can set the page dimensions.
You can set if you want inch, mm or pixels (psunits).
You can set the font dimensions.
You should know what you wanna write.
Where's the problem? Calculate a bit ... ;-)
Another advice: Use/try the html-functions...

Cheers, Ingo

Back to Top
Carneno View Drop Down
Team Player
Team Player
Avatar

Joined: 19 Apr 11
Status: Offline
Points: 24
Post Options Post Options   Thanks (0) Thanks(0)   Quote Carneno Quote  Post ReplyReply Direct Link To This Post Posted: 26 Apr 11 at 2:25PM

Hello Ingo.

Thanks again for your continued help with my issues.
 
I'm not sure of what your point is.  I have spent numerous hours reading the refernce manual as well as all the forums and other information on QuickPDF.org.
 
Everything i read simply says to use the SetTextAlign with a "1" for the TextAlign option.
 
If I use this code:
   
    QuickPDFResult = QuickPDFObject.SetTextAlign(1)
    ExceptionLineString = "* * * * * * * * * * C of A  EXCEPTION REPORT * * * * * * * * * *"
    Call QuickPDFObject.DrawText(0, 36, ExceptionLineString)
 
It prints "PTION REPORT * * * * * * * * * *" on the left side of the page.
 
I'm not sure of what I should calculate or what else I should do to center the text.
 
Thanks,
Tony
Stop The World, I want To Get Off.
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: 26 Apr 11 at 2:44PM
First set the measurements.
Then: How wide is your document?
Then: How long (how many characters) has your text?
Then: What's the font height? Height 10 should be round about 8 points wide (depends on the used font).
Then: Check if there's a non printable frame.
Then: Divide width of document, divide width of your text, ...
And try and try and try ... and if you've got your own solution you've learned a lot ;-)
BTW: Again... try the html-functions...

Cheers, Ingo 
Back to Top
Carneno View Drop Down
Team Player
Team Player
Avatar

Joined: 19 Apr 11
Status: Offline
Points: 24
Post Options Post Options   Thanks (0) Thanks(0)   Quote Carneno Quote  Post ReplyReply Direct Link To This Post Posted: 26 Apr 11 at 3:25PM
OK.  I think i see what you are telling me.  I used this code to center the line of text:
 
    QuickPDFCofAExceptDocumentID = QuickPDFObject.NewDocument
    QuickPDFCofAExceptDocumentID = QuickPDFObject.SelectedDocument
    QuickPDFPageHeight = QuickPDFObject.PageHeight
    QuickPDFPageWidth = QuickPDFObject.PageWidth
    QuickPDFResult = QuickPDFObject.SetOrigin(1)
    QuickPDFCourierBoldFontID = QuickPDFObject.AddStandardFont(1)
    QuickPDFResult = QuickPDFObject.SelectFont(QuickPDFCourierBoldFontID)
    QuickPDFResult = QuickPDFObject.SetTextSize(12)
    QuickPDFResult = QuickPDFObject.SetTextAlign(0)
   
    ExceptionLineString = "* * * * * * * * * * C of A  EXCEPTION REPORT * * * * * * * * * *"
    Call QuickPDFObject.DrawText((QuickPDFPageWidth / 2) - (Len(ExceptionLineString) / 2 * 7.2), QuickPDFStartYPosition, ExceptionLineString)
 
That centered the text.
 
I will look at the non printable frame information you suggested and the html functions.
 
So, does this mean that the SetTextAlign option "1" does not work?
 
Thanks,
Tony
Stop The World, I want To Get Off.
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: 26 Apr 11 at 4:26PM
Hi!

A last time:
Read the description about DrawText (specially xpos and regarding TextAlign).
Read the description about SetTextAlign.

Cheers, Ingo

Back to Top
Carneno View Drop Down
Team Player
Team Player
Avatar

Joined: 19 Apr 11
Status: Offline
Points: 24
Post Options Post Options   Thanks (0) Thanks(0)   Quote Carneno Quote  Post ReplyReply Direct Link To This Post Posted: 26 Apr 11 at 6:26PM

OK Ingo.  There is obviously something there that I can't see.  I'll try to figure it out.

Thanks again,
Tony
Stop The World, I want To Get Off.
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