I'm trying the DocConerter2.1 Dev version on Window2000. My target is to convert a .doc to a .pdf in my application.
I wrote a little test program (in C# .net) to open a word document, then printed it to the PDF printer, it generated a pdf file beautifully.
However, I encountered a problem later. When I tried it with a bigger .doc file (actually it is not too big, it is about 10+ pages with some tables inside the .doc, 90KB), it failed with a COMException:
â€œAn unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in PDFAmyuniTester.exe.
Additional information: Windows cannot print due to a problem with the current printer setup.
Try one or more of the following:
* Check the printer by printing a test page from Windows.
* Make sure the printer is turned on and online.
* Reinstall the printer driver. â€œ
When I try it with a small .doc file, it always works. However when I try it with a big file, sometimes it works, sometimes it doesnâ€™t. Does anyone know what is going on here? Any suggestion on how to solve the problem?
Btw, I also tested the EndUser version, it works beautifully even when I print a 2MB .doc file which contains a lot of image files. How come I just canâ€™t get it working in the developer version?
P.S. If you need to know how I used the developer version, here is the details:
â€œI followed the step-by-step instruction listed in page 5 of "Common Drinver Interface 210.pdf" developer manual.
In Step 2, I choosed running install.exe to install "My PDF Printer". In step 4, I registered CDINF210.dll as a COM object.
Then in my application(C# .net), I refrenced the "Common Driver" COM object, and did the following steps:
CDIntfExClass _pdfPrinter = new CDIntfExClass();
_pdfPrinter.DriverInit("My PDF Driver");
_pdfPrinter.FileNameOptionsEx = 1 + 2;
_pdfPrinter.DefaultFileName = outputFileName;
..... // Do a print job, E.g, calling wordApplication.print() to print a .doc to the PDF printer.
_pdfPrinter.FileNameOptions = 0;
All the steps above are pretty-much following the instruction in page5, except for I added a call to EnablePrinter(), since it seems not working without the call.