FOP seems to think PNG Image is an SVG

"David Law via fop-users" <[email protected]> Thu, 19 Mar 2026 11:00:24 +0100
Newsgroups gmane.text.xml.fop.user
Message-ID <[email protected]>
--------------TDr1gnmTfGyRt20Ruqsn345c
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit

Hi Folks,

I'm reading a PNG Image in our custom ResourceResolver.

It works & finds its way into the resulting PDF.

But...
...org.apache.fop.image.loader.batik.PreloaderSVG reports an error:
/"Error while trying to load stream as an SVG file: Invalid byte 1 of 
1-byte UTF-8 sequence."
/
I've tried this...
return new Resource(MimeConstants.MIME_PNG, uri.toURL().openStream());

...but can't seem to find what type the Resource should have.
(also tried "PNG" & "png")

How can I tell FOP it's a PNG and not an SVG?

Thanks in advance,
DaveLaw
--------------TDr1gnmTfGyRt20Ruqsn345c
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 8bit

<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    Hi Folks,<br>
    <br>
    I'm reading a PNG Image in our custom ResourceResolver.<br>
    <br>
    It works &amp; finds its way into the resulting PDF.<br>
    <br>
    But...<br>
    ...org.apache.fop.image.loader.batik.PreloaderSVG reports an error:<br>
    <i>"Error while trying to load stream as an SVG file: Invalid byte 1
      of 1-byte UTF-8 sequence."<br>
    </i><br>
    I've tried this...<br>
    <font face="monospace">return new Resource(MimeConstants.MIME_PNG,
      uri.toURL().openStream());<br>
    </font><br>
    ...but can't seem to find what type the Resource should have.<br>
    (also tried "PNG" &amp; "png")<br>
    <br>
    How can I tell FOP it's a PNG and not an SVG?<br>
    <br>
    Thanks in advance,<br>
    DaveLaw
  </body>
</html>

--------------TDr1gnmTfGyRt20Ruqsn345c--