How can I convert an excel-file to a PDF-file with pages of A4-size?
Can you supply me with a c# code snippet
Hi,
Please try the following code.
C#
string path = @“F:\source.xlsx”;
Workbook workbook = new Workbook(path);
workbook.Worksheets[0].PageSetup.PaperSize = PaperSizeType.PaperA4;
workbook.Save(path + “.out.pdf”);
Hi,
I think you may try to use PageSetup options to set the paper size to A2 and then convert your workbook to PDF, see the document for reference:
Sample code:
//Instantiating a workboo and open an existing file
Workbook workbook = new Workbook("Book1.xls");
//Accessing the first worksheet in the Excel file
Worksheet worksheet = workbook.Worksheets[0];
//Setting the paper size to A4
worksheet.PageSetup.PaperSize = PaperSizeType.PaperA4;
//Save the PDF file
workbook.Save("outBook1.pdf");