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

Free Support Forum - aspose.com

PrintOption when converting excel to pdf file

Hi,

When I generate the excel file, I set some PrintOption like below:

1. page size=Legal

2. page orientation=Landscape

So if I convert the excel file to pdf, will these printoptions also be saved? I have a test and seems like yes, but I am not sure if it's really like this or not

Hi Jimmy,

Thanks for your posting and using Aspose.Cells.

Yes, if you will apply these print options and save into pdf, these will be visible in the output PDF and when you will save it as Excel file, then these options will also be visible in the output Excel file.

Let us know if you have any other question, we will look into it and help you asap.

when I open the pdf file, looks like the print option was keeped. But when I click the Print Setup button on the pdf file, it doesn't show the correct way. Can you help me to understand? Below is my code:

PageSetup ps = DestinationSheet.PageSetup;
ps.PrintArea = DestinationSheet.Cells[DestinationSheet.Cells.MinDataRow, DestinationSheet.Cells.MinDataColumn].Name + ":" + DestinationSheet.Cells[DestinationSheet.Cells.MaxDataRow, DestinationSheet.Cells.MaxDataColumn].Name;
ps.CenterHorizontally = true;
ps.Order = PrintOrderType.DownThenOver;
ps.Orientation = PageOrientationType.Landscape;
ps.PaperSize = PaperSizeType.PaperLegal;
FileName = new FileInfo(wb.FileName).DirectoryName + @"\" + FileName + ".pdf";
PdfSaveOptions PdfSaveOptions = new PdfSaveOptions();
PdfSaveOptions.OnePagePerSheet = true;
wbs.Save(FileName, PdfSaveOptions);

Hi Jimmy,

Thanks for using Aspose.Cells.

These Print Options will render the PDF same as they are shown in the MS-Excel Print Preview. These print options do not affect the print options of pdf as shown in Adobe Acrobat.

Kindly check your Excel file’s print preview in MS-Excel and then compare it with the rendered pdf, you will see, it matches with Excel Print Preview.