Search code examples
xsl-foapache-fop

Force Apache FOP to override image resolution?


Is there a way to configure Apache to ignore the DPI metadata that is stored in image files and use a specific value instead? or perhaps an attribute that can be used on the <fo:external-graphic> element?

Images are presented using the following:

<fo:external-graphic src="{concat('url(', string(@href), ')')}"
                     xsl:use-attribute-sets="image">
  <xsl:call-template name="imageSizeAttributes"/>
  <xsl:call-template name="idAttribute"/>
  <xsl:call-template name="roleAttribute"/>
</fo:external-graphic>

I have found that the best DPI value for source images is 110. If I save the images with 110 DPI then they are presented perfectly. If possible I would like to simply override this so that the DPI value store in the image file is not used.

I tried adding the following to the ".xconf" file but this did not appear to make any difference at all:

<source-resolution>110</source-resolution>

I also tried setting extreme values (0, 72, 200, 300, 600) to see if they had any influence, but they didn't.


Solution

  • It seems that I needed to add both of the following lines into my ".xconf" file:

    <source-resolution>110</source-resolution>
    <target-resolution>110</target-resolution>
    

    Additionally it seems that these configurations are only assumed for image files that do not include the DPI metadata.

    This is fantastic for me because Adobe Photoshop does not save the image DPI when using its "Save for Web & Devices" feature.