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

More resources

GitHub Examples

You may easily run the code above and see the feature in action in our GitHub examples:

Free Online Document Converter Apps

Along with full-featured Java library we provide free Apps and free services for document conversion. In order to see a full potential of GroupDocs.Conversion, you are welcome to convert DOC to PDF, DOC to XLSX, PDF to DOC, PDF to XLSX, PPT to DOC and more with Free Online Document Converter App or get a full advantage of Free Online Document Converter Suite with advanced conversion settings and many more enterprise built-in features. Please note that more premium features, advanced options and enhanced document management experience is available for signed-in users at for FREE.
If you don’t own an account yet, register it now for free! No credit card is required!