Home General

Problems printing images

edited July 2001 in General
Hi,

Before I get into the ugly details, the basic problem I'm having is that my
reports ALWAYS show their images properly in print preview, but often the
printers will simply emit a blank page. I can't seem to get a handle on
what's causing this and it's driving me bats. Sometimes it works, sometimes
it doesn't...

Now for the fun stuff:

Users of this report need to be able to specify the printer, paper size,
margins, and the number of rows and columns of images they wish. I provide a
dialog for this and configure the report's PrinterSetup accordingly before
starting the report. This involves setting the detail band's height, the
report's column count, and the dimensions of the single TppImage on the
detail band.

The TppImage's properties are:

AutoSize : False
Center : True (False doesn't help);
DirectDraw : True (False doesn't help)
Stretch: False;

The report is based on a database table, but the images aren't IN the
database -- it's records merely store the paths to the images.

I use the report's detail band's BeforePrint event to load the image into a
graphics object from another library and resample them to down (if
necessary) to fit in the TppImage -- and rotate them (if necessary) before
assigning them to my TppImage's bitmap.

And it works -- beautifully -- in print preview -- ALWAYS.

The printers I've tested on are a HP LaserJet 4 Plus, HP DeskJet 932C, HP
LaserJet II. (All have the latest drivers)

No errors are reported by the printers, their drivers or Windows 98.

Details:

Delphi 5
RB 5.52
Windows 98

Thanks in advance to any and all who can offer tips/suggestions.
---------------------------

Wes Peterson
LexCraft Data Services
wes@lexcraft.com

Comments

  • edited July 2001
    If the image prints one minute and not the next, on the printer, then I
    would tend to believe that there is a re-initialization problem in your code
    for the TppImage size or maybe when setting the margins, columns or the
    detail band height? The report will generate once for the screen and once
    when sent to the printer. All of the events will fire again, so you may
    have to do some checking for this, or set CachePage to true on the report.


    Cheers,

    Jim Bennett
    Digital Metaphors


  • edited July 2001
    Jim,

    Thanks so much for the prompt reply.


    CachePages := True "solved" the problem, but like the docs say, it comes at
    a price.

    code

    Will do.
  • edited July 2001
    Jim,

    code

    You were right on the money. Turns out I was changing the Top and Left
    properties of the TppImage in the detail band's BeforePrint event. Moving
    that code to an area that executes before the report starts solved the
    problem -- and eliminated the need to use CachePages.

    Gawd, I love ReportBuilder!
This discussion has been closed.