Link to home
Start Free TrialLog in
Avatar of ffrand
ffrand

asked on

Printing HTML on a non-default printer

I am currently using the Thtmlview component made by a mr. Baldwin http://www.pbear.com/ and it can print by using the print method, but only on the default printer, thats the problem.

What I need is a HTML interpreter that can print to a HDC, much like the Thtml component that comes with D3, but without the instablility and errors in the printing code.

to be used like this:
printer.begindoc;
html.printTo(printer.handle);
printer.enddoc;

I need the D3 DCU or the source, an URL will suffice.
Avatar of dionysos_swamp
dionysos_swamp

You could try to modify the defaultprinter and defaultpaper settings in windows, yes its a hack, but it could work.
Avatar of ffrand

ASKER

I need a little more code than that.
I don't know this component, but did you try to change the Printer object in Delphi?
If didn't, drop a PrinterSetupDialog to your form, execute it and try to change the printer!
If this works, you can change the printer with Printer.SetPrinter(...) method.

Good luck!

haven't used that component, but you can get a list of currently installed printers from  Printer.Printers; {uses printers}
and then use PrinterIndex to select it as the current printer.

e.g:
ListBox.Lines := Printer.Printers;
Printer.PrinterIndex = Listbox.IndexOf('Name of the printer');




Avatar of ffrand

ASKER

That, i'm afraid, is not going to work, as the printer object is
a little impaired in that it cannot change the paper type,
it seems that windows (or delphi) has the idea that there is only
one papertype in the whole world, namely the paper selected by the default printer, I am writing an application that has to work unattended on several printers with several types of paper.
ASKER CERTIFIED SOLUTION
Avatar of ronit051397
ronit051397

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ffrand

ASKER

Well, I solved the problem long ago using the windows API calls directly and modifying the printers unit (coz it undid the changes made by the API call), you didn't really answer the question correctly, but deserve the credit just for trying, here you go...