Custom Fonts in Spreadjs while exporting

Posted by: ajay on 31 August 2018, 5:40 am EST

    • Post Options:
    • Link

    Posted 31 August 2018, 5:40 am EST

    Hi there,

    I looked at the demo https://www.grapecity.com/en/demos/spread/JS/TutorialSample/#/demos/customFontExportPdf

    and have a question on how the fonts.js file was created.

    We have the ttf file for the font we want to include in the pdf, but are not sure how to get in the json format.

    Thanks,

    AK

  • Posted 31 August 2018, 11:39 am EST

    I figured it out. We just need to convert to base64 encoding. See below for Sample code I used:

    string plainText = File.ReadAllText(“C:\inetpub\simsun.ttc”, Encoding.UTF8);

                var plainTextBytes = Encoding.UTF8.GetBytes(plainText);
    
                string encodedText = Convert.ToBase64String(plainTextBytes);
               
                Console.WriteLine("Encoded Text : {0}", encodedText);
    
  • Posted 2 September 2018, 3:11 pm EST

    Hello,

    We are glad to know that your issue has been resolved.

    Thanks,

    Reeva

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels