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. Image for the cookie policy date

ExcelToPdfConverter using the wrong fonts

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.


5 Replies

AV Abirami Varadharajan Syncfusion Team 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. 



VS Valerio Santinelli 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


AV Abirami Varadharajan Syncfusion Team 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. 



VS Valerio Santinelli 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.


AV Abirami Varadharajan Syncfusion Team 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.  


Loader.
Up arrow icon