Dear Genies,
Currently I am in R&D and doing some research in PDF and SVG.
Especially I am trying to find a solution to convert SVG into PDF.
When I did a research on the Web I came across that one module of Batik
is also doing the same thing (Rasterizer).
Hi Shan,
The first thing to understand is that most of the PDF work is done by the PDFGraphics2D provided by FOP. So it is likely that you will get better answers to these sorts of detailed questions from them.
Q1) In SVG to PDF Conversion, is that the end result a print ready PDF ?
I have no idea what a print read PDF file is, so I can't say. :)
Q2) When converting the SVG into PDF, the Batik is uncompressing the
image data and creating the PDF with that raw data. So it is increasing
the PDF's size by many times. For example 8 kb SVG converted to 1.8 meg
PDF.
Any idea to compress the images in the output pdf when converting the
SVG into PDF.
I am under the impress that the FOP provided PDF Transcoder has special code to handle JPEG images, so they should be embedded 'as is' in the PDF file (not uncompressed and recompressed), unless some image processing needs to be applied to them (like filters, group opacity etc). I have been trying to verify this but due to recent updates I have had difficulty getting up-to-date versions of the code to talk to each other, and I haven't had the time to really sort the issue out (I think it's just a build issue on my end).
Q3) When converting SVG to PDF, the Tiff-CMYK and JPEG-CMYK are not
supported by Batik.
I had one SVG which is containing an image as I shown below.
------------------------------------------------------------------------
----------------------------------------------
<g transform="matrix(0.0000 -108.0025 -95.0422 0.0000 560.9800
563.2600)">
<image height="1" width="1" xlink:href="someCMYK.jpg" />
</g>
------------------------------------------------------------------------
----------------------------------------------
If I open this SVG in any SVG Viewer I can't see this image because SVG
spec is not supporting CMYK colour modal.
But if I convert this SVG to PDF it should create a PDF with this image
in it. But batik failed to do so.
What do you base is statement on? Why should viewing "enhanced" SVG be any different from transcoding "enhanced" SVG? I could see you _wanting_ it to work but I see no reason the standard says it should work.
Keep in mind that often the imagery _must_ be decoded, for example to handle group opacity or filters - So it is not like you can count on being able to just copy the JPEG data willy/nilly into the PDF file.
Looking at the error message for Tiff it might be that the Tiff reader isn't happy with the CMYK image - the code seems to have come up with a one band ColorModel for the CMYK data (which seems odd). However even if that part worked what it is trying to do when it dies is convert the CMYK image to SRGB - because that is the colorspace that all rendering is done in for SVG - this is likely at odds with your intent.
Sorry, I can't generally be more helpful.
------------------------------------------------------------------------
------------------------------------------------------------------------
--------------------
Converting vertright.svg to jpegtest\vertright.pdf ...
sun.awt.image.ImageFormat
Exception: Unsupported colour conversion request
at sun.awt.image.JPEGImageDecoder.readImage(Native Method)
at
sun.awt.image.JPEGImageDecoder.produceImage(JPEGImageDecoder.java:144
)
at
sun.awt.image.InputStreamImageSource.doFetch(InputStreamImageSource.j
ava:257)
at sun.awt.image.ImageFetcher.fetchloop(ImageFetcher.java:168)
at sun.awt.image.ImageFetcher.run(ImageFetcher.java:136)
------------------------------------------------------------------------
------------------------------------------------------------------------
--------------------
Then I have tried with one Tiff-CMYK image.
------------------------------------------------------------------------
------------------------------------------------------------------------
--------------------
<g transform="matrix(0.0000 -108.0025 -95.0422 0.0000 560.9800
563.2600)">
<image height="1" width="1" xlink:href="1-Tiff-CMYK-CMYK.tif" />
</g>
------------------------------------------------------------------------
------------------------------------------------------------------------
--------------------
and I got the error, please see the attachment for error message.
To do all these tests I am using the command line
java -jar batik-rasterizer.jar -m application/pd vertright.svg
Thanks for your help so far.
Shan
------------------------------------------------------------------------
Converting vertright.svg to tifftest\vertright.pdf ... java.lang.IllegalArgument Exception: Raster ByteInterleavedRaster: width = 225 height = 225 #numDataElemen ts 4 dataOff[0] = 0 is incompatible with ColorModel ColorModel: #pixelBits = 8 n umComponents = 1 color space = [EMAIL PROTECTED] transparenc y = 1 has alpha = false isAlphaPre = false at java.awt.image.BufferedImage.<init>(BufferedImage.java:549) at org.apache.batik.ext.awt.image.rendered.Any2sRGBRed.copyData(Unknown Source) at org.apache.batik.ext.awt.image.rendered.AbstractRed.getData(Unknown S ource) at org.apache.batik.ext.awt.image.rendered.AffineRed.genRect(Unknown Sou rce) at org.apache.batik.ext.awt.image.rendered.AffineRed.copyData(Unknown So urce) at org.apache.batik.ext.awt.image.rendered.FormatRed.copyData(Unknown So urce) at org.apache.batik.ext.awt.image.rendered.AbstractRed.getData(Unknown S ource) at org.apache.batik.ext.awt.image.GraphicsUtil.drawImage(Unknown Source)
at org.apache.batik.ext.awt.image.GraphicsUtil.drawImage(Unknown Source)
at org.apache.batik.gvt.RasterImageNode.primitivePaint(Unknown Source) at org.apache.batik.gvt.AbstractGraphicsNode.paint(Unknown Source) at org.apache.batik.gvt.CompositeGraphicsNode.primitivePaint(Unknown Sou rce) at org.apache.batik.gvt.AbstractGraphicsNode.paint(Unknown Source) at org.apache.batik.gvt.ImageNode.paint(Unknown Source) at org.apache.batik.gvt.CompositeGraphicsNode.primitivePaint(Unknown Sou rce) at org.apache.batik.gvt.AbstractGraphicsNode.paint(Unknown Source) at org.apache.batik.gvt.CompositeGraphicsNode.primitivePaint(Unknown Sou rce) at org.apache.batik.gvt.AbstractGraphicsNode.paint(Unknown Source) at org.apache.batik.gvt.CompositeGraphicsNode.primitivePaint(Unknown Sou rce) at org.apache.batik.gvt.AbstractGraphicsNode.paint(Unknown Source) at org.apache.batik.gvt.CompositeGraphicsNode.primitivePaint(Unknown Sou rce) at org.apache.batik.gvt.CanvasGraphicsNode.primitivePaint(Unknown Source ) at org.apache.batik.gvt.AbstractGraphicsNode.paint(Unknown Source) at org.apache.batik.gvt.CompositeGraphicsNode.primitivePaint(Unknown Sou rce) at org.apache.batik.gvt.AbstractGraphicsNode.paint(Unknown Source) at org.apache.fop.svg.PDFTranscoder.transcode(PDFTranscoder.java:287) at org.apache.batik.transcoder.XMLAbstractTranscoder.transcode(Unknown S ource) at org.apache.batik.apps.rasterizer.SVGConverter.transcode(Unknown Sourc e) at org.apache.batik.apps.rasterizer.SVGConverter.execute(Unknown Source)
at org.apache.batik.apps.rasterizer.Main.execute(Unknown Source) at org.apache.batik.apps.rasterizer.Main.main(Unknown Source) ... error (SVGConverter.error.while.rasterizing.file)
------------------------------------------------------------------------
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]