Convert to PDF with advanced options

GroupDocs.Conversion provides PdfConvertOptions to give you control over conversion result when convert to PDF. Along with common convert options  PdfConvertOptions has the following additional options:

  • setFormat -  desired result document type. Available options are: Pdf, Epub, Xps, Tex, Ps, Pcl
  • setWidth - desired image width after conversion
  • setHeight - desired image height after conversion
  • setDpi - desired page DPI after conversion
  • setPassword - if set the converted document will be protected with specified password
  • setMarginTop - desired page top margin after conversion
  • setMarginBottom - desired page bottom margin after conversion
  • setMarginLeft -  desired page left margin after conversion
  • setMarginRight - desired page right margin after conversion
  • setPdfOptions - PDF specific convert options
  • setRotate - page rotation. Available options are: None, On90, On180, On270

Following code snippet shows how to convert to PDF with advanced options

WordProcessingLoadOptions loadOptions = new WordProcessingLoadOptions();

Converter converter = new Converter("sample.docx");
PdfConvertOptions options = new PdfConvertOptions();

converter.convert("converted.pdf", options);


PdfOptions class provides specific options when converting document to different versions of PDF format.


PdfOptimizationOptions class allows to specify options for adjusting PDF conversion process and improve its speed.


PdfFormattingOptions class provides different options to change PDF document look.

  • setCenterWindow - specifies whether position of the document’s window will be centered on the screen
  • setDirection - sets reading order of text: L2R (left to right) or R2L (right to left). Available options are: L2R, R2L
  • setDisplayDocTitle - specifies whether document’s window title bar should display document title
  • setFitWindow - specifies whether document window must be resized to fit the first displayed page
  • setHideMenuBar - specifies whether menu bar should be hidden when document is active
  • setHideToolBar - specifies whether toolbar should be hidden when document is active
  • setHideWindowUI - specifies whether user interface elements should be hidden when document is active
  • setNonFullScreenPageMode - specifying how to display the document on exiting full-screen mode. Available options are: UseNone, UseOutlines, UseThumbs, FullScreen, UseOC, UseAttachments
  • setPageLayout - sets page layout which shall be used when the document is opened. Available options are: Default, SinglePage, OneColumn, TwoColumnLeft, TwoColumnRight, TwoPagesLeft, TwoPagesRight
  • setPageMode - specifying how document should be displayed when opened