Re: How to avoid exception on Linux with document containing images ?

Dominique Schoenenberger <[email protected]> Wed, 27 Oct 2004 22:05:28 +0200
Newsgroups gmane.text.xml.jfor.general
Message-ID <[email protected]>
I use the following workaround: disable the re-creation of JPEG image 
(be sure to use only JPEG image !!).

In the following jfor class:

org.jfor.jfor.rtflib.rtfdoc.RtfExternalGraphic.java

replace in the "protected void writeRtfContentWithException()" method:

			if (to == ImageConstants.I_JPG) {
				try {
					//convert to jpeg
					final IJpegEncoder jpgEncoder = new 
JpegEncoderFactory().getEncoder();
                     data = 
jpgEncoder.encodeJPEG(graphicCompressionRate,data);
					type = to;
				}
				catch (JPEGException e) {
                     throw new IOException("JPEG conversion error, src = 
'" + url + "' (" + e + ")");
				}

with
			if (to == ImageConstants.I_JPG) {
				type = to;

and then rebuild jfor.

Dominique

On Oct 27, 2004, at 9:44 PM, Dominique Schoenenberger wrote:

> On linux, when generating a document containing images, jfor produce 
> an headless exception because it try to create an instance of the 
> Image class which is not supported on an headless environment like 
> Linux. A better way would be to work with BufferedImage.
>
> Why is jfor recreating JPEG image if the image is already a JPEG image 
> ?
>
>
> Dominique Schoenenberger
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by:
> Sybase ASE Linux Express Edition - download now for FREE
> LinuxWorld Reader's Choice Award Winner for best database on Linux.
> http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
> _______________________________________________
> jfor-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/jfor-users
>



-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click