I want to get high quality images of my network created in Jung. ExportDialog of the FreeHEP VectorGraphics library gives this option in the form of a dialog box.
ExportDialog export = new ExportDialog();
export.showExportDialog(vv, "Export view as ...", vv, "export");
Where vv is the VisualizationViewer that I want to print out. I want to avoid choosing the file type and location everytime and automize the export so that the file is automatically saved to a folder as a pdf file. So I wrote the following code but it does not generate the picture that I want.
Properties p = new Properties();
p.setProperty("PageSize","A4");
VectorGraphics g = new PSGraphics2D(new File("Output.pdf"),vv.getSize());
g.setProperties(p);
g.startExport();
vv.print(g);
g.endExport();
Related links : Exporting JUNG graphs to hi-res images (preferably vector based) and http://java.freehep.org/vectorgraphics/Manual.html
To export pdf files:
VectorGraphics g = new PDFGraphics2D(new File("ResultImages/Output.pdf"), vv);