How can I invoke PDFNet's Direct Microsoft Office Conversion Add-on using Python?

28 views
Skip to first unread message

Aaron

unread,
Mar 31, 2017, 4:12:45 PM3/31/17
to pdfne...@googlegroups.com
Q:

I'm working with Python, and want to use PDFNet's Direct Microsoft Office Conversion Add-on (https://www.pdftron.com/pdfnet/addons.html#Direct).  But the sample code at https://www.pdftron.com/pdfnet/samplecode.html#Word2PDF doesn't yet include a Python example.  Could you forward sample code showing how to perform this conversion using Python?

A:

import site
site
.addsitedir("../../../PDFNetC/Lib")
import sys
from PDFNetPython import *
import platform


inputPath
= "../../TestFiles/"
outputPath
= "../../TestFiles/Output/"


def main():
   
PDFNet.Initialize()
    pdfdoc
= PDFDoc()
    inputFile
= inputPath + "simple-word_2007.docx"
   
Convert.WordToPDF(pdfdoc, inputFile, None)
    outputFile
= outputPath + "pdf_from_docx.pdf"
    pdfdoc
.Save(outputFile, SDFDoc.e_remove_unused)
    pdfdoc
.Close()
   
if __name__ == '__main__':
    main
()

Reply all
Reply to author
Forward
0 new messages