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!

Debenu Quick PDF Library - PDF SDK Community Forum Homepage
Forum Home Forum Home > For Users of the Library > I need help - I can help
  New Posts New Posts RSS Feed - AddTrueTypeFont not working as expected
  FAQ FAQ  Forum Search   Register Register  Login Login

AddTrueTypeFont not working as expected

 Post Reply Post Reply
Author
Message
donna View Drop Down
Beginner
Beginner


Joined: 22 Oct 17
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote donna Quote  Post ReplyReply Direct Link To This Post Topic: AddTrueTypeFont not working as expected
    Posted: 23 Oct 17 at 1:49AM
Hi,

Please refer to below code. 
I passed m_titleFont as parameter to ConvertFontType method. 
When the server is executing line AddTrueFontType, the code is like hanging at there.
No exception was caught though.
Please advise. :)


Font m_titleFont = new Font("Arial", 18);

public void ConvertFontType(Font font)
        {
            try
            {
                string subfix = "";
                if (font.Bold && font.Italic)
                {
                    subfix = " [BoldItalic]";
                }
                else if (font.Bold)
                {
                    subfix = " [Bold]";
                }
                else if (font.Italic)
                {
                    subfix = " [Italic]";
                }

                bool found = false;
                string requestFontName = font.FontFamily.Name;
                int fontCount = m_qPdf.FontCount();
                requestFontName = font.FontFamily.Name + subfix;

                for (int i = 0; i < fontCount; i++)
                {
                   var selectFont = m_qPdf.SelectFont(i);
                    if (selectFont == 0)
                    {
                        // show error
                        return;
                    }

                    if (m_qPdf.FontName() == requestFontName)
                    {
                        found = true;
                        break;
                    }
                }

                if (!found)
                {
                    int fontID = m_qPdf.AddTrueTypeFont(requestFontName, 0); //<< hanging here
                    var selectFont = m_qPdf.SelectFont(fontID);
                    if (selectFont == 0)
                    {
                        // show error
                        return;
                    }
                }

                int _increment = 2;
                var setTextSize = m_qPdf.SetTextSize(font.Size + _increment);
                if (setTextSize == 0)
                {
                    // show error
                    return;
                }
            }
            catch(Exception ex)
            {
                // show error
            }
        }    
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3524
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 23 Oct 17 at 12:18PM
Hi Donna,

did you read all about AddTrueTypeFont here?
http://www.debenu.com/docs/pdf_library_reference/AddTrueTypeFont.php
If i understand your code there's the relevant font missing - so you want to add it.
I would assume that the font name in requestFontName is a bit different to the fontnamefile in the font-path of your system.
You should check the content of "requestFontName" and then you should have a look into your system if there's a fontfile with the same name.


Cheers,
Ingo

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.01
Copyright ©2001-2014 Web Wiz Ltd.

Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. AboutContactBlogSupportOnline Store