Word .NET > Tutorial > Export Word document to PDF

The following example shows you how to export a Word document to PDF format. The SaveAsPdf method preserves text formatting, paragraphs, tables, hyperlinks, images, numbered lists, bulleted lists, colors, and other document elements.

C# example - Export existing document
C# example - Create and export to PDF
VB example

Features supported in PDF export:

Text Formatting:

  • Bold, italic, underline, strikethrough
  • Font properties (family, size, color)
  • Superscript and subscript with proper sizing
  • Text highlighting with all 17 colors (yellow, green, cyan, magenta, blue, red, dark variants, gray, black, white)
  • Text colors (RGB support)

Paragraphs:

  • Alignment (left, center, right, justify with proper word spacing)
  • Indentation (left, right, first-line, hanging)
  • Spacing (before/after paragraph, custom line spacing)
  • Paragraph shading (background colors)
  • Paragraph borders (top, bottom, left, right with custom colors and widths)
  • Automatic word wrapping
  • Custom tab stops with different alignments (left, center, right, decimal)

Lists:

  • Numbered lists (1. 2. 3.)
  • Bulleted lists (•)
  • Multi-level lists with proper indentation
  • Custom numbering formats:
    • Decimal (1, 2, 3)
    • Lowercase letters (a, b, c)
    • Uppercase letters (A, B, C)
    • Lowercase Roman (i, ii, iii)
    • Uppercase Roman (I, II, III)

Tables:

  • Table borders with customizable color and width
  • Cell background colors (shading)
  • Merged cells (grid span / horizontal merge)
  • Cell-specific borders
  • Text formatting within cells (bold, italic, underline, colors)
  • Cell alignment (left, center, right)
  • Word wrapping within cells
  • Dynamic row height based on content

Other Elements:

  • Hyperlinks (styled in blue with underline)
  • Images (as placeholders with accurate dimensions)
  • Tabs and text alignment
  • Automatic page breaks
  • Multiple pages

Note: The PDF export creates standard PDF 1.4 format files that can be opened in any PDF reader. All formatting is preserved with high fidelity.

Need help? Ask our developers: