You may please give a try to the following sample code and provide your feedback.
var workbook = new Workbook(@"AutoFilterRemoval\AutoFilter.xlsx");
var outputPath = @"AutoFilterRemoval\output.pdf";
foreach (var worksheet in workbook.Worksheets)
{
worksheet.RemoveAutoFilter();
worksheet.Cells.UnhideRows(0, worksheet.Cells.Rows.Count, -1);
}
var saveOptions = new Aspose.Cells.PdfSaveOptions(Aspose.Cells.SaveFormat.Pdf);
workbook.Save(outputPath, saveOptions);
Quick follow up question. I was working with support on using worksheet.Cells.Columns.Count and I was having issues and in a similar case they had me use worksheet.Cells.MaxColumns +1. Would it be safer to use worksheet.Cells.MaxRow + 1 in this case?