Q: I have resolved the issue described in this email. I build a 64
bit console app that referenced the 64bit pdfnet dll and the printer
was installed without issue.
I do have an additional question:
I tried using pdftron.PDF.Convert with MS Office interop but it seems
that it was not working. Then I tried using PDFTron converter by
installing a custom printer driver and "printing" a native application
that is associated with the specific file type. In my service this
converts PDF to XPS without issue using PDFTron. When trying to
print a .docx in the service I would see a winword or wordview
process fire up and hang. I assume these are expecting a desktop
context. I actually solved the problem for .docx by download a free
word viewer application (
http://www.officeviewers.com) and associating
it with .docx files. This would allow pdftron "print" .docx files
to xps in my service. If I could find other service friendly
viewers for xlsx and pptx I would be in good shape.
-------------
A: Regarding direct conversion from MS Office to PDF in a Windows
service the most likely reason why it is not working is because you
can't run the conversion in the same process as your service. We are
running a similar solution successfully on our servers without major
issues. The main difference is that we are running PDFNet in a
separate process.
As a quick test you could use a command-line utility called DocPub
(which is command-line utility based on PDFNet):
http://www.pdftron.com/IDR49Z9-B31B/PDFTronDocPub.zip
In case you want to access MS via interop you do not need to install
the driver. In case you do want to install the driver call docpub
with '-i' or (--installprinter) from the command-line . You would
need admin privileges for this step.
You could use the following snippet to run docpub from a Windows
service. Depending on the server you use you would need to change the
suffix to 32 or 64.
System.Diagnostics.Process p = new System.Diagnostics.Process();
p.StartInfo.FileName = @"c:\pdftron\docpub32.exe";
p.StartInfo.Arguments = @"-f pdf -o c:\output c:\input\my.docx ";
p.Start();
p.WaitForExit();
We tested a similar solution (using MS Office 2007 and 2010) on a few
2003 and 2008 servers and is seems to be working without any major
issues.