Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files from any .NET platform (C#, VB.NET, ASP.NET, .NET Core) and Java applications (J2SE and J2EE) with fast and high quality performance.

Fri Mar 06, 2020 4:42 pm

Application uses FreeSpire.Doc to save a one page word document as a PDF while using the embed fonts option.
Code: Select all
Using spireDocument As New Document(Path.Combine(checkTemplateFolder, checkTemplateName))
    ' removed code that sets some data in the word document
    Dim params As New ToPdfParameterList With {.IsEmbeddedAllFonts = True}
    spireDocument.SaveToStream(stream, params)
    spireDocument.Close()


The code works locally while developing. The code works on our UAT web server. The code worked for 3 hours after initial release to our production server in the afternoon on March 4 but the next morning (and currently) the generated PDF does not contain the embedded fonts. I'm at a loss for what to troubleshoot next. I've uploaded some relevant files including the Word document used as a template and generated PDFs. Any suggestions?
You do not have the required permissions to view the files attached to this post.

bob.hanson
 
Posts: 6
Joined: Tue Nov 19, 2019 3:16 pm

Fri Mar 06, 2020 6:29 pm

I created a simple console application today to mimic the code that creates the PDF and it's running properly on the web server. :x

bob.hanson
 
Posts: 6
Joined: Tue Nov 19, 2019 3:16 pm

Fri Mar 06, 2020 6:59 pm

I took the console app code and added it to a page in the web application and it fails there. My hunch is that there is some kind of a permission issue with the application pool accessing fonts but that does not explain why it worked for 3 hours on Wednesday afternoon (March 4) but stopped working the next morning. The app pool runs with the identity of an assigned service account.

bob.hanson
 
Posts: 6
Joined: Tue Nov 19, 2019 3:16 pm

Mon Mar 09, 2020 8:34 am

Hello,

Thanks for your inquiry and sorry for the late reply as weekend.
In addition to the method you used, our Spire.Doc also supports using uninstalled font when converting Doc to PDF. Below is the corresponding code for reference. Please give it a try on your side.
Code: Select all
        Dim doc As Document = New Document
        doc.LoadFromFile("CheckTemplate_kvs.docx")
        Dim toPdf As ToPdfParameterList = New ToPdfParameterList
        Dim list As List(Of PrivateFontPath) = New List(Of PrivateFontPath)
        list.Add(New PrivateFontPath("free3of9", "free3of9.ttf"))
        list.Add(New PrivateFontPath("MICR Encoding","MICR Encoding.ttf"))
        toPdf.PrivateFontPaths = list
        doc.SaveToFile(("result.pdf", toPdf)

Besides, I also recommend you to try our commercial version (at present the latest version is Spire.Doc Pack(hot fix) Version:8.3.0), since it contains more bug fixes and is more stable than the free version.

If the issue still happens, to help us further investigate your issue, please provide the following information.
1) A runnable project that could reproduce your issue.
2) Your production server environment information, such as OS information (E.g. Windows Sever 2012, 64bit) and Region setting (E.g. China, Chinese).
You could upload here or send them to us(support@e-iceblue.com) via email. Thanks in advance.

Sincerely,
Rachel
E-iceblue support team
User avatar

rachel.lei
 
Posts: 654
Joined: Tue Jul 09, 2019 2:22 am

Wed Mar 11, 2020 4:36 pm

The issue did not involve FreeSpire.Doc. I'm not sure why it worked on the first day and stopped on the next but the web server needed to be re-booted to recognize the two fonts that I had installed.

bob.hanson
 
Posts: 6
Joined: Tue Nov 19, 2019 3:16 pm

Thu Mar 12, 2020 8:58 am

Hello,

Thanks for your feedback.
Have you tested the code I provided? Using that method, you don't need to install the fonts on your server. I tested your case with the latest Spire.Doc Pack(hot fix) Version:8.3.0, and found that the font could be embeded successfully. Here is my testing project, please directly deploy and run it on your side, and then tell us your testing result.
https://www.e-iceblue.com/downloads/demo/Demo20827.zip

If there is still any issue, to help us further investigate your issue, please provide the following information.
1) A runnable project that could reproduce your issue.
2) Your production server environment information, such as OS information (E.g. Windows Sever 2012, 64bit) and Region setting (E.g. China, Chinese).
You could upload here or send them to us(support@e-iceblue.com) via email. Thanks in advance.

Sincerely,
Rachel
E-iceblue support team
User avatar

rachel.lei
 
Posts: 654
Joined: Tue Jul 09, 2019 2:22 am

Return to Spire.Doc