How to Start Convert PDF Work with PDF Modules PDF Document PDF Pages Text Image Graph & Path Annotation, Markup & Drawing Redaction Security Digital Signature Forms Watermark Bookmark Link File Attachment File Metadata Printing Work with Other SDKs Barcode read Barcode create OCR Twain

PDF Converter VB.NET Library
How to convert Excel to PDF in vb.net without Interop, Office installed?


VB.NET Tutorial for Converting PDF from Microsoft Office Excel Spreadsheet Using VB.NET Demo Code





In this VB.NET tutorial, you learn how to convert, export Microsoft Excel to PDF files in VB.NET class.

  • Convert Excel (.xlsx) to PDF file
  • No Microsoft Office or interop installed
  • Convert multiple Excel to PDF files
  • Easy to enable conversion in .NET Windows Forms, WPF, Console application

How to convert Excel to PDF file without Interop, Office using VB.NET

  1. Download XDoc.PDF Excel Converter VB.NET library
  2. Install VB library to convert Microsoft Excel to PDF file
  3. Step by Step Tutorial










  • Best Visual Studio .NET Microsoft Office Excel to adobe PDF file converter control, which able to be used integrated in .NET WinForms and ASP.NET project
  • Support multiple formats, includes xls, xlsx, etc
  • Turn all Excel spreadsheet into high quality PDF without losing formatting in VB.NET
  • Support .NET WinForms, ASP.NET MVC in IIS, ASP.NET Ajax, Azure cloud service, DNN (DotNetNuke), SharePoint
  • Create fillable and editable PDF documents from Excel in Visual Basic .NET class
  • Create searchable and scanned PDF files from Excel in VB.NET Framework
  • Convert to PDF with embedded fonts or without original fonts fast
  • Professional .NET PDF converter component for batch conversion
  • Merge all Excel sheets to one PDF file in VB.NET
  • Change Excel hyperlink to PDF hyperlink and bookmark
  • Export PDF from Excel with cell border or no border
  • Convert Excel to PDF document free online without email
  • Source code and library for quick evaluation in VB.NET class






VB.NET Sample Code: Convert Excel to PDF in VB.NET Project


Following is VB.NET demo code for Excel(.xlsx/.xlsm/.xltx) to PDF conversion.


Dim inputFilePath As String = "C:\1.xlsx"
Dim outputFilePath As String = "C:\Output.pdf"

' Load a Excel (.xlsx) document.
Dim doc As XLSXDocument = New XLSXDocument(inputFilePath)

' Convert it to PDF document.
doc.ConvertToDocument(DocumentType.PDF, outputFilePath)




Following is VB.NET demo code for Excel (.xls) to PDF conversion.




Dim inputFilePath As String = "C:\1.xls"
Dim outputFilePath As String = "C:\Output.pdf"

' Load a Excel(.xls) document.
Dim doc As XLSDocument = New XLSDocument(inputFilePath)

' Convert it to PDF document.
doc.ConvertToDocument(DocumentType.PDF, outputFilePath)






VB.NET Convert two or multiple Excel files to PDF (batch convert)


Following is VB.NET demo code for Excel(.xlsx/.xlsm/.xltx) to PDF conversion.


Dim inputDirectory As String = "C:\input\"
Dim outputDirectory As String = "C:\Output\"
Dim files() As String = Directory.GetFiles(inputDirectory, "*.xlsx")

