0

In our Project we have already used snapshot() of the Class Node taking a "Screenshot" of a Javafx 8 table. The snapshot() function is always taking a Screenshot of the whole Node/Scene. It does work for the regular tables, but since we are using JFXtras agendatables, and ControlsFX spreadsheets, the snapshot function just takes a screenshot of the currently shown table with the scrollpane, and the rest of the table is just cut out.

How can i take a "full" Snapshot of these tables ?

  • Am I understanding it correctly that in essence you want to remove the scrollpane's viewport from the screenshot? Take a screenshot as if it were not present? – tbeernot Jan 26 '15 at 09:57
  • The scrollpane doesnt bother me that much, its just that the table is cut to the current View of the User. Thats why just 1/4 of the table is present on the image.. – Erik.k94 Jan 26 '15 at 10:29
  • I have spoken with the author of the Table control in JavaFX and he indicates that it is unlikely that a table in a scrollpane would not cut off to the visible cells. So your problem would be that Agenda and Spreadsheet per default use a scrollpane in their view. In that way it only is possible to screenshot such a control completely if the scrollpane can be grown to show all cells. – tbeernot Jan 26 '15 at 22:07
  • Could you provide an example of a JavaFX table in a scrollpane that still shows its full content on a screenshot? – tbeernot Jan 27 '15 at 06:29
  • Thanks! We were already guessing that the built in Scrollpane is the problem. Is there a way we can remove the build in scrollpane ? Normally we just wrap around our scrollpane manually for javafxTables. Is there a way i can change the spreadsheet/agenda to be able to take full-content screenshots? – Erik.k94 Jan 27 '15 at 09:08

1 Answers1

0

A screenshot is exactly what it suggest: an image taken of the screen exactly as it is shown. If nodes, no matter if they are rectangles, tables, agendas or spreadsheets, are only partially visible on the screen, a screenshot will capture only that what is visible.

Any other behavior would result in interesting behavior: suppose a table with 10.000.000 rows is shown through a scrollpane which only displays 10 rows. A screenshot would suddenly increase 1.000.000 fold. If there are other nodes displayed next to or below that scrollpane, where would they go? Do they move down as the scrollpane grows? Creating that screenshot would require a complete new layout, and actually populating those 10.000.000 rows as the table is being screenshotted.

If you want to screenshot more of a node inside a scrollpane, you need to increase the scrollpane's size. Compare it to Excel: creating a screenshot of your PC's screen only will include that part of the worksheet that was visible. If you want the whole worksheet you need to print it. So I suspect you are looking for a way to print Agenda / Spreadsheet. But that is not the question you are asking.

tbeernot
  • 2,473
  • 4
  • 24
  • 31
  • Our main goal is to add the Spreadsheet/Agendatable to a PDF. This is the reason why i wanted a Screenshot. Do you have a suggestion what i can do to add the tables into a PDF without taking a snapshot? – Erik.k94 Jan 28 '15 at 10:45
  • I've discussed this with the JavaFX guys and it seems there must be a dedicated print(PrintJob) method implemented, similar to what WebView has. Then you can print to a PDF or image and include that in a document. At this moment you need to make a screenshot, and if you want the whole contents of Agenda, you need to make it on a screen with a high enough resolution so that the scrollpane won't hide anything. On my 2560x1600 this is possible. – tbeernot Jan 29 '15 at 11:18
  • I have added an experimental print method to Agenda (8.0-r4-snapshot) in the spirit of what JavaFX's webengine does. Not sure if the output is what I hoped for. Printing in JavaFX is, ah, not impressive, or I am not doing it right. – tbeernot Feb 01 '15 at 16:37