We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

XLS To PDF Conversion

I’m using aspose pdf version 3.9.0.0 and am having a few issues converting an xls file to pdf. When the conversion is run on my local machine running windows 8, the conversion runs as expected, however when it is run on Windows Server 2003 R2 it appears that the conversion is increasing the width of the columns, as instead of taking up 2 pages, it takes up 4. (See attached files)

The code used to convert the file to pdf is shown below. Could anyone let me know as to why the conversion performs differently on a server, and a local machine? Thanks.

protected void ConvertToPdf(Workbook workbook, string filename) {

// Save the document in the Aspose.Pdf.Xml format.
string xmlFile = filename.Replace(".xls", “.xml”);

MemoryStream stream = new MemoryStream();
workbook.Save(stream, FileFormatType.AsposePdf);

// Read the document into Aspose.Pdf
Aspose.Pdf.Pdf pdf = new Aspose.Pdf.Pdf();
pdf.BindXML(stream, null);
pdf.IsImagesInXmlDeleteNeeded = true;
pdf.IsTruetypeFontMapCached = true;
pdf.TruetypeFontMapPath = Path.GetTempPath();

string pdfFileName = filename.Replace(".xls", “.pdf”);
pdf.Save(pdfFileName);

try {
stream.Close();
}
catch {
}
}

Hi,


Well, in newer versions, you do not need to use Aspose.Pdf to convert the intermediate XML file created by Aspose.Cells to render PDF file now. Please use only Aspose.Cells for .NET e.g v7.4.2.x to convert to PDF from Excel file directly, see the topic here for reference:
http://www.aspose.com/docs/display/cellsnet/Converting+to+PDF+Files
Moreover, the direct approach is more efficient and reliable.

I have tested converting your attached template file to PDF and it works fine on my environment. Please try it and let us know your result on the server. For your information, your approach has been obsoleted some months ago already, so we won’t be supporting or enhancing this approach anymore now.

Also, Please find attached and try our latest fix/version: Aspose.Cells for .NET v7.4.2.1

Thank you.