Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Tue Oct 13, 2020 6:41 am

Hello,

i try to modify a DOCX-document with special fonts.
If i save the document as DOCX again everything works fine.
But if i try to save the document as PDF the font get lost.

I try to save the document to stream with "SaveToStream" and from this stream to filesystem. But if i try to save directly to filesystem with "SaveToFile" there is the same issue.

Is there a special reason for? Should i manually insert the fonts to the document when saving as PDF?

best wishes
Joachim

joachim_eckerl
 
Posts: 10
Joined: Thu Dec 05, 2019 12:52 pm

Tue Oct 13, 2020 8:35 am

Hello,

Thanks for your post.
Please try to embed the font when saving to PDF file like the following code snippet. If there is still any question after trying. To help us further look into it, please share us with your full testing code, your saved Word file, your saved PDF file as well as your special font file.
Code: Select all
......
//Embed the fonts.
ToPdfParameterList parms = new ToPdfParameterList();
parms.IsEmbeddedAllFonts = true;
//Save to PDF
doc.SaveToFile(@"output.pdf", parms);

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1261
Joined: Wed Apr 25, 2018 3:20 am

Tue Oct 13, 2020 9:04 am

Hello,

i tried your code but still the font ist not saved in pdf-result.
Attached you can find my test-document and the font-file which is used (the font should be embedded in document-file too).
I created a test-code to replicate the test-scenario:
Code: Select all
            Spire.Doc.Document doc = new Spire.Doc.Document();
            doc.LoadFromFile(@"C:\Temp\Template.docx");
            Spire.Doc.ToPdfParameterList parms = new Spire.Doc.ToPdfParameterList();
            parms.IsEmbeddedAllFonts = true;
            doc.SaveToFile(@"C:\Temp\harglgargl.pdf", parms);
            doc.SaveToFile(@"C:\Temp\harglgargl.docx");


many thanks and best wishes
Joachim

joachim_eckerl
 
Posts: 10
Joined: Thu Dec 05, 2019 12:52 pm

Tue Oct 13, 2020 10:01 am

Hello,

Thanks for your quick feedback.
After installing the font "CODE-39-LOGITOGO-AUT.TTF" in my system and testing your file with our latest Spire.Doc Pack(hot fix) Version:8.10.0. This font can be embedded to PDF like the attached screenshot effect. Here, I uploaded my testing .exe program, please run it directly on your side. If your issue still exists, please share us with your system information (E.g.Win7, 64 bit) and region setting (E.g.China, Chinese) to help further investigate it.

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1261
Joined: Wed Apr 25, 2018 3:20 am

Tue Oct 13, 2020 10:13 am

Hello,

thanks for the HotFix!
I use the spire.Doc over the Spire.Office NuGet-package because i also need other components in the same project.
Maybe the latest Spire.Doc-HotFix is not included in the latest Spire.Office-package 5.10?

many thanks and best wishes
Joachim

joachim_eckerl
 
Posts: 10
Joined: Thu Dec 05, 2019 12:52 pm

Wed Oct 14, 2020 1:35 am

Hi Joachim,

Thanks for your response.
The latest Spire.Doc v8.10.0 is included in the latest Spire.Office v5.10, you can use it directly.
Feel free to contact us if you have further questions.

Sincerely,
Rachel
E-iceblue support team
User avatar

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

Wed Oct 14, 2020 6:36 am

Hi Rachel,

the Fix still did not work for me.
With your Project, you send me, everything is fine and the pdf is created as desired.
When i create a .NET Core Project and include the latest Version of Spire.Doc (or Spire.Office) the created pdf still did not contain my font.
I attached my test-Project (without Debug-Output because i cannot upload more than 3 files or 2 MBs).
I work with Win10, 64 bit

many thanks and best wishes
Joachim

joachim_eckerl
 
Posts: 10
Joined: Thu Dec 05, 2019 12:52 pm

Wed Oct 14, 2020 10:13 am

Hello,

Thanks for your feedback.
I tested your project on Windows 10 and did find that the font is not embed in the generated PDF file. This issue has been logged in our bug tracking system with the ticket SPIREDOC-5072 for further investigation. If there is any update, I will let you know.
Apologize for the inconvenience caused.

Sincerely,
Rachel
E-iceblue support team
User avatar

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

Return to Spire.Doc