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!
![]() |
How do you center text on a page? |
Post Reply ![]() |
Author | |
Carneno ![]() Team Player ![]() ![]() Joined: 19 Apr 11 Status: Offline Points: 24 |
![]() ![]() ![]() ![]() ![]() 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?
Any help would be gratefully appreciated.
|
|
Stop The World, I want To Get Off.
|
|
![]() |
|
Ingo ![]() Moderator Group ![]() ![]() Joined: 29 Oct 05 Status: Offline Points: 3529 |
![]() ![]() ![]() ![]() ![]() |
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 |
|
![]() |
|
Carneno ![]() Team Player ![]() ![]() Joined: 19 Apr 11 Status: Offline Points: 24 |
![]() ![]() ![]() ![]() ![]() |
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.
|
|
![]() |
|
Ingo ![]() Moderator Group ![]() ![]() Joined: 29 Oct 05 Status: Offline Points: 3529 |
![]() ![]() ![]() ![]() ![]() |
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 |
|
![]() |
|
Carneno ![]() Team Player ![]() ![]() Joined: 19 Apr 11 Status: Offline Points: 24 |
![]() ![]() ![]() ![]() ![]() |
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.
|
|
![]() |
|
Ingo ![]() Moderator Group ![]() ![]() Joined: 29 Oct 05 Status: Offline Points: 3529 |
![]() ![]() ![]() ![]() ![]() |
Hi!
A last time: Read the description about DrawText (specially xpos and regarding TextAlign). Read the description about SetTextAlign. Cheers, Ingo |
|
![]() |
|
Carneno ![]() Team Player ![]() ![]() Joined: 19 Apr 11 Status: Offline Points: 24 |
![]() ![]() ![]() ![]() ![]() |
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.
|
|
![]() |
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