Q: I’m using PDFNet in an attempt to convert DWF and DWG files to PDF.
Now, everything is working great for the DWF files. PDFNet is opening them in an application that will display them and sending them off to the PDFNet print driver. It’s working perfectly.
When it comes to the DWG files, it hangs for a while and ends up throwing the error below. I have two different applications on my machine that can open and display DWG files. There is an association between the DWG file and one of the applications (meaning I can simply double click on a DWG file and it opens in the proper application). What am I missing? Is this task not possible to accomplish with this file type? If I’m just missing something can you please let me know what it is and if possible give me a code example?
I have looked at and am basing my code off of the Convert sample project.
To print custom file formats via virtual printer driver, the associated application needs to support the command verb “print”.
A quick way to test this is right clicking the file to show the context menu and see if “Print” is one of the options.
If the print verb is not present, then PDFNet cannot use the perform the conversion.
Assuming that your associated application supports command line printing, you can manually add the print verb through modifying the registry.
-look for value of “Progid”, this could be under HKEY_CURRENT_USER or HKEY_LOCAL_MACHINE
-Under this entry, you are looking for the “Shell” key. Add the “Print” key, with “command” and data as the command-line code to perform print.
For example, if you set your default program to open .dwg with notepad….
Ø Progid REG_SZ Applications\NOTEPAD.EXE
Ø Add key “print”
Ø Under “print”, add key “command”
Ø set default value to the command line code for printing
Ø (Default) REG_EXPAND_SZ %SystemRoot%\system32\NOTEPAD.EXE /p %1
Resources on setting command verbs
After you made your changes to the registry, try to print from the context menu with the “print” command.
If that works successfully, PDFNet should also be able to convert the file.