Well, it's not my code, so I don't really know it well.

However, it was like this:
      if ( mimeType.equals( MimeConstants.MIME_PDF ) )
      {
        transformer.setParameter( "imgpath", createUrl( 
St36Constants.getSt36BaseDirectory() ) );
        transformer.setParameter( "onlybib_at_path", areaTreeUrl );
      }
      else if ( mimeType.equals( MimeConstants.MIME_FOP_AREA_TREE ) )
      {
        transformer.setParameter( "onlybibitem", "yes" );
      } 

and I made sure that 'imgpath' is always set:

      transformer.setParameter( "imgpath", createUrl( 
St36Constants.getSt36BaseDirectory() ) );
      if ( mimeType.equals( MimeConstants.MIME_PDF ) )
      {
        transformer.setParameter( "onlybib_at_path", areaTreeUrl );
      }
      else if ( mimeType.equals( MimeConstants.MIME_FOP_AREA_TREE ) )
      {
        transformer.setParameter( "onlybibitem", "yes" );
      }

And now it works.

-----Ursprüngliche Nachricht-----
Von: Jeremias Maerki [mailto:[EMAIL PROTECTED] 
Gesendet: Donnerstag, 24. Januar 2008 15:49
An: fop-users@xmlgraphics.apache.org
Betreff: Re: AW: AW: AW: Image not available?

That makes no sense. The XSLT runs before FOP layout starts. There's no
interaction there. Either "src" has the right URI or not but there can't
be any difference between the two calls inside FOP because of that. If
the two calls are different all the same the reason must be another. Did
you manage to make it work? And if yes, what did you change?

On 24.01.2008 15:36:49 Lewis, Eric wrote:
> OK, thanks for the explanation.
> 
> As for 'imgpath', yes that's in our code, see my example below: 
> > > >   <xsl:template match="doc-page">
> > > >     <xsl:variable name="imageFile">
> > > >       <xsl:value-of select="concat($imgpath, @file)" />
> > > >     </xsl:variable>
> > > >     <fo:block>
> > > >       <fo:external-graphic content-height="scale-to-fit"
> > > > content-width="16.8cm" src="{$imageFile}" />
> > > >     </fo:block>
> > > >   </xsl:template>
> 
> 
> -----Ursprüngliche Nachricht-----
> Von: Jeremias Maerki [mailto:[EMAIL PROTECTED] 
> Gesendet: Donnerstag, 24. Januar 2008 15:33
> An: fop-users@xmlgraphics.apache.org
> Betreff: Re: AW: AW: Image not available?
> 
> On 24.01.2008 14:03:37 Lewis, Eric wrote:
> > Ok... while debugging I noticed that this function was called four times 
> > (for two images), which made me a bit suspicous.
> > It turns out that the PDF render class does a two-pass rendering, once to 
> > build the FOP are tree (I don't really know about this) and once to build 
> > the PDF itself.
> 
> During layout time, FOP gets only the intrinsic size of the image and
> the renderer later requests the image again but then needs the fully
> loaded image. The image doesn't need to be loaded fully during layout.
> It would only eat up memory for nothing. That's the reason for the
> "two-pass" approach.
> 
> > The problem was, however, that the parameter 'imgpath' was only set for the 
> > *second* pass.
> > So FOP was trying to resolve a path that didn't exist.
> 
> I don't understand. AFAIK, there's no parameter 'imgpath' anywhere in
> FOP 0.93. Is that in your code?
> 
> > Well, there's many ways to shoot yourself in the foot  ;-)
> > 
> > Thanks for your help!
> > Eric
> > 
> > -----Ursprüngliche Nachricht-----
> > Von: Jeremias Maerki [mailto:[EMAIL PROTECTED] 
> > Gesendet: Donnerstag, 24. Januar 2008 10:56
> > An: fop-users@xmlgraphics.apache.org
> > Betreff: Re: AW: Image not available?
> > 
> > Everything I try here works fine. I can't tell what's going wrong. I
> > think you have no other option than to go debugging into the
> > org.apache.fop.image.ImageFactory class (method: loadImage()).
> > 
> > On 24.01.2008 09:44:21 Lewis, Eric wrote:
> > > Hi Jeremias
> > > 
> > > Sorry, I should have written... I'm using FOP 0.93.
> > > 
> > > And no, I don't see any other error messages. The messages before and 
> > > after come from our own classes.
> > > 
> > > However, I set the log level to DEBUG, and this is what I see:
> > > 
> > > DEBUG PropertyMaker.findProperty: src, fo:external-graphic
> > > DEBUG Base: file:///C:/<path to my XSL>/ Href: CH00003788_iis0001.tif
> > > DEBUG File not found: file:/C:/<path to my XSL>/CH00003788_iis0001.tif
> > > ERROR Image not available: CH00003788_iis0001.tif
> > > 
> > > I don't know why it's searching for the image in my XSL directory first, 
> > > since the path is pretty much absolute.
> > > 
> > > Thanks for the image scaling information, it works great now!
> > > 
> > > 
> > > Best regards,
> > > Eric 
> > > 
> > > -----Ursprüngliche Nachricht-----
> > > Von: Jeremias Maerki [mailto:[EMAIL PROTECTED] 
> > > Gesendet: Donnerstag, 24. Januar 2008 09:13
> > > An: fop-users@xmlgraphics.apache.org
> > > Betreff: Re: Image not available?
> > > 
> > > Hi Eric
> > > 
> > > What FOP version are you currently working with?
> > > 
> > > If you're using current FOP Trunk, you may need to put JAI Image I/O
> > > Tools [1] into your classpath to have a TIFF codec. More on the new
> > > image support will appear shortly on [2] (which I forgot to update after
> > > changing). However, the "Image not available" should have been preceeded
> > > by another error message if the TIFF codec is missing. Are you sure
> > > there are no other error messages?
> > > 
> > > [1] https://jai-imageio.dev.java.net/
> > > [2] http://xmlgraphics.apache.org/fop/trunk/graphics.html
> > > 
> > > (more inline below...)
> > > 
> > > On 24.01.2008 08:50:28 Lewis, Eric wrote:
> > > > Hi
> > > > 
> > > > I'm trying to insert a couple of images into a document that's simple
> > > > but is created in a complex way.
> > > > Anyway, this is how I insert the images:
> > > > 
> > > >   <xsl:template match="doc-page">
> > > >     <xsl:variable name="imageFile">
> > > >       <xsl:value-of select="concat($imgpath, @file)" />
> > > >     </xsl:variable>
> > > >     <fo:block>
> > > >       <fo:external-graphic content-height="scale-to-fit"
> > > > content-width="16.8cm" src="{$imageFile}" />
> > > >     </fo:block>
> > > >   </xsl:template>
> > > > 
> > > > I get the following error (in this case 2 images):
> > > > ERROR Image not available: CH00003788_iis0001.tif
> > > > ERROR Image not available: CH00003788_iis0002.tif
> > > > 
> > > > However, the images are shown in the PDF.
> > > > 
> > > > If I output the path by using
> > > >     <fo:block>
> > > >       <xsl:value-of select="$imageFile" />
> > > >     </fo:block>
> > > > 
> > > > I get the following in the PDF
> > > > file:///C:/temp/CH00003788_iis0001.tif
> > > > ...
> > > > file:///C:/temp/CH00003788_iis0002.tif
> > > > 
> > > > The files are there, I can open them using the URL.
> > > > 
> > > > So why does FOP insist on not finding the images? I'm puzzled...
> > > > 
> > > > Oh, and while I'm at it, can anyone explain why this doesn't work?
> > > >     <fo:external-graphic content-height="scale-to-fit"
> > > > content-width="scale-to-fit" src="{$imageFile}" />
> > > > The image is not scaled, but is bigger than the page.
> > > 
> > > That's because you didn't specify the size of the image viewport
> > > (width/height or
> > > inline-progression-dimension/block-progression-dimension). Just
> > > specifying content-width/content-height like this will render the image
> > > at its intrinsic size, i.e. too big. Just try adding width="100%" which
> > > limits the image's size to the available width and the image will
> > > automatically be scaled down.
> > > 
> > > 
> > > > 
> > > > Thanks for any help,
> > > > Eric
> > > 
> > > 
> > > 
> > > 
> > > Jeremias Maerki
> > > 
> > 
> > 
> > Jeremias Maerki
> > 
> 
> 
> 
> Jeremias Maerki
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 




Jeremias Maerki


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to