Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Thu Apr 07, 2016 5:15 pm

We are also noticing that we can't pick up a non-standard font. We've tried various things: Installing the TrueType font on the server where we are running our tests, embedded the font into the DOCX file. Whatever we do, we can't pick up the font.

Is there something special we have to do to make the font available to the PDF renderer?

john.kgb
 
Posts: 5
Joined: Thu Apr 07, 2016 4:45 pm

Fri Apr 08, 2016 3:07 am

Hi,

Thanks for your posting.
Please try the following solution.
Code: Select all
            Document document = new Document();
            document.LoadFromFile("sample.docx");
            ToPdfParameterList parms = new ToPdfParameterList()
            {
                IsEmbeddedAllFonts = true
            };
            document.SaveToFile("result.pdf", parms);


If you don't want to install the fonts on your server, you can use the below solution to embedd the font into PDF.
Code: Select all
Document document = new Document();
document.LoadFromFile("sample.docx");
ToPdfParameterList parms = new ToPdfParameterList()
{
PrivateFontPaths = new List<PrivateFontPath>()

{ new PrivateFontPath("AeridanishScript","..\\..\\AeridanishScript.ttf") }
};
document.SaveToFile("result.pdf", parms);


Best Regards,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 3043
Joined: Wed Jun 27, 2012 8:50 am

Fri Apr 08, 2016 6:53 pm

Thanks, we stumbled across the solution in the course of trying different solutions. We did exactly as you suggested.

john.kgb
 
Posts: 5
Joined: Thu Apr 07, 2016 4:45 pm

Mon Apr 11, 2016 2:24 am

Hi,

Thanks for your feedback.
I am glad to hear that. Welcome to feel free to write to us if you have further problems.

Best Regards,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 3043
Joined: Wed Jun 27, 2012 8:50 am

Return to Spire.PDF

cron