Hello,
We’ve got some interesting behaviour using GroupDocs.Conversion 21.2.0.
We are trying convert XLSX document with Letter page size (21,59sm x 27,94sm) to PDF, and actually each cell has wrong scale and placement.
image.png (32.8 KB)
We expected to have converted document, that looks like in Excel print preview menu.
image.png (14.4 KB)
The problem can be reproduced with Groupdocs.Conversions Life Demo.
We’ve spent some time playing with different combinations of OnePagePerSheet
in SpreadsheetLoadOptions
and Width
/ Height
in
PdfConvertOptions
, but PDF just change its global scale and still have wrong cells alignment.
We didn’t noticed this kind of problem with A4 page sized documents.
Document to reproduce the problem:
AttacСчет 209.zip (11.0 KB)
Here is the code snippet we use:
public byte[] SaveAsPdf(string fileName, byte[] content, bool isSplitUnstructured = false)
{
if (content.Length > _maxFileSize)
{
throw new EdsException("ER-10540", Errors.ER10540, fileName);
}
var converterOptions = new SpreadsheetLoadOptions
{
OnePagePerSheet = isSplitUnstructured,
OptimizePdfSize = true,
};
var pdfOptions = new PdfConvertOptions
{
PdfOptions = new PdfOptions
{
OptimizationOptions = new PdfOptimizationOptions
{
RemoveUnusedObjects = true,
RemoveUnusedStreams = true,
},
},
};
using (var outputStream = new MemoryStream())
using (var inputStream = new MemoryStream(content))
using (var converter = new Converter(() => inputStream, () => converterOptions))
{
converter.Convert(() => outputStream, pdfOptions);
return outputStream.ToArray();
}
}