Results 1 to 3 of 3

Thread: Is my understanding of printing correct?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2016
    Posts
    106

    Is my understanding of printing correct?

    I apologize in advance for my limited understanding of software programming.

    If I have a WPF application that just displays files...like a viewer for .jpgs and .pdfs. and .tiffs and .html in a window and I want to print that file, then I can do something simple like this:

    Code:
     Dim printjob As New ProcessStartInfo()
    
            With printjob
                .Arguments = printer
                .FileName = My.Application.file
                .Verb = "Printto"
                .UseShellExecute = True
                .WindowStyle = ProcessWindowStyle.Hidden
            End With
    
            Process.Start(printjob)
    But this only works because I have applications installed on the computer associated with the specific file type that do the heavy lifting right? Like if my application is displaying a .pdf file, then say Adobe Reader is actually printing my file correct?

    If I want my application to be installed on a computer with no other applications installed and print the document that its currently viewing. Then I have alot of typing to do correct? Like defining fonts and margins and open a graphics handler and draw etc...

    Its probably easier to convert all the files to a single file type like .pdf and go find some little pdf app like Sumatra and incorporate it into my project.

    Just about every applications prints...how do you guys handle printing?

  2. #2
    You don't want to know.
    Join Date
    Aug 2010
    Posts
    4,578

    Re: Is my understanding of printing correct?

    Pretty much.

    To oversimplify, printing in both WinForms and WPF involves Windows pretending the page is a monitor, and asking you to describe how you'd draw your content on that monitor. So if you can't parse a file type and draw it on the screen properly yourself, you aren't going to be able to print it properly yourself. And for PDF, you're probably better off finding some component that does it, it's a fairly complex format!
    This answer is wrong. You should be using TableAdapter and Dictionaries instead.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Mar 2016
    Posts
    106

    Re: Is my understanding of printing correct?

    Thanks Sitten! I found some little portable executables that will get the job done!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width