Jfor 0.52 : external graphics

Anatoly Osiko <[email protected]> Mon, 03 Jun 2002 12:15:37 +0930
Newsgroups gmane.text.xml.jfor.general
Organization Herenow Solutions Pty Ltd
Message-ID <[email protected]>
I am looking for the solution of a strange problem with embedding
graphical
files (fo:external-graphic).

When conversion is invoked by executing shell script, all the processing
going OK,
rtf file is created.

Command line would be like the following:
/opt/jdk1.3.1/bin/java -classpath
<fullpath>/jfor/lib/xerces-1.2.3.jar:<fullpath>/jfor/lib/jfor.jar
ch.codeconsult.jfor.main.CmdLineConverter /tmp/rep784465287.fo
/tmp/rep784465287.rtf

However, if the same command is invoked from our application's cgi
script, in this particular case via
Perl's system call, the processing stumbles at exactly this line of
encodeJPEG (byte [] data) method of org.jfor.jfor.tools.jpeg.Encoder:

     Image image = Toolkit.getDefaultToolkit ().createImage (data);

Below is the error output content, where I included a lot my own
debugging stuff, plus
list of the System properties.

jfor V0.5.2 - see http://www.jfor.org
Converting XSL:FO file '/tmp/rep784465287.fo' to RTF output
'/tmp/rep784465287.rtf'...
jfor.INFO:jfor V0.5.2 - setting up conversion...
jfor.INFO:Parsing xsl:fo document...
jfor.DEBUG:The real URL :
http://loony:17858//document/display.cgi?doc_id=37
jfor.DEBUG:XXXXXXXX URL set for value
http://loony:17858//document/display.cgi?doc_id=37
jfor.DEBUG:The real URL :
http://loony:17858//document/display.cgi?doc_id=37
jfor.DEBUG:XXXXXXXX URL set for value
http://loony:17858//document/display.cgi?doc_id=37
jfor.DEBUG:The real URL :
http://loony:17858//document/display.cgi?doc_id=37
jfor.DEBUG:XXXXXXXX URL set for value
http://loony:17858//document/display.cgi?doc_id=37
jfor.INFO:Writing out RTF...
jfor.INFO:Writing image
'http://loony:17858//document/display.cgi?doc_id=37'.
jfor.DEBUG:Available for reading 1220 bytes
jfor.DEBUG:RtfExternalGraphic: before determining format ...
jfor.DEBUG:RtfExternalGraphic: url.getFile() :
//document/display.cgi?doc_id=37
jfor.DEBUG:RtfExternalGraphic: type : 51
jfor.DEBUG:RtfExternalGraphic: converting to type : 2
jfor.DEBUG:RtfExternalGraphic: before conversion
jfor.DEBUG:RtfExternalGraphic: data size : 1220

////////////////////////////////
-- listing properties --
java.runtime.name=Java(TM) 2 Runtime Environment, Stand...
sun.boot.library.path=/opt/jdk1.3.1_01/jre/lib/i386
java.vm.version=1.3.1_01
java.vm.vendor=Sun Microsystems Inc.
java.vendor.url=http://java.sun.com/
path.separator=:
java.vm.name=Java HotSpot(TM) Client VM
file.encoding.pkg=sun.io
java.vm.specification.name=Java Virtual Machine Specification
user.dir=/tmp
java.runtime.version=1.3.1_01
java.awt.graphicsenv=sun.awt.X11GraphicsEnvironment
os.arch=i386
java.io.tmpdir=/tmp
line.separator=
java.vm.specification.vendor=Sun Microsystems Inc.
java.awt.fonts=
os.name=Linux
java.library.path=/opt/jdk1.3.1_01/jre/lib/i386:/opt/jd...
java.specification.name=Java Platform API Specification
java.class.version=47.0
os.version=2.4.14
user.home=/home/anatoly
user.timezone=
java.awt.printerjob=sun.awt.motif.PSPrinterJob
file.encoding=ISO-8859-1
java.specification.version=1.3
user.name=anatoly
java.class.path=/home/anatoly/data/dev2.5/external/jf...
java.vm.specification.version=1.0
java.home=/opt/jdk1.3.1_01/jre
user.language=en
java.specification.vendor=Sun Microsystems Inc.
java.vm.info=mixed mode
java.version=1.3.1_01
java.ext.dirs=/opt/jdk1.3.1_01/jre/lib/ext
sun.boot.class.path=/opt/jdk1.3.1_01/jre/lib/rt.jar:/opt/...
java.vendor=Sun Microsystems Inc.
file.separator=/
java.vendor.url.bug=http://java.sun.com/cgi-bin/bugreport...
sun.cpu.endian=little
sun.io.unicode.encoding=UnicodeLittle
user.region=US
sun.cpu.isalist=

