Package org.geomajas.plugin.printing.component

Examples of org.geomajas.plugin.printing.component.PdfContext


      // The mapView is not scaled to the document, we assume the mapView
      // has the right ratio.

      // Write document title and metadata
      document.open();
      PdfContext context = new PdfContext(writer);
      context.initSize(page.getBounds());
      // first pass of all children to calculate size
      page.calculateSize(context);
      if (resize) {
        // we now know the bounds of the document
        // round 'm up and restart with a new document
        int width = (int) Math.ceil(page.getBounds().getWidth());
        int height = (int) Math.ceil(page.getBounds().getHeight());
        page.getConstraint().setWidth(width);
        page.getConstraint().setHeight(height);
        document = new Document(new Rectangle(width, height), 0, 0, 0, 0);
        writer = PdfWriter.getInstance(document, baos);
        // Render in correct colors for transparent rasters
        writer.setRgbTransparencyBlending(true);
        document.open();
        baos.reset();
        context = new PdfContext(writer);
        context.initSize(page.getBounds());
      }
      // Actual drawing
      document.addTitle("Geomajas");
      // second pass to layout
      page.layout(context);
      // finally render
      page.render(context);
      document.add(context.getImage());
      // Now close the document
      document.close();
      // convert to non-pdf format
      switch (format) {
        case PDF:
View Full Code Here

TOP

Related Classes of org.geomajas.plugin.printing.component.PdfContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.