Get Font ID Using Font Name
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=2858
Printed Date: 15 Aug 25 at 4:21PM Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com
Topic: Get Font ID Using Font Name
Posted By: BoHo
Subject: Get Font ID Using Font Name
Date Posted: 03 Apr 14 at 7:50PM
Hi, I am evaluating the QuickPDF Library and I'm pretty new to using it.
What I'm doing right now is accessing text objects in a CAD vector file and then converting it to a PDF file in VB6. When I access the text object in the vector file I can get the font's name, size and alignment flags used with the text. Then, I add the font to the PDF document using AddTrueTypeFont().
What I need to know is if there is a way to determine if a font has already been added to the PDF document by using the font's name to search for it prior to adding another one. And then., to be able to get the font ID using the font's name. I thought that if I added a font that had already been added previously, using AddTrueTypeFont(), that it would just return the id of the existing font. But it doesn't. It returns a new id even though I know that that particular font had already been added once. And since it's a new id I'm guessing that it's doubling up the font information for that particular font.
Is there anyway to search the fonts already added to a document by using the fonts name? Or do I need to keep track of the font's Id/Names myself in VB6 to know if it has already been added?
Thanks for any help.
|
Replies:
Posted By: hrdware
Date Posted: 01 May 14 at 1:34PM
The easiest way is going to be to keep track of the fonts and their ID numbers as you add them.
If you are using an existing document, I think you should be able to use the FindFonts call to get the number of fonts in the document, then loop through that list calling GetFontID to create a list of FontID's, then go through your list of FontID's, select each font and call FontName to get the name associated with each FontID.
|
|