Question: Some of my company consultants created multiple jasper reports (using iReports) which will be filled up programmatically using a Custom JRDataSource.

The problem is that I need to know which Elements are present in the report so that I can invoke the corresponding WebServices, so my question is: *How can I programmatically, in Java, read the report so that I can identify every Element that needs to be filled up?*

The reports can't be made all programmatically because there will be constant changes to their layout, and we can't be updating our software every time one of this changes occurs.

Answer: 
First think of the purpose of the screenshot. You might be able to log the order of objects inside the folder before and after sorting them. Then you can use your logdata to produce an textual or graphical output showing a folder like image with the contents in presorted order.

If you take a screenshot how do you handle objects that do not fit inside the folder? With the above solution you will get information even of files not visible in an open folder.

Otherwise there will be no way to get a real screenshot of anything that is not on the screen. Opening the folder would be the easiest and only way then.
You could position the folder window outside of the bounds of his/her screen. Then take a screenshot of that window region.

You can determine the screen width and height and position (if you position a second screen to the left of your primary screen you start position of your screen is negative) using the following code:

```
System.Windows.SystemParameters.VirtualScreenWidth;  //Total width of screen
System.Windows.SystemParameters.VirtualScreenHeight; //Total height of screen
System.Windows.SystemParameters.VirtualScreenLeft;   //Start x location of screen
System.Windows.SystemParameters.VirtualScreenTop;    //Start y location of screen

```

And by placing your folder window outside of this region and then take a screen shot of that folder should do the trick. (Not sure not tested)

```
System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(folderWidth, folderHeight);
System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(bitmap);
g.CopyFromScreen(folderX, folderY, 0, 0, folderSize);
bitmap.Save(aRandomFileStream, System.Drawing.Imaging.ImageFormat.Jpeg);

```

Code provided as is... No warrenties if it works.