Help printing files with custom extensions after association
Posted: Wed Feb 08, 2012 6:14 pm
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.
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.