Encoder: encodeJPEG start
Encoder: size of data 1220

///////////////////////////////////////////

Note, I checked the size of data input to
 Image image = Toolkit.getDefaultToolkit ().createImage (data);  
And this size is exactly right. Well, despite it read using 
InputStream.availiable() method ( see bug highlighted in Message:
8686084 ).


//////////////////////////////////////////////////////
////////////////////////////////////////////////////

Just to compare the environment, here the error log when the command is
executed manually
(not via CGI script), and  where the images are embedded successfully:

jfor V0.5.2 - see http://www.jfor.org
Converting XSL:FO file 'rep784465287.fo' to RTF output 'summap.rtf'...
jfor.INFO:jfor V0.5.2 - setting up conversion...
jfor.INFO:Parsing xsl:fo document...
jfor.DEBUG:The real URL :
http://loony:17858//document/display.cgi?doc_id=37
jfor.DEBUG:XXXXXXXX URL set for value
http://loony:17858//document/display.cgi?doc_id=37
jfor.DEBUG:The real URL :
http://loony:17858//document/display.cgi?doc_id=37
jfor.DEBUG:XXXXXXXX URL set for value
http://loony:17858//document/display.cgi?doc_id=37
jfor.DEBUG:The real URL :
http://loony:17858//document/display.cgi?doc_id=37
jfor.DEBUG:XXXXXXXX URL set for value
http://loony:17858//document/display.cgi?doc_id=37
jfor.INFO:Writing out RTF...
jfor.INFO:Writing image
'http://loony:17858//document/display.cgi?doc_id=37'.
jfor.DEBUG:Available for reading 1220 bytes
jfor.DEBUG:RtfExternalGraphic: before determining format ...
jfor.DEBUG:RtfExternalGraphic: url.getFile() :
//document/display.cgi?doc_id=37
jfor.DEBUG:RtfExternalGraphic: type : 51
jfor.DEBUG:RtfExternalGraphic: converting to type : 2
jfor.DEBUG:RtfExternalGraphic: before conversion
jfor.DEBUG:RtfExternalGraphic: data size : 1220
-- listing properties --
java.runtime.name=Java(TM) 2 Runtime Environment, Stand...
sun.boot.library.path=/opt/jdk1.3.1_01/jre/lib/i386
java.vm.version=1.3.1_01
java.vm.vendor=Sun Microsystems Inc.
java.vendor.url=http://java.sun.com/
path.separator=:
java.vm.name=Java HotSpot(TM) Client VM
file.encoding.pkg=sun.io
java.vm.specification.name=Java Virtual Machine Specification
user.dir=/home/anatoly/data/dev2.5/external/jfor
java.runtime.version=1.3.1_01
java.awt.graphicsenv=sun.awt.X11GraphicsEnvironment
os.arch=i386
java.io.tmpdir=/tmp
line.separator=

