java - Screenshot of the full web page loaded into JavaFX WebView component, not only visible part -


I'm writing my first line of code after 2 years of managerial work, it's not time to read many docs, only There is a need to create proof of concept in a few minutes. So I have to work with JavaFX and need to provide functionality which allows to take a screenshot of the web page loaded in the webvive component. The problem is that I want a full screenshot of the whole page, not just the piece that fits in the current size of the current window. Here is a simple code that I use:

  WritableImage image = Browser.snapshot (new snapshot parametus (empty)); // browser javafx.scene.web.WebView file file = new file ("screenshot_fx.png"); {ImageIO.write (SwingFXUtils.fromFXImage (image, tap), "PNG", file); } Hold (IOException e) {e.printStackTrace (); }  

And it basically only captures what's visible on the screen. If the webpage needs to be scrolled - so I will not see the screenshot on the part. Please suggest moving forward

  try {robot pixelgrobe = new robot (); Buffer image bi = pixelgrauber .createcrycapture (new rectangle (x, y, width, height)); Image screen = SwingFXUtils.toFXImage (bi, new writing image (bi.getWidth), bi.getHeight ())); } Hold (AWTException pre) {ex.printStackTrace (); }  

By creating a screenshot starting with this pixel x * y, your required height and width is independent of the current size of your application window. If you are using JavaFX, then use swingfxutils to replace avt-image in java-x-image.


Comments

Popular posts from this blog

winforms - C# Form - Property Change -

javascript - amcharts makechart not working -

java - Algorithm negotiation fail SSH in Jenkins -