Tech Specs
How-to VB.NET
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

VB.NET PDF - Create PDF from Microsoft Office Word in VB.NET

VB.NET Tutorial for Creating PDF document from MS Office Word in Visual Basic .NET Class

  • Best Microsoft Office Word to adobe PDF file converter SDK for VB.NET class
  • Support .NET WinForms, ASP.NET MVC in IIS, ASP.NET Ajax, Azure cloud service, DNN (DotNetNuke), SharePoint
  • Export all Word text and image content into high quality PDF without losing formatting
  • Create PDF files from both DOC and DOCX formats in .NET WinForms and ASPX webpage
  • Convert multiple pages Word to fillable and editable PDF documents in Visual Studio .NET
  • Professional VB.NET PDF batch conversion control
  • Easy to create searchable and scanned PDF files from Word in VB.NET
  • Convert Word to PDF file with embedded fonts or without original fonts fast
  • Ability to get word count of PDF pages in VB.NET
  • Change Word hyperlink to PDF hyperlink and bookmark
  • Free online Word to PDF converter without email
  • Quick integrate online source code to VB.NET class program
  • Free library and components built in .NET framework

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

Following is VB.NET demo code for Word (.docx/.dotm/.docm/.dotx) to PDF conversion.

Dim inputFilePath As String = "C:\1.docx"
Dim outputFilePath As String = "C:\Output.pdf"
Dim doc As DOCXDocument = New DOCXDocument(inputFilePath)
doc.ConvertToDocument(DocumentType.PDF, outputFilePath)

VB.NET: convert Word (.docx) to Adobe PDF with outline support

When you convert Office Word (.docx) document to PDF file, you can generate PDF outline (bookmark) from Word document heading content or bookmarks.

There are four options for OutlineMode:

  1. None: Do not create any outline entry.

  2. ByOutlineLevel: Create outline entries by paragraph's outline level.

  3. ByHeading: Create outline entries by paragraph's style IDs (heading styles).

  4. ByBookmark: Create outline entries by bookmarks.

Dim inputFilePath As String = "C:\1.docx"
Dim outputFilePath As String = "C:\output.pdf"

Dim doc As DOCXDocument = New DOCXDocument(inputFilePath)
' Set strategy used to create outline entries for the document.
' Default: OutlineMode.ByOutlineLevel
doc.OutlineSetting.Mode = OutlineMode.ByHeading
' Set the maximum level of entires in the outline.
' Valid range: 1 ~ 9; default value: 3
doc.OutlineSetting.MaxLevel = 2

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

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

Convert MS Office Word 2007 (.docx) file to PDF using single thread

            String inputDirectory = @"C:\input\";
            String outputDirectory = @"C:\output\";
            String[] files = Directory.GetFiles(inputDirectory, "*.docx");
            foreach (String filePath in files)
                int startIdx = filePath.LastIndexOf("\\");
                int endIdx = filePath.LastIndexOf(".");
                String docName = filePath.Substring(startIdx + 1, endIdx - startIdx - 1);
                DOCXDocument doc = new DOCXDocument(filePath);
                doc.ConvertToDocument(DocumentType.PDF, outputDirectory + docName + ".pdf");