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

Free Support Forum - aspose.com

PDF generated by Aspose.Cells has extra pagebreak

Hello.

I have an issue with converting XLS to PDF.

When I save input.xls (attached to this post) as PDF by Excel 2010, the generated PDF has only one page.
However, when I convert the XLS to PDF by Aspose.Cells, the generated PDF has pagebreak.

It seems to be occured floating point error to calculating cells widths.
Would you please test the attachment file?

The version of Aspose.Cells I use is 7.4.3.0.


I attached three files;
input.xls (input XLS)
result.pdf (PDF generated by the following code)
expected.pdf (PDF generated by Excel 2010)

And here is my C# code.

private void SaveToPdf(Workbook book, FileInfo fi){
PdfSaveOptions options = new PdfSaveOptions();
options.DefaultFont = "MS Pゴシック";
book.Save(fi.FullName, options);
}


Thank you.

Hi,

Thanks for your posting and using Aspose.Cells.

Please download and try the latest version: Aspose.Cells
for .NET v7.4.3.3
It works fine.

We have tested your issue with the following code. We have attached the output pdf file for your reference.

C#


string filePath = @“F:\Shak-Data-RW\Downloads\input.xls”;


Workbook book = new Workbook(filePath);


PdfSaveOptions options = new PdfSaveOptions();

options.DefaultFont = “MS Pゴシック”;

book.Save(filePath+".out.pdf", options);

Hi,

Please download and try our latest fix/version: Aspose.Cells for .NET v7.4.3.3 it works fine as I tested converting your template file to PDF.

C#
string filePath = @"e:\test2\Input.xlx";

Workbook wb = new Workbook(filePath);
wb.Save("Inputout1.pdf");

I have attached the output file here for your reference.

Thank you.

Thank you.

Your Aspose.Cells for .NET v7.4.3.3 fixed the problem of page width.
But I’ve found that there still is a problem about page height .

Will you check the attached xls file ?
(MS Excel converts it as one page pdf, but Aspose.Cells inserts an unexpected page break.)

Thanks.

Hi,

Thanks for your posting and using Aspose.Cells for .NET.

MS-Excel converts the source file into 4 pages pdf as shown in the MS-Excel Print Preview. I have attached the MS-Excel generated pdf for your reference.

Also, I have attached the output pdf generated with Aspose.Cells.

Hi

MS Excel converts the same worksheet into pdfs with
different number of pages depending on the selected printer.

Maybe each printer has its own printable area and
that physical constrints overrides the margin settings of the document.
It is strange but that’s Microsofts’ .

This worksheet has a somewhat narrow margin setting .
Will you try to convert the attached xls
with a printer with wide printable area (less margin) ?
Then I think you’ll get a one page pdf .

I think Aspose.Cells’s PDF conversion should ignore printer selection and
depend only on the document’s paper size and margin settings.
But I wonder if the default printer settings affects the conversion.

Thank you.

Hi,

Thanks for your posting and using Aspose.Cells for .NET.

Please try the following code to get rid of extra page. We have also attached the output pdf for your reference.

C#


string filePath = @“F:\Shak-Data-RW\Downloads\test.xls”;


Workbook workbook = new Workbook(filePath);

PdfSaveOptions opts = new PdfSaveOptions();


opts.OnePagePerSheet = true;


workbook.Save(filePath + “.myout.pdf”, opts);



Hi,

>
> opts.OnePagePerSheet = true;
>

Nooooo.
I’m sorry that onePagePerSheet is not the solution.

Some xls have more than two pages.
If microsoft excel convert a worksheet to 1 page pdf,
it should be converted to a 1 page pdf by Aspose.Cells.
If Excel convert another worksheet to 2 page pdf,
it should be converted to a 2 page pdf by Aspose.Cells.
My issue is that number of PDF pages generated by Aspose
is sometimes more than that of PDF generated by Excel.

> MS-Excel converts the source file into 4 pages pdf
> as shown in the
MS-Excel Print Preview.
> I have attached the MS-Excel generated pdf for
your reference.

I’ve found that when Excel converts a worksheet to PDF,
the pagebreak is affected by two factors,
first the current document’s page settings and
second the current printer’s page settings.

Maybe your default printer has smaller paper size than mine.
Please use ISO 216 A4 size(297mm*210mm) printer settings with
top/left/bottom/right margin = 5mm/5mm/5mm/5mm. which is the
same with the document’s page settings.

Hi,

Thanks for your posting and using Aspose.Cells for .NET.

Please elaborate your issue more and highlight the issues in a screenshot with red circles. It will help us look into your issue more precisely and we will be able to help you more. Aspose.Cells generate pdf as MS-Excel print preview displays it.

I’ve made a new Post with more simple sample input xls.



This message thread may be closed .

Thank you.

Hi,

Thanks for your posting and using Aspose.Cells.

We have closed this thread. Please refer to your other thread for a reply.


Hi, Shakeel.

It worked perfectly.

Thank you for your hard work!

Hi,



Thanks for your feedback and using Aspose.Cells.



It is good to know that your issue is resolved with the latest fix. Let
us know if you encounter any other issue, we will be glad to look into
it and help you further.