Print Page | Close Window

Problems with Type1 Font info (as returned by QP)

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=1497
Printed Date: 08 Sep 24 at 3:45AM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Problems with Type1 Font info (as returned by QP)
Posted By: Ruturaaj
Subject: Problems with Type1 Font info (as returned by QP)
Date Posted: 22 Jun 10 at 5:01AM
Hello!

I'm having a PDF file with Type1 fonts embedded in it. I can see "(Embedded)" when viewed the Document Properties in Adobe Reader. However, when I attempt to get the Font information of Document using QuickPDF Lib, the FontType for the selected Type1 fonts is returned as "6", which means "Type1" font. So, this does not give me any hint whether the Font is embedded or not (or am I missing any basic concepts here?).

Since the FontType returned is not "4" (Embedded TrueType), the fonts are not saved to file using SaveFontToFile function. Is this the default limitation of QuickPDF or is there any other method to get this to work?

Waiting for your valuable reply...

Regards,

Ruturaaj.




Replies:
Posted By: Ruturaaj
Date Posted: 22 Jun 10 at 5:38AM
I think there some problem with the SaveFontToFile function or something is wrong with my code or PDF file may be; not sure. I attempted to view the extracted TTF fonts with Windows Font Viewer and it says those are not valid Font files. It's also apparent from the icons ... the extracted TTF files does not show proper TTF file icon.

Am I expecting something too much from this function? Please explain.

Here is my simple VB6 code for your ready reference:


Set oPDF = New PDFLibrary
   
    With oPDF
   
        .UnlockKey UNLOCK_KEY
       
        .LoadFromFile txtPDFFile.Text
       
        .FindFonts
       
        For iCnt = 1 To .FontCount
           
            lFontID = .GetFontID(iCnt)
            .SelectFont lFontID
           
            If .FontType = 4 Then
                sSaveAs = txtSaveAsFolder.Text & "\" & .FontName & ".ttf"
                lRet = .SaveFontToFile(sSaveAs)
            End If
           
            DoEvents
           
        Next iCnt
           
    End With
   
Set oPDF = Nothing



Posted By: Ingo
Date Posted: 22 Jun 10 at 8:59AM
Hi!

Please read the online-reference.
This function works only with truetype-fonts - not type1.

Cheers, Ingo



Posted By: Ruturaaj
Date Posted: 22 Jun 10 at 10:47AM
Hi!

Yes, I read about it ... is this limitation of QuickPDF or simply no method available to extract Type1 fonts from PDF?

Secondly, this method does extract the TTF fonts but the font files are treated invalid. I was expecting this function to extract font to TTF file which then I can take to my other computer and install the extracted font. However, there is some problem with the SaveFontToFile function ... did you try it? Were you able to extract TTF font to a valid font file? Try QuickPDF manual PDF file for example. Or am I doing anything wrong?

Regards,

Ruturaaj.



Posted By: Ingo
Date Posted: 22 Jun 10 at 11:54AM
Hi!

I would think that they've started implementing methods
for saving fonts ... and first they want to do it with truetype
'cause it's the more wanted type. So perhaps later this
function will be enhanced?

Cheers, Ingo



Posted By: Ruturaaj
Date Posted: 22 Jun 10 at 1:54PM
Thanks for your reply! I continued to search for this issue as I wanted to trace why my Font files are not saved as valid Font Files. Yes, I'm talking about the TrueType Fonts and still they are not saved as valid Font File.

While searching, I landed on a Blog and found following text about embedded fonts in PDF:
Quote When a font is embedded in a PDF, not all of the font data are included. Obviously the font outline data are included as well as the font width tables. Other information, such as data about ligatures, are irrelevant within the PDF so those data do not get enclosed in a PDF.


So, I think the font information that's extracted to File is not the complete font, but just the outline of it and not the real character table and glyphs. So, when QP returned this information and saved to file, it didn't appear as valid font for Windows OS.

I'm not sure if this is the reason; just guessing that it's the reason. Any thoughts on this?

If QP continues to evolve on SaveFontToFile function scope then that's great ... but we cannot recreate the missing information to build a valid font file. So, if PDF is not carrying the entire Font file information for some obvious Font copyright issues then SaveFontToFile function looks of no use. Instead, if Developers concentrate to transfer the embedded font information from one PDF to another thereby allowing developers to simply copy the embedded fonts from one PDF to another then it will be more useful and practical too. This will especially prove helpful in case of splitting PDF files or merging one PDF file into a newly created PDF file.

In fact, I never paid attention to the Font issue when merging two PDF files with QP before! If you find any information related to "Font Extraction to a valid TrueType Fonts" then please share with me.

Regards,

Ruturaaj.




Posted By: Wheeley
Date Posted: 23 Jun 10 at 4:46AM
For some reason I seem to remember that the font name may say embedded if retrieved through QP. Give that I try.

Just a thought
Wheeley


Posted By: Ruturaaj
Date Posted: 23 Jun 10 at 7:40AM
Hi Wheeley,

Thanks for your reply. In my all tests, I didn't face any problem in retrieving Font names; all names are correctly returned by QP. The issue is related to the Font file when saved with SaveFontToFile function. Give it a try and let me know if you could import/install the extracted font correctly in your OS.

Regards,

Ruturaaj.



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