Converting password protected Office documents to PDF

I’m using the PDFNet SDK to convert office documents and PDFs to XOD files, on an unattended server.

When my code attempts to convert (for example) a password protected Word document, Office brings up a dialog box asking for the password, and the Convert.ToXod function doesn’t return until I dismiss the dialog.

Is there some way to cause document conversions to fail, rather than request a password?


Donald Gordon

PDFNet is already configured to not trigger dialog when handling MS Office files, however, due to inconsistencies in MS Office products dialogs can still popup sometimes.

Is this a DOCX file? If so, you can try our built in converter, or you can try using printing (by default PDFNet will use Interop to communicate with MS Word).

Before calling ToXod try the following.

pdftron.PDFConvert.Printer.SetMode(pdftron.PDF.Convert.Printer.Mode.e_prefer_builtin_converter) // for internal conversion of DOCX files.

pdftron.PDFConvert.Printer.SetMode(pdftron.PDF.Convert.Printer.Mode.e_printer_only) // skip Interop and try to use printing