Hello,
I'm creating application that should print some objects from AutoCAD.
Images should be scaled so ex****ting to BMP is not a good solution
(but it works) :)
So I'm trying to print some vector formats like SVG, EPS. I think that
I should use BATIK, but display svg is easy with JSVGCanvas. It's
harder to print it or show it with some graphics like stuff created on
graphics2D.
Can somebody help me with this problem?
I have this code:
public class SolvePage implements Printable {
private ISolver solver;
private ImageObserver observer;
SolvePage(ISolver sol, ImageObserver aThis) {
solver = sol;
observer = aThis;
}
public int print(Graphics g, PageFormat pf, int page) throws
PrinterException {
Graphics2D g2 = (Graphics2D) g;
if (page > getPageCount(g2, pf)) {
return Printable.NO_SUCH_PAGE;
}
g2.translate(pf.getImageableX(), pf.getImageableY());
drawPage(g2, pf, page);
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
g2.setRenderingHint(RenderingHints.KEY_RENDERING,
RenderingHints.VALUE_RENDER_QUALITY);
// draw all tables
solver.drawPage(g2, new Rectangle2D.Double(pf.getImageableX(),
pf.getImageableY(), pf.getImageableWidth(), pf.getImageableHeight()),
observer);
// there should go code for draw images on this page
return Printable.PAGE_EXISTS;
}
}


|