Solved

Writing a document in TIFF format using only native .NET namespaces

Posted on 2013-05-23
3
577 Views
Last Modified: 2013-05-30
I have a VB.Net program which uses a third-party "print to file" object to create some TIFF files.  This object is failing randomly (apparently randomly that is).  Every so often it just prints a blank document (no errors, it's just blank).  If I recreate the scenario exactly, it will run fine...usually.  Bottom line is that I want to abandon this 3rd party tool and just use pure .NET to do the job.  I don't know how though.  

I've posted the essential code below of how I use this defective "ImageConverter" object.  How can I swap this out for pure .NET and still get a TIFF image (yes, it must be a TIFF file)?
Imports System.Drawing.Printing

Dim WithEvents PrintDoc As New System.Drawing.Printing.PrintDocument
Dim ImageConverter As New badPDFPrinter

With ImageConverter
     .OutputFormat = badPDFOutputFormatEnum.TIFFG32d
     .Settings.OpenDocumentAfterCreation = False
     .ApplySettingsBeforePrint()
End With

PrintDoc.PrinterSettings.PrinterName = ImageConverter.PrinterName
PrintDoc.Print()
ImageConverter.WaitUntilDocumentIsPrinted()  'prevents the biopdf user interface from launching

Open in new window

0
Comment
Question by:David L. Hansen
  • 2
3 Comments
 
LVL 51

Accepted Solution

by:
Joe Winograd, EE MVE earned 500 total points
ID: 39192852
ImagePrinter Free is free, open-source software distributed under the GNU General Public License (GPL v3):
http://code-industry.net/public/ImagePrinter_2.1.zip

The program's source code is available for download here:
http://code-industry.net/public/ImagePrinter_2.1.src.zip

Download the source and look in the TIFF subfolder (it supports other formats besides TIFF). You will find the C source code there. Grab the code that prints to a TIFF file and either call it from your VB.Net code or convert it into C code. Or you could use the code as a guideline to figure out how to write your own code from scratch. Regards, Joe
0
 
LVL 15

Author Comment

by:David L. Hansen
ID: 39192867
Thanks Joe, I'll look into that.
0
 
LVL 51

Expert Comment

by:Joe Winograd, EE MVE
ID: 39192890
Of course, my comment "or convert it into C code" should have said "or convert it into VB.NET code". Mental typo. :)
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now