[ 
https://issues.apache.org/jira/browse/FOP-3301?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18066983#comment-18066983
 ] 

DaveLaw commented on FOP-3301:
------------------------------

ok, here's what happens:

{color:#000000}{color:#000000}org.apache.xmlgraphics.image.loader.ImageManager 
blindly iterates over Preloaders of the supported Image formats.
{color:#000000}PreloaderSVG{color} raises the Error Message, but concludes its 
not an SVG.
{color:#000000}PreloaderImageIO{color} then recognizes the Image as a PNG & 
returns a suitable ImageInfo.{color}{color}

{color:#000000}{color:#000000}Surely it would make sense to use the File 
extension, Mime-Type or Resource-Type to identify the Image format before doing 
the "blindly" bit?{color}{color}

 

> FOP seems to think PNG Image is an SVG
> --------------------------------------
>
>                 Key: FOP-3301
>                 URL: https://issues.apache.org/jira/browse/FOP-3301
>             Project: FOP
>          Issue Type: Bug
>          Components: image/png
>    Affects Versions: 2.11
>         Environment: Windows 10, Eclipse 2026-03, JDK 17
>            Reporter: DaveLaw
>            Priority: Minor
>             Fix For: main
>
>
> 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."_}}
> In...
> {code:java}
> ResourceResolver.getResource(final URI uri) throws IOException{code}
> ...I've tried the following...
> {code:java}
> return new Resource(MimeConstants.MIME_PNG, uri.toURL().openStream());{code}
> ...but can't seem to find what Type the Resource should have.
> (also tried null, "PNG" & "png")
> How can I tell FOP it's a PNG and not an SVG?



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to