Background Image Rendering

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Background Image Rendering

Levesque, Gary R
I have been struggling with the getting a background image (jpeg) to
display properly in the PDF output using fop 0.20.5 on Windows XP.

I am inserting a background jpeg image ("watermark") and placing a table
over the top of it.  When I view the image and table in a tool such as
XSLFormatterV3.2 the size of the jpeg image is appropriate (the image is
a form that basically fills in the entire 8.5in X11.0in boundary).
However when I process the file in FOP the size of the JPEG image gets
increased by approximately 400% such that the PDF file only contains the
top left portion of my form image.


Below is the command line I am using to insert the image.

<fo:region-body column-count="1" margin-bottom=".25in"
margin-left="0.0in" margin-right=".25in" margin-top=".1in"
region-name="region-body"
background-image="url(C:\FOP\images\rrform.jpg)"
background-repeat="no-repeat"/>

I was able to get the JPEG to display the correct size in the PDF output
by using another program to resize the file from 1700 X 2200 pixels to
610 X 789, however the clarity of the image has gone to hell.

Any guidance is appreciated.

GARY LEVESQUE



---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Background Image Rendering

J.Pietschmann
Levesque, Gary R wrote:
> over the top of it.  When I view the image and table in a tool such as
> XSLFormatterV3.2 the size of the jpeg image is appropriate (the image is
> a form that basically fills in the entire 8.5in X11.0in boundary).
> However when I process the file in FOP the size of the JPEG image gets
> increased by approximately 400%

JPEG images are bitmaps. FOP renders bitmaps at a fixed resolution of
72dpi in absence of an explicit widht/height specification, which
unfortunately can't be provided for background images. Any metadata in
the bitmap file indicating another resolution is ignored. Your only
option to get FOP to display your JPEG background as intended is to
create a 72 dpi image. Alternatively, use SVG graphics.

J.Pietschmann

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

FW: Background Image Rendering

Levesque, Gary R
In reply to this post by Levesque, Gary R


Follow up to my previous post. If I place a 8.5 X 11.0 inch background
image in a document at with a native setting of 1700 X 2200 pixels..FOP
automatically blows the image up to 23.61 X 30.55 inches (hence the
reason I only see a portion of a enlarged image in the PDF output file).
When a regular JPEG image (not a background image) is placed into a
document you can assign attributes to control the physical size of the
image (i.e. <content-width="8.5in">), this will reset the dpi and
improve the image quality.  

Unfortunately size constraints cannot be applied to a background image.
So what I am after is if anyone knows a method for achieving a
background image with image quality higher than 72 dpi.  


Suggestions appreciated.

Gary




---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: FW: Background Image Rendering

J.Pietschmann
Levesque, Gary R wrote:
> Unfortunately size constraints cannot be applied to a background image.
> So what I am after is if anyone knows a method for achieving a
> background image with image quality higher than 72 dpi.  

Short answer: There is no such method for bitmapped images in FOP
0.20.5. Use SVG.

Longer answer: Hack the source. Not for the faint of heart, the 72dpi
constant may occur in several unrelated places (image dimension
calculation, image loader, PDF renderer).

J.Pietschmann

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]