print to a dot matrix printer
Hellow !! [img]style_emoticons/<#EMO_DIR#>/rolleyes.gif" style="vertical-align:middle" emoid=":rolleyes:" border="0" alt="rolleyes.gif" /> I want to print on a dot matrix printer. How to set the paper size programmatically ? Thanks...[/img]
Comments
You can set the paper size, by using the OnPrintPage event.
procedure TFMain.frxReportPrintPage(Page: TfrxReportPage; CopyNo: Integer);
begin
Page.PaperSize:= DMPAPER_FANFOLD_STD_GERMAN;
end;
Regards
Also set the EscModel and check/edit the printers.xml file.
Note that you should always initialize the dot matrix printer completely, starting with a <Reset> command, followed by all the codes necessary to achieve the desired result.
The reason for this is that one never knows what other program has made use of the printer and possibly changed its settings. Full initialization ensures that one does not get odd results at random intervals.
hellow !!
I've tried but does not work, why?
thanks for this reply but this solution does not help me because many reports are not dotmatrix,
also working with different printer modelsmany is not practicable must to find the escape codes of them ...
i'am sorry !!!, another idea please ????
You could create a new printer with a custom page size in Windows itself. That is not straightforward and the client is unlikely to be able to do that without assistance.
Dot-matrix printers are from another computer area and you will have to accommodate that by making provisions in your program to manager the printers and by having the client doing some setup work for the printer they use. IOW there is no easy solution.
Dot-matrix and non-dot-matrix printers are 2 different kettles of fish, as far as the report is concerned. You really need 2 reports, one for each type of printer. One reason for this is simply practical. Dot-matrix printers are usually used for pre-printed forms whereas ink-jet and laser printers print on blank paper.
One alternative is to use the dot-matrix printer like a graphics printer but that will not get you around problems like page size and will produce very slow and low quality output.