' convert excel document to pdf one by one.
For Each filePath As String In  files
       Dim doc As XLSXDocument = New XLSXDocument(filePath)
       Dim startIdx As Integer = filePath.LastIndexOf("\")
       Dim endIdx As Integer = filePath.LastIndexOf(".")
       Dim docName As String = filePath.SubString(startIdx + 1, endIdx - startIdx - 1)
       ' Convert it to PDF document.
       doc.ConvertToDocument(DocumentType.PDF, outputDirectory + docName + ".pdf")
Next


Following is VB.NET demo code for Excel(.xls) to PDF conversion.


Dim inputDirectory As String = "C:\input\"
Dim outputDirectory As String = "C:\Output\"
Dim files() As String = Directory.GetFiles(inputDirectory, "*.xls")

' convert excel document to pdf one by one.
For Each filePath As String In  files
       Dim doc As XLSDocument = New XLSDocument(filePath)
       Dim startIdx As Integer = filePath.LastIndexOf("\")
       Dim endIdx As Integer = filePath.LastIndexOf(".")
       Dim docName As String = filePath.SubString(startIdx + 1, endIdx - startIdx - 1)
       ' Convert it to PDF document.
       doc.ConvertToDocument(DocumentType.PDF, outputDirectory + docName + ".pdf")
Next






VB.NET Convert two or multiple Excel files to one PDF


Following is VB.NET demo code for Excel(.xlsx/.xlsm/.xltx) to PDF conversion.


Dim files() As String = { "C:\demo1.xlsx", "C:\demo2.xlsx", "C:\demo3.xlsx" }
Dim outputFilePath As String = "C:\output.pdf"
Dim streams As List(Of MemoryStream) = New List(Of MemoryStream)()
For Each filePath As String In  files
       Dim doc As XLSXDocument = New XLSXDocument(filePath)
       Dim outputStream As MemoryStream = New MemoryStream()
       ' Convert it to PDF document.
       doc.ConvertToDocument(DocumentType.PDF, outputStream)
       streams.Add(outputStream)
Next
PDFDocument.CombineDocument(streams, outputFilePath)


Following is VB.NET demo code for Excel(.xls) to PDF conversion.


Dim files() As String = { "C:\demo1.xls", "C:\demo2.xls", "C:\demo3.xls" }
Dim outputFilePath As String = "C:\output.pdf"
Dim streams As List(Of MemoryStream) = New List(Of MemoryStream)()
For Each filePath As String In  files
       Dim doc As XLSDocument = New XLSDocument(filePath)
       Dim outputStream As MemoryStream = New MemoryStream()
       ' Convert it to PDF document.
       doc.ConvertToDocument(DocumentType.PDF, outputStream)
       streams.Add(outputStream)
Next
PDFDocument.CombineDocument(streams, outputFilePath)






VB.NET insert excel file into pdf document, and create a new PDF file


Following is VB.NET demo code to Insert Excel(.xlsx/.xlsm/.xltx) to PDF at specific location.


Dim filePath As String = "C:\demo.xlsx"
Dim doc As XLSXDocument = New XLSXDocument(filePath)
Dim stream As MemoryStream = New MemoryStream()
doc.ConvertToDocument(DocumentType.PDF, stream)
Dim pdf As PDFDocument = New PDFDocument(stream)
Dim pageCount As Integer = pdf.GetPageCount()
Dim pages List(Of BasePage) = New List(Of BasePage)() 
For i As Integer = 0 To pageCount - 1
       pages.Add(pdf.GetPage(i))
Next
Dim outputPdf As String = "C:\output.pdf"
Dim desDoc As PDFDocument = New PDFDocument(outputPdf)
Dim insertLocation As Integer = 2
desDoc.InsertPages(pages.ToArray(), insertLocation)
desDoc.Save("C:\desDocument.pdf")


Following is VB.NET demo code to Insert Excel(.xls) to PDF at specific location.


Dim filePath As String = "C:\demo.xls"
Dim doc As XLSDocument = New XLSDocument(filePath)
Dim stream As MemoryStream = New MemoryStream()
doc.ConvertToDocument(DocumentType.PDF, stream)
Dim pdf As PDFDocument = New PDFDocument(stream)
Dim pageCount As Integer = pdf.GetPageCount()
Dim pages List(Of BasePage) = New List(Of BasePage)() 
For i As Integer = 0 To pageCount - 1
       pages.Add(pdf.GetPage(i))
Next
Dim outputPdf As String = "C:\demo.pdf"
Dim desDoc As PDFDocument = New PDFDocument(outputPdf)
Dim insertLocation As Integer = 2
desDoc.InsertPages(pages.ToArray(), insertLocation)
desDoc.Save("C:\desDocument.pdf")