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

Free Support Forum - groupdocs.com

Wrong content placement while converting XLSX with Letter page size to PDF

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();
	}
}

@Grigory_Divotchenko

We’re investigating this scenario. Your investigation ticket ID is CONVERSIONNET-4623. We’ll notify you in case of any update.

Any updates? We are still having production issues with that

@Grigory_Divotchenko

We are still investigating this issue. You’ll be notified about the outcomes ASAP.

@Grigory_Divotchenko

Please use the following code and let us know if it resolves the issue:

const string source = "f209.xlsx";
using (var converter = new Converter(source, () => new SpreadsheetLoadOptions
{
    SkipEmptyRowsAndColumns = false,

}))
{
    var options = new PdfConvertOptions();
    converter.Convert("converted.pdf", options);
}

The issues you have found earlier (filed as CONVERSIONNET-4623) have been fixed in this update. This message was posted using Bugs notification tool by nikola.yankov