Saves a Workbook as a PDF file at a specified file path.

 public static void SavePdf(Boolean onlySelectedWorksheets, String filePath)
Public Static Sub SavePdf(ByVal onlySelectedWorksheets As Boolean, ByVal filePath As String)

If true, only selected worksheets will be saved to the PDF. If false, all visible worksheets will be saved to the PDF.

A string representing the filepath you would like to save the PDF to.

 

If there is a problem creating, opening, or writing to the file specified, or reading from the Workbook object.

           ExcelApplication xla = new ExcelApplication();
           Workbook WB= xla.Create(FileFormat.Xlsx);
           WB.SavePdf(false, "Path/filename.pdf");
	   Dim oExcelApp As New ExcelApplication()           
       Dim wb As Workbook = oExcelApp.Create(FileFormat.Xlsx)       
       wb.SavePdf(False, "Path/filename.pdf"))