Can anyone recommend a print contol library please?

  • Thread starter Thread starter Alan
  • Start date Start date
A

Alan

Hello,

Can anyone recommend print control libraries for VB .Net please? I'm
writing an app to print the attachments of mail messages and it's
difficult to handle PDF, Office and any possible graphic file format
via the standard printprocess. Ideally, I'd just like to save the
attachments to disk and and then pass the filenames to a control,
which would popup the standard print dialog or just print.

Thanks,

- Alan.
 
If I am reading your question correctly, you are trying to print the
contents of an email attachment from your .net app -- bypassing having
to open the attachment. If you are reading the contents from your code
you can then place these contents into a .Net report control (rdlc file)
and then use emf to print that out.

Here's a link where you can print using EMF with a .rdlc file:

http://msdn.microsoft.com/en-us/library/microsoft.reporting.winforms.cre
atestreamcallback(VS.80).aspx

Rich
 
Thanks Rich.

Yes, I'm saving the attachments to a temp directory, then printing
them out. Problem is that the different potential types need to be
handled differently, e.g, PDF vs Word.

First time I've heard of EMF so I'll check it out...
 
Alan,

You can use Crystal Reports or a 3th party tool.

For your problem I would probably take the Visual Basic powerpack and follow
the Print part of that.
(If it is not PDF otherwise I would probably simple create an application
start with the PDF in it, and then it)

Cor
 
Thanks Cor.

Just to be clear, I don't want to display the files or make any
reports. All I want to do is basically pass the filename and get it
printed out, regardless of whether it's a TIF, DOC or XLS file.

PrintForms will handkle that?

If not, can you name any 3rd party components pls? Thanks.
 
Quick Note on the EMF printing idea: you set up an rdlc file (drag a
report control onto a form and it will automatically create an rdlc
file). In the rdlc you add the controls that you want to print content
from - like an image control for a picture, or a textbox for text, etc.
With the emf technique -- you don't display the report control or
contents ... it just prints out the contents to the printer. Go to the
link above and check it out.

Rich
 
Thanks Rich.

I checked the link but how does it know if it's a text file or a Word
doc or an image or PDF? Do I have to explicitly use a SELECT .. CASE
with every possible file extension?

Sorry for the trouble. This is really something difficult to me.
 
Hi Alan,

Well, you will have to write a little bit of code here. When reading
your document, you would read text to some string var and then set the
text property of a textbox to the string var. If it is a pdf (I haven't
tried this yet) but I believe you can embed the pdf file into the rdlc
into a control and print that control. Basically, you would have to
detach the pdf and then pass the location to the rdlc and then print the
rdlc. I am not sure what control would take a pdf. It should be in the
link I posted above. The specific section of the link is just for
printing but the rest of the sections pertain the the report control.

So you would detach the pdf, pass the location to the rdlc, print the
pdf, and then delete the pdf from the location. That should be seamless
to the user.

If the PDF is just pure text, you could read the contents and then pass
that to the rdlc and print that -- just to give you some ideas.

Rich
 
Finally tried using PrintForms in VSS2008. It was going well until I
discovered that a single form was too small for A4 paper.

Why oh why is printing so complicated in VB .Net?
 
Hi,

A know method is to use the "Print" "verb" :

"If the file name involves a nonexecutable file, such as a .doc file, you
can include a verb specifying what action to take on the file. For example,
you could set the Verb to "Print" for a file ending in the .doc extension.
The file name specified in the FileName property does not need to have an
extension if you manually enter a value for the Verb property. However, if
you use the Verbs property to determine what verbs are available, you must
include the extension."

(from
http://msdn.microsoft.com/en-us/library/system.diagnostics.process.startinfo.aspx).
 
Thanks Patrice. That's ok for any attachments, but not for the message
itself.

I'll just have to jump in to PrintDocuments and Graphic.Drawstring
etc.
 
Back
Top