Hi thomas,
i want to print my svg file with a pageFormat. So i use a printerJob for
a graphical print.
but i saw in(PrintTranscoder) the function
print(graphics,pageFormat,index) you want a graphics. But how to have a
graphics with the svgFile or the JpegFile
here my code :
/==================================================================/
//declaration variable
final String fichier =
"C:/stage(iftechnologie)/LegeFinal/Lege/sortieFluxfinal.svg";
final String sortie =
"C:/stage(iftechnologie)/LegeFinal/Lege/sortieFluxfinal.jpg";
try{
// Creation d un transcoder input
final String svgURI = new File(fichier).toURL().toString();
final TranscoderInput input = new TranscoderInput(svgURI);
// Creation d un transcoder output
OutputStream ostream = new FileOutputStream(sortie);
final TranscoderOutput output = new TranscoderOutput(ostream);
//methode d impression
//la methode marche par defaut, donc pas de choix de
format,et //pas de surcharge du graphic (printable,printerjob)
final PrintTranscoder fic = new PrintTranscoder();
/******************************/
String parser = XMLResourceDescriptor.getXMLParserClassName();
SAXSVGDocumentFactory f = new SAXSVGDocumentFactory(parser);
final Document doc = f.createDocument(svgURI);
PrinterJob printJob = PrinterJob.getPrinterJob();
PageFormat pf0 = printJob.defaultPage();
final PageFormat pf = printJob.pageDialog(pf0);
if (printJob.printDialog())
{
try{
//printJob.print();
SVGGraphics2D graph = new SVGGraphics2D(doc);
// le dialogue d’impression
fic.transcode(input,output);
fic.print((Graphics)graph,pf,0);
}catch(Exception pe){}
}
/==================================================================/
thanks.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]