Spire.XLS for .NET is a professional Excel .NET library that can be used to any type of .NET( C#, VB.NET, ASP.NET, .NET Core) application, both ASP.NET web sites and Windows Forms application.

Thu Aug 09, 2018 8:45 am

He team,
We would like to change main font in PFD but the way described in documentation does not work for some reason.
Here is our code snippet:
Code: Select all
//we have excel workbook in the stream and we need to save it as PDF
  workbook.SaveToStream(writeStream, FileFormat.PDF);

            PdfDocument pdf = new PdfDocument();
            pdf.LoadFromStream(writeStream);
            PdfUsedFont[] fonts = pdf.UsedFonts;

            PdfFont newfont = new PdfFont(PdfFontFamily.TimesRoman, 11f, PdfFontStyle.Italic | PdfFontStyle.Bold);
            foreach (PdfUsedFont font in fonts)
            {
                font.Replace(newfont);
            }

The issue we have is that fonts array is empty and there is no setters for fonts except replacement.
Could you please clarify how we can set fonts?
Thanks

MohaMM
 
Posts: 6
Joined: Mon Jun 19, 2017 9:37 am

Thu Aug 09, 2018 9:59 am

Hello,

Thanks for your inquiry.
I have noticed that the result of getting the font of Pdf generated by our Spire.Xls is empty. I will posted the issue to our dev team for investigations. To help us analyze your file accurately, please write the Pdf stream to a file and share us with the Pdf file (you could send it to support@e-iceblue.com). Thanks in advance.

Sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 987
Joined: Tue Sep 27, 2016 1:06 am

Thu Aug 23, 2018 9:19 am

Please see pdf example attached
Attachments
ValueCollectionSample.zip
(19.84 KiB) Downloaded 109 times

MohaMM
 
Posts: 6
Joined: Mon Jun 19, 2017 9:37 am

Thu Aug 23, 2018 10:48 am

Hi,

Thanks for your sharing.
Your file has been submitted to our Dev team. We will keep you informed about the progress.

Sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 987
Joined: Tue Sep 27, 2016 1:06 am

Mon Sep 17, 2018 10:22 am

Hello,
Do you have any ideas how to change fonts? Any workarounds?
Thanks

MohaMM
 
Posts: 6
Joined: Mon Jun 19, 2017 9:37 am

Tue Sep 18, 2018 9:30 am

Hello,

Our Dev team did a repair and the font in your Pdf file can be obtained now, but the font can't be replaced. Our Dev team is making efforts to do analyses. If there is any good news, we will let you know. Sorry for this delay and thanks for your understanding.

Sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 987
Joined: Tue Sep 27, 2016 1:06 am

Thu Sep 20, 2018 10:25 am

Dear Andrei,

I just got news from our Dev team that the font in your file is embedded font, which has corresponding glyph ID number, if we force to replace the embedded font with another font, it is most likely to cause mess of characters and ID number that can't be handled. Hence, replacing the embedded font is unreachable in our Spire.PDF. Sorry for that. If you have other question, welcome to write back.

Sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 987
Joined: Tue Sep 27, 2016 1:06 am

Return to Spire.XLS