[FIX] Printing: Setting Bin

edited November 2016 in FastReport VCL 5
Hi,

we have found a small bug then your are setting up the BIN for the first page.

The code in frxPreviewPages.pas TfrxPreviewPages -> Print -> PrintPage is setting up the DEVMODE with BIN before the Printer.BeginDoc command thus ending up with a newly created DC with a default DEVMODE and default BIN.
The one created before gets lost.

So please move the code block
if not PagePrinted then
  Printer.BeginDoc;

before the code block
      if (Report.PrintOptions.PrintMode = pmDefault) then
      begin
        if (not PagePrinted) or
           (LastPaperSize <> Page.PaperSize) or
           (LastPaperWidth <> Round(Page.PaperWidth)) or
           (LastPaperHeight <> Round(Page.PaperHeight)) or
           (LastBin <> Bin) or
           (LastOrientation <> Page.Orientation) or
           (LastDuplexMode <> dup) then
        begin
          Printer.SetPrintParams(Page.PaperSize, Page.PaperWidth, Page.PaperHeight, Page.Orientation, Bin, Integer(dup) {+ 1}, ACopies);
        end else
        if (not PagePrinted) or
           (LastBin <> Bin) or
           (LastOrientation <> Page.Orientation) or
           (LastDuplexMode <> dup) then
        begin
          Printer.SetPrintParams(Report.PrintOptions.PrintOnSheet, SheetWidth, SheetHeight, Page.Orientation, Bin, Integer(dup) {+ 1}, ACopies);
          SheetWidth := frxPrinters.Printer.PaperWidth;
          SheetHeight := frxPrinters.Printer.PaperHeight;
        end;
      end;

and all is fine.

Thx in advance.

madas

PS: please let us know when the patch was applied.

Leave a Comment