Printing proprietary formats

  • Thread starter Thread starter Dan
  • Start date Start date
D

Dan

We are running into trouble when trying to print
proprietary formats (ie; .pdf, .xls, .doc, etc.) from our
VB.NET application.

Binary files generate garbage when printed.

We have no trouble printing text files using .NET objects
such as System.Drawing.Printing.PrintDocument and would
like to do the same thing with binary files without having
to go through multiple APIs.

Does anyone have any suggestions or ideas about this?

Thanks in advance for any assistance.
 
Text files are a known format. All the file formats you mentioned have application-specific information embedded with the actual data, so you can't just tell them to print like a text document and expect to get any kind of intelligible output

You either have to use the application's libraries to print with (like starting an instance of Word, loading your .doc file and printing it. This would require Word to be installed on the machine running the app), become familiar with the file format to the point where you can reliably pull the data you want out of it, or purchase or otherwise aquire third party software that allows you to print these formats

That sort of goes along with the concept of a proprietary file format. This is exactly the reason XML is so popular today. It gets rid of all these sorts of problems, at the expense of file size and speed, among other things.
 
* "Dan said:
We are running into trouble when trying to print
proprietary formats (ie; .pdf, .xls, .doc, etc.) from our
VB.NET application.

Binary files generate garbage when printed.

We have no trouble printing text files using .NET objects
such as System.Drawing.Printing.PrintDocument and would
like to do the same thing with binary files without having
to go through multiple APIs.

That's not possible.

You can start the associated application with the print verb:

\\\
Dim p As New System.Diagnostics.ProcessStartInfo()
p.Verb = "print"
p.WindowStyle = ProcessWindowStyle.Hidden
p.FileName = "C:\filename.htm"
p.UseShellExecute = True
System.Diagnostics.Process.Start(p)
///
 
Back
Top