views:

915

answers:

3

This is a bit special:
I'm loading some HTML in string form into the WebBrowser control via the DocumentText property.
Now when I print the page with a PDF printer (Bullzip PDF Printer in my case) it always takes the URL as document name which is "about:blank".
Is there any way to change this to another value by either changing the URL property (it's read-only) or by changing the print behaviour to use another text rather than the URL as filename?

A: 

You can change the header and footer such that the URL property is not printed.

Sam Meldrum
The issue isn't about printing the URL, it's that the URL is used as document name (example: stackoverflow.com.pdf)
Marc
A: 

Try to Navigate to a URL, then cancel that via DWebBrowserEvents::BeforeNavigate

MSalters
I've tried that but it didn't work: Using C# I navigated to a URL and then in the .._Navigating event I've cancelled the navigation but the URL property is still left "null" and so "about:blank" is still used.
Marc
+1  A: 

There are a couple of options that I am aware of though my knowledge on this subject is a bit dated.

The first is to change the computer settings in Internet Options. Regardless of whether this is done by hand or through a registry change script, it is simple for the developer, but obviously not the best approach from the deployment or compatibility angles.

The next approach is to develop a custom print template. This is not fun, but is probably the most professional approach. As much as I would love to include all of the information needed on this approach in this post, it is too much to cover. Here is a good overview and good luck Googling from there.

My experience with this involved printing from the MS WebControl component used in a .NET 1.1 Winforms application to the Web Super Goo PDF converter component. Your mileage may vary.

Chuck