Print Page | Close Window

Set Font

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=918
Printed Date: 04 May 24 at 11:31AM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Set Font
Posted By: TomCollins88
Subject: Set Font
Date Posted: 06 Jul 08 at 9:24AM
Let's see what kind of response I can get on a Sunday. Big%20smile

I need to get some font info on text in the PDF document. If I do a GetPageText, I can get the name of the font, but not the ID.
If I want to use the GetTextWidth function, it uses the current selected font. But I don't see any method of actually selecting a font.

The purpose of this is to get the length of the text in question as sometimes the coordinates give me a length much, much longer than is correct.

Thanks for any help.

Tom



Replies:
Posted By: Ingo
Date Posted: 07 Jul 08 at 3:11AM
Hi!

You can append/insert/select only few standard fonts (via FontID) to your pdf document... Backwards you can select (via FontID) one of the inserted Fonts.
...But there are many fonts in a document - not only the few standard fonts supported by QuickPDF - so there isn't a good way to determine the used fonts.

You can do it manually by separating each page, decrypt it, reading the content into a string and searching for the parts behind  '/BaseFont /' to get the embedded fonts.

Best regards,
Ingo


Posted By: TomCollins88
Date Posted: 07 Jul 08 at 3:02PM
OK, thanks, but I still don't see a method of selecting a font.
For instance, if I use the Function FontName() then it returns the name of the selected font, or an empty string of no font is selected.

So I'm looking for a function something like: SetFont(FontID) or SetFont(FontName).

Any Ideas?

Thanks


Posted By: Ingo
Date Posted: 11 Jul 08 at 8:19AM
Hi!
If you want to set the font for the content of your new pdf-file you can do this ...
Have a look at the functions with Add...Font.
br,
Ingo


Posted By: TomCollins88
Date Posted: 11 Jul 08 at 10:28AM
I'm sorry, I having trouble conveying what I want to do.

I have an existing document already. I do not want to add any more fonts. I just want to set the current font to one already in the document. By using the font name would be preferable, but by using the font ID will work also.

This way I can use the GetTextWidth() function to see just how wide the text will be.

Thanks for your help. :-)

Tom


Posted By: Ingo
Date Posted: 11 Jul 08 at 11:23AM
Hi Tom!
 
There isn't any function in QuickPDF doing this.
See my posting here from 07.07.2008 ... you can search with own code.
Reading the pdf-content after decryption into string/stream and then searching for /BaseFont / ...
 
Best regards,
Ingo



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