Using Additional Fonts

Skip Navigation LinksHome  /  Support  /  Forums  /  DynamicPDF Generator for .NET (v4.x)  /  Display Thread

DynamicPDF Generator for .NET (v4.x) Forum

 Feb 22 2008 9:54 AM
Hi,

We are getting the following error when connecting to a server, having installed the truetype font DIN Regular Properies Name: DINRg___.ttf which is a true type font that doesn't come with Windows as standard. We have installed the font via the Control Panel font option correctly (can access and use the font from WordPad). On our web server we get the following error:

TrueType font file could not be found.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: ceTe.DynamicPDF.GeneratorException: TrueType font file could not be found.

However this works on our test machine running IIS 7, but not on the web server running IIS 6 where it falls over when trying to find the font to be used when creating/displaying the pdf file.

Any help would be appreciated.
 Feb 22 2008 10:33 AM
Posted by a ceTe Software moderator
Hello,

The error shows that the program is unable to find the font. Please make sure that the font is installed correctly and it is available in the Windows fonts folder. Try using the full path of the font when creating the TrueTypeFont object. Also please send over the code which you are using to add the font to our Support Team.

Thanks,
ceTe Software Support Team.
 Apr 11 2017 6:24 AM
Hello,
I am getting same error as above.
com.cete.dynamicpdf.GeneratorException: TrueType font file could not be found.

Please let me know what is the issue.
Regards,
Kalindi
 Apr 11 2017 9:29 AM
Posted by a ceTe Software moderator
Hello Kalindi,

You are getting this error most likely because the font file is not present in the path specified in the code. Please try using the correct file path to access the font file and this should work for you.

If you continue getting error then please send over the following details to support@cete.com so we can look into it further.

1.Code sample used to create Font object.
2.Font file.
3.Full error message along with stack trace.
4.Exact version and build number of the DynamicPDF jar file (if you can’t locate this information on your end then you can send over the DynamicPDF jar file).

Thanks,
ceTe Software Support Team
 Apr 11 2017 9:58 AM
Hello,

I am saving tahoma.ttf in asset folder plus i have downloaded the tahoma.ttf in device.
I am not getting why its giving error truetype font could not be found please check the code snippet.

Please send me the code to generate pdf using dynamic Pdf file with steps

snippet

Create a document and set it'ss properties
       Document objDocument;
        objDocument.
        String convertedText = "";

         TrueTypeFont trueTypeFont = new TrueTypeFont(Environment.getExternalStorageDirectory()
               + "/"+"tahoma.ttf");

        // Create a page to add to the document
        Page objPage = new Page(PageSize.LETTER, PageOrientation.PORTRAIT,
                54.0f);

        convertedText = Farsi.Convert("  صِفْ خَلْقَ خَوْدٍ كَمِثْلِ الشَّمْسِ إِذْ بَزَغَتْ ");

        // Create a Label to add to the page
      // Label objLabel = new Label(convertedText, 0, 0, 504, 100);
        Font font =FontFact
          Label objLabel = new Label(convertedText, 0, 0, 504, 100,
              trueTypeFont, 18, TextAlign.RIGHT);
        objLabel.setRightToLeft(true);
        objLabel.setFontSize(18);
        objLabel.setFont(Font.getHelveticaBold());
        objLabel.setAlign(TextAlign.RIGHT);
        objLabel.setText(convertedText);


        objPage.getElements().getPageElement(convertedText);
        // Add label to page
        objPage.getElements().add(objLabel);
        // objPage.
        // Add page to document
        objDocument.getPages().add(objPage);
        try {
            //  objDocument.draw(convertedText);
            // Outputs the document to file
            objDocument.draw(FILE);

            Toast.makeText(this, "File has been written to :" + FILE,
                    Toast.LENGTH_LONG).show();
        } catch (Exception e) {
            Toast.makeText(this,
                    "Error, unable to write to file\n" + e.getMessage(),
                    Toast.LENGTH_LONG).show();
        }
    }
 Apr 11 2017 4:10 PM
Posted by a ceTe Software moderator
Hello,

It looks like you are trying to use our DynamicPDF for Java product in an Android application. Please note that our product is not officially supported on Android platform and we have not tested our product on Android platform except for a few basic examples. There may be many other scenarios or features that do not work and it seems like you are running into one such scenario. The code you are using to load the font looks accurate but since you are trying to run this code on Android, it may not work as our product is not supported on Android platform. 

The documentation link on compatibility has a list of platforms that our product officially supports.

Thanks,
ceTe Software Support Team.

All times are US Eastern Standard time. The time now is 8:25 AM.