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!
Font embedded multiple times |
Post Reply |
Author | |
StanMarshall
Beginner Joined: 11 Jan 06 Location: United States Status: Offline Points: 9 |
Post Options
Thanks(0)
Posted: 18 Jan 06 at 5:04PM |
Hi all... It was great to stumble across this forum. Thanks to all who started it. I share your dismay at the apparent demise of ISED. I have a question: Does anyone know how to get QuickPDF to only embed a font if that font has not already been embedded in the document? And, if it has already been embedded in the document, to use that font for a specific call to DrawText? At first, I was hoping AddTrueTypeFont would just be smart enough to realize the font I am asking it to add to the document was already there and, so, to not add it again. However, that does not seem to be the case. So I tried this: function CheckPDFDocumentForFont(thePDF : TiSEDQuickPDF; FontName : String) : LongInt; FontCount := thePDF.FindFonts; for FontCtr := 1 to FontCount do Result := -1; {font not found}
if FontID < 0 then FontID := thePDF.AddTrueTypeFont(FontName,1); thePDF.SelectFont(FontID); ... (The PDF is already properly opened etc. before either of these routines is called.) However, it still seems to re-embed the font for each text control that uses it. (My printing routines iterate through each visible control on a form and print each control independently...it's sort of a homegrown wysiwyg report designer.) The font does not show up multiple times in Acrobat's "Document Properties|Fonts" list, but the space used by fonts increases (substantially) with each text control I add to the form I am printing...even if the text is only a three letter word. Can anybody see any problems with the code I have pasted above (like why it would not find the font, or, if it does find the font, why it would re-embedd it anyway)? Or, does anyone have any ideas on how to get QuickPDF to stop embedding the same font multiple times (assuming that is really what is happening)? I can think of a few possibilities like figuring out all of the necessary fonts and embedding them ahead of time or maintaining my own list of fonts that have been used. However, I would rather not use either of those approaches for reasons beyond the scope of this post (the second wouldn't be too bad if it works). I would really like to be able to just ask QuickPDF "is the font used by this text control already embedded in the document? if so, just use it...if not, embed it" I can't figure out why the code I have pasted above does not seem to be doing that. Any help would be greatly appreciated. Thanks. Stan Edited by StanMarshall |
|
StanMarshall
Beginner Joined: 11 Jan 06 Location: United States Status: Offline Points: 9 |
Post Options
Thanks(0)
|
I have done some more playing around and have determined that this only happens with bold or italic fonts. For example, "Arial [Bold]". I think it has to do with the naming convention. Seems like QuickPDF recognizes the naming convention "fontname [Bold]" for adding fonts, but not for finding them. A little more poking around should allow me to discover the naming convention it will use to find the fonts...then, hopefully, I'll just need to do some systematic name translation and it will work...hopefully If I figure it out, I will post the solution so anyone else who might run into this can find the answer. In the meantime, if anyone has any thoughts, please post them. Thanks. Stan |
|
Ingo
Moderator Group Joined: 29 Oct 05 Status: Offline Points: 3524 |
Post Options
Thanks(0)
|
Hi Stan!
I've made own code searching through the whole pdf-file collecting all embedded fonts and offer the result as a user information in a combobox. First i decrypt the file and read the file-content into a string. There i'm looking for all font objects. It's fast enough for big files, too. Best regards, Ingo |
|
StanMarshall
Beginner Joined: 11 Jan 06 Location: United States Status: Offline Points: 9 |
Post Options
Thanks(0)
|
Thanks for the idea Ingo. I'll play around with that. |
|
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