Hi,
Well, I think for your case, you just remove the existing print area settings, it will work fine. When you remove the print area settings, MS Excel would only print that area in the sheet which has data in it, so the extra pages won’t be rendered in the Pdf format.
See the following sample code:
string testWorkbookFilePath= @“your path” ;
string resultingPdfFilePath = @“your path” ;
Workbook
testWorkbook = new Workbook();
testWorkbook.Open(testWorkbookFilePath);
MemoryStream pdfStream = new MemoryStream();
foreach (Worksheet ws in testWorkbook.Worksheets)
{
ws.PageSetup.PrintArea = “”;
}
testWorkbook.Save(pdfStream, FileFormatType.Pdf);
byte[] pdfByteArray = new byte[pdfStream.Length];
pdfByteArray
= pdfStream.ToArray();
FileStream pdfFile = new FileStream(resultingPdfFilePath,
FileMode.Create);
pdfFile.Write(pdfByteArray, 0,
pdfByteArray.Length);
pdfFile.Close();
pdfStream.Close();
Also as I told you earlier you can specify Page Setup/Printing options if you want, please see the document:
http://www.aspose.com/documentation/.net-components/aspose.cells-for-.net/setting-print-options.html
Thank you.