1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
public static void main(String[] args) throws FileNotFoundException {
// Comment faire pour le format A3 du pdf
PDFGraphics2D graphics = new PDFGraphics2D(new FileOutputStream(FILE_OUT),
new Dimension(200, 200));
Properties properties = new Properties();
// properties.setProperty(PDFGraphics2D.ORIENTATION, "PORTRAIT");
// properties.setProperty(PDFGraphics2D.PAGE_SIZE, "A3");
properties.setProperty(PDFGraphics2D.PAGE_MARGINS, "0");
graphics.startExport();
graphics.setStroke(new BasicStroke(3));
graphics.setPaintMode();
graphics.setClip(0, 0, 297, 420);
//graphics.setBackground(Color.GRAY);
//graphics.setProperties(properties);
graphics.drawLine(0,0,200.0,0);
graphics.setColor(Color.GREEN);
graphics.drawLine(0, 10, 300, 10);
graphics.setColor(Color.CYAN);
graphics.drawLine(0, 20, 350, 20);
graphics.setColor(Color.black);
graphics.drawLine(0, 30, 570, 30);
graphics.setColor(Color.gray);
graphics.drawLine(1.0,-145.0,200.0,250.0);
graphics.drawLine(1.0,1.0,200.0,250.0);
graphics.drawLine(1.0,100.0,200.0,250.0);
graphics.endExport(); |