We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Printing PDF from RDLC changes font

Thread ID:

Created:

Updated:

Platform:

Replies:

124904 Jul 7,2016 03:13 PM UTC Jul 11,2016 09:58 AM UTC UWP 3
loading
Tags: SfPdfViewer
Michael Woolsey
Asked On July 7, 2016 03:13 PM UTC

Hello,

 

I am printing from a RDLC report and the font selected, Segoe UI, is actually printing in Times New Roman.  I've attached some screenshots to illustrate the issue.

 

The pdfViewer variable is a SfPdfViewerControl object.

 

This is the code I use to generate the PDF:

            Assembly assembly = typeof(ResultsPage).GetTypeInfo().Assembly;

            Stream reportStream = assembly.GetManifestResourceStream("Report.rdlc");

            ReportWriter writer = new ReportWriter();

            writer.ReportProcessingMode = Syncfusion.ReportWriter.ProcessingMode.Local;

            writer.DataSources.Clear();

            writer.DataSources.Add(new ReportDataSource { Name = "Data", Value = PopulateData() });

            writer.LoadReport(reportStream);

 

            MemoryStream stream = new MemoryStream();

            writer.Save(stream, WriterFormat.PDF);

 

            // A zero length stream just causes the LoadDocument to hang.

            if (stream.Length > 0)

            {

                await pdfViewer.LoadDocumentAsync(new PdfLoadedDocument(stream));

            }

 

This is the code I use to print the pdf:

            pdfViewer.Print();

 

Any idea how to get my print outs to actually print in the Segoe UI font I have selected instead of Times New Roman?

 

Thank you,

Michael

Attachment: Issue_Files_b5a312f5.zip

Praveena P [Syncfusion]
Replied On July 8, 2016 12:16 PM UTC

Hi Michael, 
 
As UWP platform does not provide access to the installed font data in the system, Unicode fonts such as “Segoe UI” cannot be embedded directly in exported PDF document. Hence need to add required Unicode font files as an embedded resource to the document for the display and print of text using the appropriate font. The Unicode font streams need to be added to the Report Writer’s PDF Fonts collection to export report as PDF format with Unicode fonts as shown in the below code snippet.  

writer.PDFFonts = new Dictionary<stringStream>(StringComparer.OrdinalIgnoreCase);  
writer.PDFFonts.Add("Segoe UI", assembly.GetManifestResourceStream("UWPwriterSample.Assets.Segoe_UI.ttf"));  
 
Please find the sample attached in the below link which illustrates how to add required Unicode font files as an embedded resource to the application. 
 
And also attached printed output document in OXPS format which contains Segoe UI font printed using PdfViewer and it displays as Segoe UI font. 
 
Please let me know if you have any concerns. 
Regards, 
Praveena 
 


Michael Woolsey
Replied On July 8, 2016 02:07 PM UTC

Hello, 

That works well!

Thank you,
Michael

Praveena P [Syncfusion]
Replied On July 11, 2016 09:58 AM UTC

Hi Michael , 
We are glad to know that your issue has been resolved. Please let us know if you need any further assistance.    
Regards, 
Praveena 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;