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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

ExcelToPdfConverter using the wrong fonts

Thread ID:

Created:

Updated:

Platform:

Replies:

128690 Feb 6,2017 11:25 AM UTC Feb 9,2017 07:20 AM UTC WinForms 5
loading
Tags: XlsIO
Valerio Santinelli
Asked On February 6, 2017 11:25 AM UTC

I am currently using ExcelToPdfConverter to convert an XLSX document to a PDF. 

I first create the XLSX document and then convert it to PDF with the following code:

var converter = new ExcelToPdfConverter(workbook);

//Intialize the PDFDocument

var pdfDoc = new PdfDocument();

//Intialize the ExcelToPdfconverterSettings

var settings = new ExcelToPdfConverterSettings();

//Assign the PDFDocument to the TemplateDocument property of ExcelToPdfConverterSettings

settings.TemplateDocument = pdfDoc;

settings.EmbedFonts = true;

//Convert Excel Document into PDF document

pdfDoc = converter.Convert(settings);

//Save the pdf file

pdfDoc.Save(PDFFullPath);


The resulting XLSX is correct and it looks like it should. The converted PDF isn't correct though. It's just like it's using wrong fonts and, as a consequence, those rows that have been autofitted with AutofitRow get truncated. Has anyone else had this issue before?
Is there any way to tell the PDFConverter to use the correct fonts? (Please note that I'm using Arial and Calibri and they're both installed in the system's fonts)

Regards.


Abirami Varadharajan [Syncfusion]
Replied On February 7, 2017 12:45 PM UTC

Hi Valerio, 
 
We are unable to reproduce issue. We have shared the sample for your reference and the sample can be downloaded from the following location. 
 
 
Kindly modify and share us the issue reproducing sample. This will be helpful for us to provide prompt solution at the earliest. 
 
Regards, 
Abirami. 


Valerio Santinelli
Replied On February 7, 2017 02:29 PM UTC

Here's the project that reproduce the issue.

Please feel free to ask me if you need any information.
Thanks in advance!


Attachment: XlsIO_Samplesantinelli_dc3e424f.zip

Abirami Varadharajan [Syncfusion]
Replied On February 8, 2017 01:11 PM UTC

Hi Valerio, 
 
Thank you for sharing the sample. 
 
We have analyzed your code and found a usage issue, where you are trying to autofit 5th row instead of 6th. Here, the AutofitRow is one based index. 
 
Kindly refer below documentation to know more about AutofitRow and AutofitColumn. 
 
 
We have modified your sample to resolve the issue, which can be downloaded from the following link. 
 
 
However, after making these changes we found an issue with Cell text is truncated while converting Excel document to PDF.  A support incident to track the status of this issue has been created under your account. Please log on to our support website to check for further updates.  
   
  
Regards, 
Abirami. 


Valerio Santinelli
Replied On February 8, 2017 01:26 PM UTC

Yes, you're right ,I probably made that mistake while copy and pasting code from my other project. But if you correct that you can still see that the autofit is wrong. You might have to play a bit with the text length to find a row that gets truncated.

Abirami Varadharajan [Syncfusion]
Replied On February 9, 2017 07:20 AM UTC

Hi Valerio, 
 
Thank you for updating us. 
 
As informed earlier, after modifying the sample we encountered an issue with Cell text is truncated while converting Excel document to PDF.  A support incident to track the status of this issue has been created under your account. Please log on to our support website to check for further updates.   
    
   
Regards,  
Abirami.  


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

;