Print Page | Close Window

Problem with SetTextSize

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=1320
Printed Date: 04 Apr 26 at 6:30PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Problem with SetTextSize
Posted By: Phil
Subject: Problem with SetTextSize
Date Posted: 21 Jan 10 at 7:05AM
Hello,
 
I want to insert footer text (page numbers) in a existing pdf document. But I'm not able to set the text size. Here's my VB code (sample):
 
Sub DemoSetTextSize()
  ClassName = "QuickPDFAX0717.PDFLibrary"
  LicenseKey = "..."
  Set QP = CreateObject(ClassName)
  Result = QP.UnlockKey(LicenseKey)
  If Result = 1 Then
    Call QP.LoadFromFile("C:\MyPDF.pdf")
    lngFontID = QP.AddTrueTypeFont("Arial", 1)
    Call QP.SelectFont(lngFontID)
    Call QP.SetTextSize(50)       '<- HAS NO EFFECT!
    Call QP.SelectPage(1)
    Call QP.SetOrigin(0)
    strPageText = "My Footer Text"
    dblTextWidth = QP.GetTextWidth(strPageText)
    Call QP.DrawText((QP.PageWidth() / 2) - dblTextWidth / 2, 30, strPageText)
    Call QP.SaveToFile("C:\MyPDF.pdf")
  End If
End Sub
Everything works, except setting the text size. Regardless of which font I use. When I don't select the font, the Helvetica 12pt is used, as mentioned in the manual. Even then, I can't set the size. Any idea?
 
Kind regards,
Phil



Replies:
Posted By: Ingo
Date Posted: 21 Jan 10 at 9:11AM
Hi Phil!

Call QP.SelectPage(1) and Call QP.SetOrigin(0) should be inserted before SelectFont...
If the AddTrueType returns with a zero then the function already fails - check this please.
What was the returning value from SelectFont... success or not?
Perhaps you should do few samples with the standard-fonts already installed. Does it works with the standard-fonts?

Cheers and welcome here,
Ingo


Posted By: Phil
Date Posted: 21 Jan 10 at 10:16AM
Hi Ingo
 
You are right! I moved SelectPage and SetOrigin. Now it works!
Thanks very much!
 
Phil



Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk