Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.gui > #3446
| From | "wookashs" <wookashs@THRWHITE.remove-dii-this> |
|---|---|
| Subject | How to print SVG or EPS ( |
| Message-ID | <5fc56055-c192-4e54-bdaf-aa92b068b87d@25g2000hsx.googlegroups.com> (permalink) |
| Newsgroups | comp.lang.java.gui |
| Date | 2011-04-27 15:44 +0000 |
| Organization | TDS.net |
To: comp.lang.java.gui
Hello,
I'm creating application that should print some objects from AutoCAD.
Images should be scaled so exporting 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;
}
}
---
* Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24
Back to comp.lang.java.gui | Previous | Next | Find similar | Unroll thread
How to print SVG or EPS ( "wookashs" <wookashs@THRWHITE.remove-dii-this> - 2011-04-27 15:44 +0000
csiph-web