J
jaminjay
Hello All!
I've been having trouble with this for some time, and I keep coming up
with new information, but as yet, no solution.
I am printing barcodes on Access Reports using my own code. The
function takes a Container (the report) and a LabelZone (a report
rectangle object) to place the Code (passed as a string, usually the
..Value, .Text or .Tag of an object on the report). It uses these
values to calculate the size and orientation of the bar label printing,
then uses a loop to output the binary string (converted by another
function) as lines drawn directly on the report.
The problem seems that measurements for most graphical elements are in
TWIPS, except the DrawWidth property is in integer pixels. To get the
width of a bar, I originally suspected that the width of the LabelZone,
divided by the number of elements in the bitstream (the length of the
string) divided by 2 (as the width of a line is half on either side of
an imaginary centre down which it is drawn) would result in the correct
figure.
This does not work on all printers and if some printer is reinstalled
or a new one installed, the program needs to be tweaked to account for
the difference in device pixel size. The size also needs to be
calculated correctly for the screen preview of the report (lest people
think it's broken, and I'm a pedant).
So, how can I get the physical pixel size of the current, arbitrary,
print device (be it screen, default printer or specific target
printer)? I have modularised my code as it's used in a number of
reports and do not want to have to set it manually for each printer,
especially since most reports can get redirected to a number of
printers over which I have no control.
My research has unearthed a few posibilities, but none have seemed to
help (references to Printer.TwipsPerPixel[X|Y], for example, seem to
have no known reference, and I can't find them in the Object Browser).
Any and all help appreciated.
Benjamin
The original post regarding this is at:
microsoft.public.access.reportsprinting (article '.DrawWidth and
..Line').
I've been having trouble with this for some time, and I keep coming up
with new information, but as yet, no solution.
I am printing barcodes on Access Reports using my own code. The
function takes a Container (the report) and a LabelZone (a report
rectangle object) to place the Code (passed as a string, usually the
..Value, .Text or .Tag of an object on the report). It uses these
values to calculate the size and orientation of the bar label printing,
then uses a loop to output the binary string (converted by another
function) as lines drawn directly on the report.
The problem seems that measurements for most graphical elements are in
TWIPS, except the DrawWidth property is in integer pixels. To get the
width of a bar, I originally suspected that the width of the LabelZone,
divided by the number of elements in the bitstream (the length of the
string) divided by 2 (as the width of a line is half on either side of
an imaginary centre down which it is drawn) would result in the correct
figure.
This does not work on all printers and if some printer is reinstalled
or a new one installed, the program needs to be tweaked to account for
the difference in device pixel size. The size also needs to be
calculated correctly for the screen preview of the report (lest people
think it's broken, and I'm a pedant).
So, how can I get the physical pixel size of the current, arbitrary,
print device (be it screen, default printer or specific target
printer)? I have modularised my code as it's used in a number of
reports and do not want to have to set it manually for each printer,
especially since most reports can get redirected to a number of
printers over which I have no control.
My research has unearthed a few posibilities, but none have seemed to
help (references to Printer.TwipsPerPixel[X|Y], for example, seem to
have no known reference, and I can't find them in the Object Browser).
Any and all help appreciated.
Benjamin
The original post regarding this is at:
microsoft.public.access.reportsprinting (article '.DrawWidth and
..Line').