How to I pause a report printing on a dot-matrix printer, say every 100 records, for the purpose to adjust the printer because of incorrect page height ?
I'm a bit unclear about why you need to pause printing. Is the page height somehow becomming corrupt as the report prints? Is this a continuous document such as a receipt? If so, take a look at the following article on printing to continuous paper. This may remove the need to pause printing in the first place.
---------------------------------------------------- Article: Printing to Continuous Paper ----------------------------------------------------
1. Layout
For continuous printing (for example a receipt) use Title/Summary and removing the Header/Footer. Set the PrintHeight of each to phDynamic. Layout the DetailBand to print a single line item. Set the margins to 0 or to the smallest that the printer driver will support (some printers have an unprintable area).
With this configuration The Report will generate a Title followed by a variable number of Detail bands that span pages if needed, and then finally print a Summary at the end.
2. Pagination
a. dtPrinter
Some printer drivers have a continuous paper size setting. If not then try setting the paper size to be very small - perhaps the size of the tallest band in the layout. Or try setting the page height to be the size of a detail band. Note that some printer drivers will only accept page sizes within a certain range of paper sizes.
b. dtReportTextFile
With the above layout, the report text file will generate the page breaks properly, however the device will fill up a page with blank lines. You can control the number of lines per page by configuring the CharacterGrid property in the Report.BeforePrint event:
example:
procedure TForm1.ppReport1BeforePrint(Sender: TObject); var lDevice: TppReportTextFileDevice; begin
if (ppReport1.FileDevice <> nil) and (ppReport1.FileDevice is TppReportTextFileDevice)then begin lDevice := TppReportTextFileDevice(ppReport1.FileDevice);
{120 characters per line, 66 lines per page} lDevice.CharacterGrid(120, 66); end;
My problem is "printer creep": The problem is that the top form on the page lined up properly, but the print on the bottom forms gradually moved up (or down), out of the boxes.
I've set the Printer | Units to Thousandths of MM. My page height (of a label) is already set to 63463 but I still get "printer creep". Only by lots of trial and errors I will get the precise height. One way to do it is to pause the printer every n number of labels (n = 10, 30, 50, 100, 500, 1000 till the problem disappear) and adjust the page height in a edit box (I write the new height to the .ini file).
I'm using a quality printer (OKI) for the label run.
Unfortunately there is no way to simply pause the printing after a certain number of lines. One options you might explore is implementing the OnPageReceive event of the Printer Device. This way you can get a hold of the page object and adjust it's printer setup however you need before it is sent to the printer driver.
Comments
I'm a bit unclear about why you need to pause printing. Is the page height
somehow becomming corrupt as the report prints? Is this a continuous
document such as a receipt? If so, take a look at the following article on
printing to continuous paper. This may remove the need to pause printing in
the first place.
----------------------------------------------------
Article: Printing to Continuous Paper
----------------------------------------------------
1. Layout
For continuous printing (for example a receipt) use Title/Summary and
removing the Header/Footer. Set the PrintHeight of each to phDynamic. Layout
the DetailBand to print a single line item. Set the margins to 0 or to the
smallest that the printer driver will support (some printers have an
unprintable area).
With this configuration The Report will generate a Title followed by a
variable number of Detail bands that span pages if needed, and then finally
print a Summary at the end.
2. Pagination
a. dtPrinter
Some printer drivers have a continuous paper size setting. If not then try
setting the paper size to be very small - perhaps the size of the tallest
band in the layout. Or try setting the page height to be the size of a
detail band. Note that some printer drivers will only accept page sizes
within a certain range of paper sizes.
b. dtReportTextFile
With the above layout, the report text file will generate the page breaks
properly, however the device will fill up a page with blank lines. You can
control the number of lines per page by configuring the CharacterGrid
property in the Report.BeforePrint event:
example:
procedure TForm1.ppReport1BeforePrint(Sender: TObject);
var
lDevice: TppReportTextFileDevice;
begin
if (ppReport1.FileDevice <> nil) and (ppReport1.FileDevice is
TppReportTextFileDevice)then
begin
lDevice := TppReportTextFileDevice(ppReport1.FileDevice);
{120 characters per line, 66 lines per page}
lDevice.CharacterGrid(120, 66);
end;
end;
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
lined up properly, but the print on the bottom forms gradually moved up (or
down), out of the boxes.
I've set the Printer | Units to Thousandths of MM. My page height (of a
label) is already set to 63463 but I still get "printer creep". Only by
lots of trial and errors I will get the precise height. One way to do it is
to pause the printer every n number of labels (n = 10, 30, 50, 100, 500,
1000 till the problem disappear) and adjust the page height in a edit box (I
write the new height to the .ini file).
I'm using a quality printer (OKI) for the label run.
Unfortunately there is no way to simply pause the printing after a certain
number of lines. One options you might explore is implementing the
OnPageReceive event of the Printer Device. This way you can get a hold of
the page object and adjust it's printer setup however you need before it is
sent to the printer driver.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com