lPaperDimensions.X excceds range of FPDevMode^.dmPaperWidth (ppPrintr.pas)

edited October 2017 in General

some of our customers get a ERangeExcpetion on trying to print a report
from a archive. Previewing before generating archive and after loading
works fine, but direct printing fails.
After debuging i detected that the critical line is
ppPrintr.pas (6625): FPDevMode^.dmPaperWidth := lPaperDimensions.X;
dmpaperWidth is a smallint, lPaperDimensions.X is sometime 53340 which
is larger than a smallint

Normally lPaperDimension.x is 2100 = 10 *210mm, which is the width of
germand DIN A4 in Portrait mode.

The resulting value 53340= 10 * 210mm * 10 * 2,54 , where 2,54 is 1
in cm.

Any idea how and why this conversion is happening?

Obviously it is depending on printers settings.
One customer get this error on selecting a OKI printer but not using a
Brother printer on the same station.
Other customers can print archive an station A but not on station B
using the same printer.

Reinstalling any printer drivers did not solve the problem!


Hint: We altered the sources!Hint: We altered the sources!


  • edited October 2017
    Hi Carsten,

    This is not a known issue.

    The Win API defines the DevMode.PaperWidth as Short (Smallint). The units
    are MM tenths. The A4 value should be 2100 = 210 * 10. I have no clue why
    the value would be otherwise.

    If you would like to provide an example project I can build and run in the
    debugger, I can research it. I can download and install a specific printer
    driver if needed. Please use standard Delphi components and RB. Send in zip
    format - include only .dpr, .pas, .dfm. Send to support@

    Best regards,

    Nard Moseley
    Digital Metaphors

    Best regards,

    Nard Moseley
    Digital Metaphors
  • edited October 2017
    Upto now i can Not reproduce the Error on my machine. There are
    some archives which cause the Error on customers system on
    printing but Not on my pc

    "Nard Moseley \(Digital Metaphors\)" Wrote in message:


    ----Android NewsGroup Reader----
This discussion has been closed.