I'm trying to create a report for printing images from a database, so I have placed a DBImage component on the details band. The question is how do I handle images having height that exceeds the page length ?
What would you like to happen when an image is larger than the page? Shrink the image? Cut it off and overflow to the next page? What currently happens? Does the image get cut off at the bottom of the page or is it simply not showing up?
The TppDBImage component is not desinged to overflow to multiple pages. Once an image is too large to fit on a page, RB will try to move it to the next page to see if there is room for it there. If not, it will continue the process and this is the reason you are receiving infinite pages. One alternative would be to manually size the image to equal the size of a page so it will not overflow or to break your image into multiple images and separate them across multiple pages using TppPageBreak components.
Hi Nico, Let's focus on the second solution (break the image into multiple images and separate them across multiple pages using TppPageBreak components). Can this be done using RAP ? Can you give me a sample code on how to achieve this ?
ReportBuilder does not have any built-in image handling features. If you are going to break the image into multiple parts, this will need to be done manually in an image editing application or in Delphi code.
Hi Nico, I think, since RB implements the TppImage and TppDBImage components, overflowing to multiple pages is something that should had been taken care. Anyway, if I must cut an image to mulitple parts fitting page length, I need to know the remaining page length (in pixels) when the TppImage (placed in the details band) is going to be printed. Do I have that information in an event of the TppImage ?
Yes, this would be a nice feature. We will consider this for a future release, thanks for the feedback. My suggestion would be to determine the length of the image before it is used, then compare it to the amount of space left on the page. You can use the Report.Engine.PrintPosRect property to see exactly what position on a page you currently are.
Hi Nico, You give me only hints, when I'm asking for a solution. Please keep in mind that I use RB as a tool, so I'm not familiar with the inside stuff. So can you please provide me some more info on the following: a. In which event I must fire up my code. In a RAP event or in a Delphi event ? b. I suppose that Report.Engine.PrintPosRect points to the current position, but I need the remaining space left on the page (in pixels, not in cm or inches etc) c. Whatever else you think that is needed, but please not just hints.
Are you using a registered copy of ReportBuilder or an application with ReportBuilder built-in?
The PrintPosRect does give you the current position of generation. You can subtract this number from the page size to determine the amount of space left on the page. There are utility function is ppUtils.pas that enable you to convert to and from screen and printer pixels as well as microns. Take a look at the ppToScreenPixels routine inside the ppUtils.pas file.
As far as the proper event to use... you may need to try a number of events to get the correct result. Your goal is to find an event that fires after the last object is generated before the image appears. If the image is inside its own band, try the band.BeforePrint event. You may also be able to use the ppImage.OnPrint event.
Comments
What would you like to happen when an image is larger than the page? Shrink
the image? Cut it off and overflow to the next page? What currently
happens? Does the image get cut off at the bottom of the page or is it
simply not showing up?
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
I would like to cut off the image and overflow to as many pages as needed.
while printing an infinite numbers of blank pages
The TppDBImage component is not desinged to overflow to multiple pages.
Once an image is too large to fit on a page, RB will try to move it to the
next page to see if there is room for it there. If not, it will continue
the process and this is the reason you are receiving infinite pages. One
alternative would be to manually size the image to equal the size of a page
so it will not overflow or to break your image into multiple images and
separate them across multiple pages using TppPageBreak components.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Let's focus on the second solution (break the image into multiple images and
separate them across multiple pages using TppPageBreak components).
Can this be done using RAP ?
Can you give me a sample code on how to achieve this ?
Thanks in advance
Manos
are going to break the image into multiple parts, this will need to be done
manually in an image editing application or in Delphi code.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
I think, since RB implements the TppImage and TppDBImage components,
overflowing to multiple pages is something that should had been taken care.
Anyway, if I must cut an image to mulitple parts fitting page length, I need
to know the remaining page length (in pixels) when the TppImage (placed in
the details band) is going to be printed.
Do I have that information in an event of the TppImage ?
Thanks again for your time
Manos
Yes, this would be a nice feature. We will consider this for a future
release, thanks for the feedback. My suggestion would be to determine the
length of the image before it is used, then compare it to the amount of
space left on the page. You can use the Report.Engine.PrintPosRect property
to see exactly what position on a page you currently are.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
You give me only hints, when I'm asking for a solution.
Please keep in mind that I use RB as a tool, so I'm not familiar with the
inside stuff.
So can you please provide me some more info on the following:
a. In which event I must fire up my code. In a RAP event or in a Delphi
event ?
b. I suppose that Report.Engine.PrintPosRect points to the current position,
but I need the remaining space left on the page (in pixels, not in cm or
inches etc)
c. Whatever else you think that is needed, but please not just hints.
Thank you in advance
Manos
Are you using a registered copy of ReportBuilder or an application with
ReportBuilder built-in?
The PrintPosRect does give you the current position of generation. You can
subtract this number from the page size to determine the amount of space
left on the page. There are utility function is ppUtils.pas that enable you
to convert to and from screen and printer pixels as well as microns. Take a
look at the ppToScreenPixels routine inside the ppUtils.pas file.
As far as the proper event to use... you may need to try a number of events
to get the correct result. Your goal is to find an event that fires after
the last object is generated before the image appears. If the image is
inside its own band, try the band.BeforePrint event. You may also be able
to use the ppImage.OnPrint event.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com