Re: Images over HTTP with no file extension
Hussein Shafie <[email protected]> Thu, 13 Feb 2014 15:00:02 +0100
| Newsgroups | gmane.text.xml.xfc.general |
|---|---|
| Message-ID | <[email protected]> |
On 02/13/2014 12:43 PM, Scott Neville wrote: > > Hopefully an easy question, we are currently looking at the XSL-FO converter > engine for turning XSL-FO into Docx files, the application we are interested in > using it in is essentially an image database. The idea here is that we would > have a docx document with a user defined selection of some of these images in > it. The application is web based and due to the number of images we have (and > security requirements), we dont just save the files on the file system, they are > references via an ImageServlet service with an image ID. So for example > > http://baseurl.com/ImageServlet?image_id=52 > > When using this with XSL-FO converter it reports the following: > > unsupported graphic format (line #9, column #473) > > However if I change the URL to be the following it works: > > http://baseurl.com/ImageServlet?image_id=52&file=.jpg This works only because the parsing of the URI by XMLmind XSL-FO converter seems to be sloppy. Normally specifying standard XSL-FO attribute "content-type" on the "fo:external-image" element would have solved the problem simply and cleanly. Example: <fo:external-graphic content-type="content-type:image/jpeg" src="url(http://baseurl.com/ImageServlet?image_id=52)" /> See http://www.w3.org/TR/xsl/#content-type > > However not all of our images are JPEG, Then there is no easy solution. > we support a number of different image > formats as the purpose of each image may be different, so the above solution > does not work when the image is not a JPEG. Our ImageServlet correctly sets > the content type of the image in the HTTP headers, so is it possible to have > XSL-FO converter use the content type in the HTTP header to decide what type > of file the image is? > No, not out of the box. *May* *be* you can develop a custom, smart, GraphicFactory which takes into account the Content-Type header found in the response of your Servlet and then register it with XMLmind XSL-FO converter. See http://www.xmlmind.com/foconverter/_distrib/doc/api/com/xmlmind/fo/graphic/package-summary.html Please note that helping you in implementing a custom GraphicFactory is out of the scope of normal support. Having access to the source code of the product would of course help. If you don't have it (it comes at no additional cost with the most expensive licenses), then we can nevertheless send you the source code of GraphicFactoryImpl.java, which is the default implementation normally used by XMLmind XSL-FO converter. --- PS: Our .NET edition has a .NET equivalent for GraphicFactory. -- XMLmind FO Converter Support List [email protected] http://www.xmlmind.com/mailman/listinfo/xfc-support