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!
Use embedded font of a PDF |
Post Reply |
Author | |
datasportdev
Beginner Joined: 29 Apr 15 Location: Switzerland Status: Offline Points: 7 |
Post Options
Thanks(0)
Posted: 29 Apr 15 at 10:16AM |
Hi
I'm trying to use an embedded font when I LoadFromFile() a PDF and then I AddTrueTypeFont() with the parameter embed = 0, because the font is already in the PDF. But event if I read (Windows CMD --> findstr FontName "FileName") all the included font names and I take the exactly same font name or font family name, my new text does not use this font. Instead the new text is diplayed with a "default" font (Arial in my case, since the font is not installed on my PC. What Do I do wrong?? Here a snippet: Count := QuickPDF.FontCount; Found := FALSE; Index := 1; WHILE (Index <= Count) AND NOT Found DO BEGIN FontID := QuickPDF.GetFontID(Index); IF FontID > 0 then begin QuickPDF.SelectFont(FontID); if QuickPDF.FontName = FontName then Found := TRUE; end; if NOT Found then INC(Index); END; if NOT Found then begin FontID := QuickPDF.AddTrueTypeFont(FontName,0); QuickPDF.SelectFont(FontID); end; |
|
erico
Senior Member Joined: 24 Sep 14 Location: Minnesota USA Status: Offline Points: 51 |
Post Options
Thanks(1)
|
You cannot add a font you do not have. Thus the AddTrueTypeFont call above will always fail, regardless of the embed flag unless you have the font. If the font is already in the PDF, you should be able to use it unless it has been subsetted, in which case not all characters will be available (and probably not in the standard encoding either) so adding text would be problematic at best. |
|
Eric O
|
|
datasportdev
Beginner Joined: 29 Apr 15 Location: Switzerland Status: Offline Points: 7 |
Post Options
Thanks(0)
|
Thx 4 ur reply.
I know that the font is embedded. My task is now to add a text with the already embedded form. When I do FontCount the Result = 2. One is Arial and the other is the other font I need. When I want to add a text to the loaded PDF with this second font, I get a FontId > 0 and use this ID for my text. Yet the new text in the PDF doesn't use that embedded fobt, but a 'default' obe from the PC where the file has been opened. |
|
erico
Senior Member Joined: 24 Sep 14 Location: Minnesota USA Status: Offline Points: 51 |
Post Options
Thanks(1)
|
You indicate that QuickPDF.FontCount is 2. Did you check that result, or do you just believe that to be true because Acrobat says there are 2 fonts embedded? Unless you call QuickPDF.FindFonts() any fonts that are already embedded in the PDF will not be seen by QuickPDF.FontCount (Check the documentation for FontCount).
Are you positive that the FontName you specify is an exact match for QuickPDF.FontName ? (Is Found being set to TRUE?) Just for a test, try selecting the first font found to see if it will be used: FontID := QuickPDF.GetFontID(1); IF FontID > 0 then QuickPDF.SelectFont(FontID); ... add some text ... |
|
Eric O
|
|
datasportdev
Beginner Joined: 29 Apr 15 Location: Switzerland Status: Offline Points: 7 |
Post Options
Thanks(0)
|
Sorry! Problem found!
I was comparing the FontFamily with the FontName My BIG mistake! Now everything works fine! Thx a lot for your feedback!! |
|
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