MS Word to PDF Conversion in Java

Hi thank you for pointing this out. We will look to improve this for a future release.

There is a specific WordToPDFTest sample project for direct conversions.
https://www.pdftron.com/pdfnet/samplecode/WordToPDFTest.java.html

Our direct conversion of docx to pdf provides more control over the process then our “indirect” conversion, and so an alternate API is provided.

Alternatively, you can modify the convert sample to the following, which will use our direct docx to pdf conversion.

// DISABLE check for printer, is not required for docx conversion using builtin. //if( Convert.requiresPrinter( input_path + "simple-word_2007.docx") && printerInstalled ) { // ENABLE builtin converter ConvertPrinter.setMode(ConvertPrinter.e_convert_printer_prefer_builtin_converter); // rest is the same System.out.println("Converting MS Word document to PDF"); System.out.println("Using the PDFTron PDFNet printer"); PDFDoc doc = new PDFDoc(); Convert.toPdf(doc, input_path + "simple-word_2007.docx"); outputFile = output_path + "docx2pdf_Java.pdf"; doc.save(outputFile, SDFDoc.e_linearized, null); System.out.println("Result saved in " + outputFile); doc.close(); }