Hello,
I'm using the code from the official web site to
tranform SVG to JPEG. The image is convert very well, but there are some
troubles with the text, especially, with the accent.
I see in the SVG file, that the caracter is written
in UTF8 type.
I'm using for that : xercesImpl-2.4.0.jar,
xml-apis.jar and batik-all-1.5.jar
If anybody have an answer, I will be happy to
receive it. I'm a little lost.
I could send you any exemple to show you the trouble. I can't send zip file
and my image file are to biggest with this forum
Thank's
Fred
here's, my code :
public static String getJpg(ExpressionContext
myProcessor, String repTravail, String filePath, String qualite)
//public static String getJpg(String repTravail, String filePath, String qualite) { System.out.println("->getJpg('" + repTravail + "','" + filePath + "','" + qualite + "')"); // Le fichier source filePath = repTravail + filePath; File f = null; // Si c'est deja du Jpeg ou Gif,
alors rien a faire. (FOP les accepte)
if (filePath.toLowerCase().endsWith(".jpg") || filePath.toLowerCase().endsWith(".gif")) { f = new File(filePath); if (f.exists()) { return filePath; } else { System.err.println("Fichier '" + filePath + "' introuvable !"); return ""; } } //Sinon, on essaye de la convertir en JPG. String imgDest = filePath + ".jpg"; // Génération
image
JPEGTranscoder t = new JPEGTranscoder(); //System.out.println("1");
t.addTranscodingHint(JPEGTranscoder.KEY_QUALITY,new
Float(Float.parseFloat(qualite)));
//System.out.println("DEB");
// 96dpi //float mult=0.2645833f; //t.addTranscodingHint(Transcoder. KEY_PIXEL_TO_MM, new Float(mult)); // 72dpi
//float mult=0.3528f; //t.addTranscodingHint(JPEGTranscoder.KEY_PIXEL_TO_MM, new Float(mult)); /*
System.out.println("DEB2"); System.out.println("MULT="+new Float(mult)); float larg=Float.parseFloat(largeur)*10; System.out.println("LARG="+new Float(larg)); Integer pixLarg=new Integer(new Float(mult*larg).intValue()); System.out.println("Pixel Largeur ='"+pixLarg.toString()+"'"); */
//t.addTranscodingHint(JPEGTranscoder.KEY_WIDTH,new
Integer(200)); FileReader filereader = null; OutputStream ostream = null; TranscoderInput input = null; TranscoderOutput output = null; try { //System.out.println("2"); filereader = new FileReader(filePath); input = new TranscoderInput(filereader); //System.out.println("3"); ostream = new FileOutputStream(imgDest); //System.out.println("4"); output = new TranscoderOutput(ostream); //System.out.println("5"); t.transcode(input, output); //System.out.println("6"); ostream.flush(); //System.out.println("7"); ostream.close(); filereader.close(); return imgDest; } catch (Exception e) { System.err.println("Error Transcode SVG->JPG '" + e.toString() + "'"); return ""; } } |
- Re: Tranform SVG to JPEG, font problem with text Frédéric Lanic
- Re: Tranform SVG to JPEG, font problem with text marcus.kalthoff
- Re: Tranform SVG to JPEG, font problem with text Frédéric Lanic