Print Preview

  • Thread starter Thread starter Jackie
  • Start date Start date
J

Jackie

Hi

I am writing an application in vb.net where the user can
choose a document from their PC (will be either *.doc,
*.pdf or *.txt) - say c:\templates - and can either
preview the document or print it.

I can preview the text file using: PrintPreviewDialog

I understand why this will not work as expected for
formatted files, but I don't know where to begin to be
able to print or preview a Word/PDF file.

For the time being, I have just allowed the user to open
the document (Dim obj As System.Diagnostics.Process and
then obj.Start(strFile)) but this is not really
appropriate.

Any suggestions?

Thanks

Jackie
 
Jackie said:
I just applied your suggestion and it printed my Word
document.

Thank you very much for your help!
I just applied your suggestion in VB.NET Web Application and it
printed only txt documents but write "The system cannot find the file
specified " message on doc, pdf ,etc documents. Why?

Line 187: p.FileName = "f:\referat.doc"
Line 188: p.UseShellExecute = True
Line 189: System.Diagnostics.Process.Start(p)
System.ComponentModel.Win32Exception: The system cannot find the file
specified


Also, if I'm using
success = ShellExecute(0, "print", "c:\1.txt", 0&, 0&, SW_SHOWDEFAULT)
nothing happends! Silence.. success has very big value after
ShellExecute

Thanks you!
 
Back
Top