Print Page | Close Window

Font Size not working

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=1194
Printed Date: 25 Apr 25 at 8:39AM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Font Size not working
Posted By: softwaredev
Subject: Font Size not working
Date Posted: 01 Sep 09 at 2:52PM
 
Hello fellow forum members,
 
Am trying to use QuickPDF API as an ActiveX via VB6. Cannot get the drawn text to be the font size I need. Am passing 9.75 but it seems to be printing at higher value more like 11.5 or something.
 
Wondering what is the smallest font size I could go to.
 
Code below ... Can anyone tell me what I am doing wrong? Thks!
 

   Const FileName As String = "c:\temp\out.pdf" 
   Dim Result
    Set QP = New QuickPDFAX0715.PDFLibrary
    Result = QP.UnlockKey(LicenseKey)
       
    If Result = 1 Then
        Call QP.SetMeasurementUnits(1)    'Change to MM
        Call QP.SetOrigin(1)                        'Start 0 at top Left
        Call QP.SetLineColor(0, 0, 0)           'black
        Call QP.AddTrueTypeFont("Arial", 1)       'Arial,  embed
        Call QP.SetTextSize(9.75)                                   'Font size 9.75
        Call QP.DrawText(20, 50, "Quick PDF Font Size Testing")  
 
        If QP.SaveToFile(FileName) = 1 Then
            'MsgBox "File " + FileName + " written successfully."
        Else
            'MsgBox "Error, file could not be written."
        End If
    End If
 
Another similar question. Earlier was using the QP.SetFontFlags to set the font to Bold but it did not work for me, so have changed to include the Bold inside the Font-Name itself like (Arial Narrow Bold Italic) and that seems to work. Is that the right way to do it?
 
 



Replies:
Posted By: Ingo
Date Posted: 01 Sep 09 at 4:44PM
Hi!

You have to select the font after adding it and before writing.
If you want to set the textcolour you should use SetTextColor.

Cheers, Ingo



Posted By: Shotgun Tom
Date Posted: 01 Sep 09 at 5:08PM
I tested your code in VB6 and it works okay.  One thought... I assume you're viewing your out.pdf in Adobe Reader, correct?  Check your resolution preference in Reader.  You can access it from Reader by pressing Ctrl-K.  Choose Page Display.  Check your resolution.  If you are using a higher dpi resolution than your system setting the font will appear larger but is actually correct.
 
One other quick note on your code... not sure why you have SetLineColor method included.  If you want to set the color of the text you would need to use SetTextColor method.
 
Tom


Posted By: softwaredev
Date Posted: 01 Sep 09 at 8:33PM
 
Found my problem, replying here for the benefit of the forum.
 
In my code the user was able to select the Font, hence if they would select Arial it was getting set to "Arial Regular". Which in turn would cause the Font to appear funny.
 
Fixed!



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