java.vm.specification.vendor=Sun Microsystems Inc.
java.awt.fonts=
os.name=Linux
java.library.path=/opt/jdk1.3.1_01/jre/lib/i386:/opt/jd...
java.specification.name=Java Platform API Specification
java.class.version=47.0
os.version=2.4.14
user.home=/home/anatoly
user.timezone=
java.awt.printerjob=sun.awt.motif.PSPrinterJob
file.encoding=ISO-8859-1
java.specification.version=1.3
user.name=anatoly
java.class.path=./lib/xerces-1.2.3.jar:./lib/jfor.jar...
java.vm.specification.version=1.0
java.home=/opt/jdk1.3.1_01/jre
user.language=en
java.specification.vendor=Sun Microsystems Inc.
java.vm.info=mixed mode
java.version=1.3.1_01
java.ext.dirs=/opt/jdk1.3.1_01/jre/lib/ext
sun.boot.class.path=/opt/jdk1.3.1_01/jre/lib/rt.jar:/opt/...
java.vendor=Sun Microsystems Inc.
file.separator=/
java.vendor.url.bug=http://java.sun.com/cgi-bin/bugreport...
sun.cpu.endian=little
sun.io.unicode.encoding=UnicodeLittle
user.region=AU
sun.cpu.isalist=

Encoder: encodeJPEG start
Encoder: size of data 1220

Font specified in font.properties not found
[--symbol-medium-r-normal--*-%d-*-*-p-*-adobe-fontspecific]
Font specified in font.properties not found
[--symbol-medium-r-normal--*-%d-*-*-p-*-adobe-fontspecific]
Font specified in font.properties not found
[--symbol-medium-r-normal--*-%d-*-*-p-*-adobe-fontspecific]
Font specified in font.properties not found
[--symbol-medium-r-normal--*-%d-*-*-p-*-adobe-fontspecific]
Font specified in font.properties not found
[--symbol-medium-r-normal--*-%d-*-*-p-*-adobe-fontspecific]
Font specified in font.properties not found
[--symbol-medium-r-normal--*-%d-*-*-p-*-adobe-fontspecific]
Font specified in font.properties not found
[--symbol-medium-r-normal--*-%d-*-*-p-*-adobe-fontspecific]
Font specified in font.properties not found
[--symbol-medium-r-normal--*-%d-*-*-p-*-adobe-fontspecific]
Font specified in font.properties not found
[--symbol-medium-r-normal--*-%d-*-*-p-*-adobe-fontspecific]
Font specified in font.properties not found
[--symbol-medium-r-normal--*-%d-*-*-p-*-adobe-fontspecific]
Font specified in font.properties not found
[--symbol-medium-r-normal--*-%d-*-*-p-*-adobe-fontspecific]
Font specified in font.properties not found
[--symbol-medium-r-normal--*-%d-*-*-p-*-adobe-fontspecific]
Font specified in font.properties not found
[--symbol-medium-r-normal--*-%d-*-*-p-*-adobe-fontspecific]
Font specified in font.properties not found
[--symbol-medium-r-normal--*-%d-*-*-p-*-adobe-fontspecific]
Font specified in font.properties not found
[--symbol-medium-r-normal--*-%d-*-*-p-*-adobe-fontspecific]
Font specified in font.properties not found
[--symbol-medium-r-normal--*-%d-*-*-p-*-adobe-fontspecific]
Font specified in font.properties not found
[--symbol-medium-r-normal--*-%d-*-*-p-*-adobe-fontspecific]
Font specified in font.properties not found
[--symbol-medium-r-normal--*-%d-*-*-p-*-adobe-fontspecific]
Font specified in font.properties not found
[--symbol-medium-r-normal--*-%d-*-*-p-*-adobe-fontspecific]
Font specified in font.properties not found
[--symbol-medium-r-normal--*-%d-*-*-p-*-adobe-fontspecific]
Encoder: after createImage
Encoder: process start
Encoder: process end

........................................
 
jfor.DEBUG:RtfExternalGraphic: after encodeJPEG
jfor.DEBUG:RtfExternalGraphic: after conversion to jpeg
jfor.DEBUG:RtfExternalGraphic: before writing the data.
jfor.DEBUG:RtfExternalGraphic: reached the end of RTF image.
jfor.INFO:Done converting xsl:fo to RTF.
jfor.DEBUG:conversion took 8461 milliseconds.
Done writing RTF output 'summap.rtf'.



Thank you.

-- 
Anatoly Osiko
Analyst Programmer
Reservoir Team Ltd.

_______________________________________________________________

Don't miss the 2002 Sprint PCS Application Developer's Conference
August 25-28 in Las Vegas -- http://devcon.sprintpcs.com/adp/index.cfm