Hello,
I have downloaded Bullzip PDF Printer in hopes of finally resolving my long-wished-for requirement of printing files of any extension that I can open.
Manually printing documents seems to function well. However, I have noticed numerous limitations in terms of printing from code (I am using .NET 4).
For example:
1. Create a new file called customFile.cf
2. Associate .cf to Notepad
3. Open customFile.cf, add some content to it, save and close
4. Try printing to PDF
Error: Win32Exception - No application is associated with the specified file for this operation
Notice that .cf has been associated to Notepad, a simple, Microsoft program. The same error occurs when trying to print document associated to any "custom" program, for example Photoshop CS5.
Performing the same exact steps for .txt files works like a charm. What gives?
Here's the code I am using in my C# application:
// get reference to selected file
var fileInfo = new FileInfo(openFileDialog1.FileName);
// set runonce pdf printer settings
var settings = new PdfSettings { PrinterName = "Bullzip PDF Printer" };
settings.SetValue("output", fileInfo.FullName.Replace(fileInfo.Extension, ".pdf"));
settings.SetValue("showsettings", "never");
settings.SetValue("showpdf", "no");
settings.SetValue("confirmoverwrite", "no");
settings.WriteSettings(PdfSettingsFileType.RunOnce);
// request file to be printed to pdf
PdfUtil.PrintFile(fileInfo.FullName, "Bullzip PDF Printer");
I am working on Windows 7 x64.
Is there something I am missing? Is there a workaround?
Thank you.
Help printing files with custom extensions after association
Moderator: jr
Re: Help printing files with custom extensions after associa
Normal associations between file extensions and programs are for the "open" verb. This means that you tell the system which program to use when you double click a file and wants to open it. It is a different kind of association you need to use for the "print" verb. If you right click a .doc file and have Microsoft Word installed then you will see a print command in the context menu. Only file types with a "print" association will work with the PrintFile command on the PdfUtil assembly and COM object.
The print verb is associated with a program (and often a command line argument) in the registry.
The print verb is associated with a program (and often a command line argument) in the registry.
Re: Help printing files with custom extensions after associa
I am receiving the same error message when trying to print .msg files through C#. The code is the posted sample code, I only changed the print and output locations to point at the files I wanted. When right clicking on an msg file it prints just fine but I receive this error when doing it through C#:
Error: Win32Exception - No application is associated with the specified file for this operation
Other office files and image files are working fine. Anyone have any ideas?
Error: Win32Exception - No application is associated with the specified file for this operation
Other office files and image files are working fine. Anyone have any ideas?