Convert .numbers to pdf, pages split very strange

I have a .numbers file converted to pdf, the pdf looked like this,

image.jpg (343.5 KB)

are there any parameters I can use to make the pdf more user friendly

@guguzzz,
There are two suggestions to make your PDF output look more friendly.

  1. If you can accept not dividing the content into multiple pages. As an alternative, you can output a worksheet to a whole page. Please refer to the following document.
    Render One PDF Page Per Excel Worksheet - Excel to PDF Conversion|Documentation

  2. You can also change the pagination position by setting the paper size. Please refer to the following document.
    Setting Page Options|Documentation

Would you like to provide the sample file? We will check it soon.

Thank you! I choose to set a proper paper size. Are there any way to get the width of numbers file, so I can set paper size accordingly.

@guguzzz,
You can refer to the following code to get the width of the worksheet, the paper size, and the pagination range under the specified paper.

Workbook wb = new Workbook(filePath + "sample.xlsx");

Worksheet sheet = wb.Worksheets[0];
Cells cells = sheet.Cells;
//get worksheet width, in units of inches
double totalWidth = 0.0d;
int maxDataColumn = sheet.Cells.MaxDataColumn;
for (int i = 0; i <= maxDataColumn; i++)
{
  totalWidth += sheet.Cells.GetColumnWidthInch(i);
}
//set paper size type
sheet.PageSetup.PaperSize = PaperSizeType.PaperA3;
//get pager size
Console.WriteLine("PaperA3 size: " + sheet.PageSetup.PaperWidth + "x" + sheet.PageSetup.PaperHeight);

//get the pagination range
CellArea[] areas = sheet.GetPrintingPageBreaks(new ImageOrPrintOptions());

Hope helps a bit.

1 Like