Excel to PDF/a format through Aspose.PDF?

Hi, guys!

I’m trying to convert the Aspose.Cell demo file:
…Program Files\Aspose\Aspose.Cells for .NET\Demos\file\DateAndTime.xls.

To a PDF/A compliant PDF with this code:

public void ConvertExcelToPDF(MemoryStream AWorkbookStream, MemoryStream APDFResultStream)
{
Workbook wb = new Workbook();
wb.LoadData(AWorkbookStream);
wb.Save(APDFResultStream, FileFormatType.AsposePdf);
Aspose.Pdf.Pdf LPDF = new Pdf();
LPDF.BindXML(APDFResultStream, null);
LPDF.Conformance = PdfConformance.PdfA1A;
LPDF.SetUnicode();
LPDF.Save(APDFResultStream);
}

When I call LPDF.Save(APDFResultStream) i get this exception:

"…System.Exception: Font name :宋体 Bold is not found , PdfConformance.PdfA currently only support TrueType Font . ."

The font in the xls file is Arial, by the way. I’ve tried to set it to Times New Roman too, still the same exception.

What am I doing wrong? Are there any limitations to the PDF/A compliance that stops me from doing it this way?

Thanx!

Hello Sven,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for considering Aspose.

Aspose.Pdf also has its own restrictions when generating PDF/A documents. It only supports the TrueType font and I'm sorry to inform you that it does not support Type1 fonts. For more information, please visit How to create PDF/A-1 with Aspose.Pdf

As far as I can see from the error message, there is some custom font used in the excel worksheet and its not installed over the machine performing the conversion process. Can you please share the source excel file (and custom font if its being used), so that we can test the scenario at our end.

We apologize for your inconvenience.

Hi!
Thanx for rapid response!

Here’s the xsl-file I’m testing with…
I will check out the link you posted.
I appreciate the help, thanx!

Hi,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

I've tested the scenario and I'm unable to notice the issue. In my case the resultant PDF is being generated without any issue. Please take a look over the resultant PDF document in attachment.

I've used Aspose.Pdf for .NET 4.1.1 and Aspose.Cells for .NET 4.8.1.4 for the following code snippet.

[C#]

Workbook wb = new Workbook();
wb.Open(@"d:/pdftest/DateAndTime.xls");
wb.Save(@"d:/pdftest/APDFResultStream.xml", FileFormatType.AsposePdf);

Aspose.Pdf.Pdf LPDF = new Pdf();
LPDF.BindXML(@"d:/pdftest/APDFResultStream.xml", null);
LPDF.Conformance = PdfConformance.PdfA1A;
LPDF.SetUnicode();
LPDF.Save(@"d:/pdftest/DateAndTime.pdf");

I see, thanx!

I’ve uninstalled my Aspose.Total and installed the new one from your site containing Setup.exe version 1.3.3.0. That setup installed Aspose.Cells.dll v. 4.8.2.0, and Aspose.PDF.dll v. 4.1.0.0. Could this be my problem maybe? Wrong dlls…

Hi,

In recent versions, some of the issues have been fixed. I'm not sure if this issue is also fixed in these versions or not but, in case you still face any problem while using them, please feel free to contact.

Thanx for great help! Much appreciated!