?
Solved

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

Posted on 2013-05-23
3
Medium Priority
?
591 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 55

Accepted Solution

by:
Joe Winograd, EE MVE 2015&2016 earned 2000 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 55

Expert Comment

by:Joe Winograd, EE MVE 2015&2016
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

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

770 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