Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Given what you've said, perhaps if you restart the process which contains the web browser control (or the process which <em>is</em> the web browser control), after you change the default printer? That's <a href="http://sapientcoder.wordpress.com/2008/08/08/programmatically-convertingprinting-a-web-page-to-pdf/" rel="nofollow noreferrer">the kind of thing I see happening here</a>, for example.</p> <hr> <blockquote> <p>I suppose it would be possible to fork off a background process that does the actual printing, but I'm really hoping for a simpler solution.</p> </blockquote> <p>Forking <em>was</em> my first thought towards a probably-simplest solution.</p> <p>Some other alternatives are as follows.</p> <p>1). IE, which the webbrowser control is wrapping, exposes APIs via ActiveX. One of its/those APIs might let you specify the destination printer.</p> <p>2). Some executables (I don't know about IE) have <code>printto</code> entries in the registry. For example, Acrobat Reader has an entry whose value is as follows:</p> <pre><code>""C:\Program Files\Adobe\Reader 9.0\Reader\AcroRd32.exe"" /t "%1" "%2" "%3" "%4" </code></pre> <p>That's used for specifying the syntax of the command-line which you can use to print and specify a (non-default) printer. You can also Google for <code>printto</code>, see e.g. <a href="http://social.msdn.microsoft.com/Forums/en-US/vclanguage/thread/9eafa428-b279-42fb-aa2a-fe790b4a81fb" rel="nofollow noreferrer">PrintTo command in the ShellExecute</a>.</p> <p>3). I have implemented an <a href="http://www.modeltext.com/html/" rel="nofollow noreferrer">HTML control for .NET</a> of my own, which doesn't depend on IE. You say that your HTML (and CSS I presume) are simple, so perhaps <a href="http://www.modeltext.com/html/html-and-css.aspx" rel="nofollow noreferrer">I can render it</a>, either out of the box or with only a little extra development effort. I don't support printing, but printing is quite easy for a user control to implement. Getting me to implement that for you would cost you several hundred but, who knows, maybe it's worth it to you. It would be quite a light-weight solution, and perhaps well supported. You could email me if you want to discuss that further.</p> <p>4). You might also find other controls, similar to mine, more or less famous/expensive; or other applications, e.g. OpenOffice etc etc.</p> <p>5). You could consider converting the HTML (somehow) to another format (e.g. PDF) for which you have an application which gives you better support for printing.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload