Screenshot Tab

UI Components for JSF
Post Reply
luisfernando-rf
Posts: 3
Joined: 02 Jan 2018, 19:26

02 Jan 2018, 19:32

Good afternoon, I need to do a feature that takes a print or save an image in some way, initially I made a method that executes a print screen on the button that I need and saves the image in the application, the problem is that it takes the print of everything my Desktop and I need the image just from a specific application tabview, could anyone help me?

Code: Select all

public void screenshot() throws AWTException, IOException {
    Robot robot = new Robot();
    Dimension tamanho = Toolkit.getDefaultToolkit().getScreenSize();
    tamanho.setSize(1450, 607);
    Rectangle rectangle = new Rectangle(tamanho);
    BufferedImage img = robot.createScreenCapture(rectangle);
    File out = new File("teste.jpg");
    ImageIO.write(img, "jpg", out);
     
    } static {
        System.setProperty("java.awt.headless", "false");   
}

Code: Select all

<p:tab title="Mapa" closable="false">
    <p:gmap id="gmap"
        center="#{trajetoController.latitudeInicial} , #{trajetoController.longitudeInicial}"
        zoom="10" type="HYBRID" style="width:100%;height:600px"
        model="#{trajetoController.rotaModel}">
    </p:gmap>
</p:tab>

kukeltje
Expert Member
Posts: 9605
Joined: 17 Jun 2010, 13:34
Location: Netherlands

03 Jan 2018, 14:11

This 'by accident' sort of works since you are running the client and the server on the same machine. It **always** makes a screenshot of the server. Totally not PF related. Check google on how to make a screenshot in a browser

luisfernando-rf
Posts: 3
Joined: 02 Jan 2018, 19:26

09 Jan 2018, 19:08

Good afternoon, I would like to know how to send an image of the component of primefaces "gmap" to jasper reports? It would also solve my problem.

kukeltje
Expert Member
Posts: 9605
Joined: 17 Jun 2010, 13:34
Location: Netherlands

09 Jan 2018, 21:36

See your 'other question'

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 17 guests