<< Click to Display Table of Contents >> Correcting Possible Misaligned Printer Output |
The correctly positioned output depends also on the mechanical capabilities and quality of the printer. When paper is fed into the printer, there are tolerances of about 1 mm where the paper is misplaced in the y-direction. Also there are tolerances of about 0.1mm to 0.5mm in the x-direction.
But if a printer-driver is bad - or has a lax implementation - it might return a wrong printing offset, which results in misaligned output of VPE. This is definitely a problem of the driver (discuss it with the printer driver vendor).
You can solve this problem by calibrating VPE to the specific printer:
This can be done with ONE single printout by your end user. Simply create a document with a vertical line with Line(2, 2, 2, 5) and a horizontal line with Line(2, 2, 5, 2). Print it to the printer and let the user measure the real offset of the printed lines to the paper margins and let him enter the values into a small dialog.
Store these values into a file and retrieve them when starting your app or starting a report. Then, after calling OpenDoc(), provide the calibration values to VPE with:
SetPrintOffset(2 - x_measured_value, 2 - y_measured_value)
Et Voila! Your printout looks exactly the same as on the preview and as desired!
Example:
For the HP 5P under WinNT 4.0 SP3, we measured an offset of 2cm for the vertical line drawn in parallel to the left page margin, therefore, this value is correct (x-offset). But we measured an offset of 1.7cm for the horizontal line drawn in parallel to the top page margin (y-offset). So the y-offset is misaligned by 3 mm and we call:
SetPrintOffset(2 - 2, 2 – 1.7)
to correct the problem.
If you know the printer(s) your users will be using in advance - and there is a model which makes such problems - you could also perform the measuring by yourself and store the measured values in a database, so the user is not required to do the measuring himself.
NOTE: | This is a problem of the printer driver. The described method above of manual calibration is the only way to solve the problem. There will be no printing / reporting tool that could eliminate the problem by itself - except it had stored the calibration values already in its own database (which is nearly impossible, regarding the count of available printers that would need to be tested). |