Jump to content
We've recently updated our Privacy Statement, available here ×

JasperPrint object conversion/loading from XML using Virtualizer


jonneighbour76

Recommended Posts

Hi, I need to be able to convert some old jasperPrint objects stored in a database so they are compliant and up to date with the current version of jasper reports I am using (6.1.0). Part of the reason for doing this was that I found the 6.1.0 JasperViewer would not always render the old 3.7.4 jasperPrint objects. So to convert the old '3.7.4' jasperPrint objects to '6.1.0' jasperPrint objects I wrote a stand alone process to export the original 3.7.4 ones to XML (via xml exporter in jasperreports-3.7.4) and then read back in that XML (via jasperreports-6.1.0) at which point they seem to be converted as required.

JasperPrint jasperPrint = JRPrintXmlLoader.load(inputStream)

All seems well the reports can be viewed, however I then noticed that the jaserPrint objects were much larger than previously. On investigation it seems its because the newly created versions no longer use JRVirtualPrintPage objects (instead are JRBasePrintPage objects) whereas the original ones did. use virtualisation objects.

When generating reports I use a virtualizer and those jasperPrint objects are always created with JRVirtualPrintPage objects and the same size reports are created with a much smaller size of object. So I then tried to use the JRLoader.loadJasperPrint method in my stand alone process  however that has made no difference, the jasperPrint object returned is still set with JRBasePrintPage objects even though I specify the same virtualizer settings that I do when creating new reports which does create JRVirtualPrintPage objects

JasperPrint jasperPrint = JRLoader.loadJasperPrint(tempFile, new JRSwapFileVirtualizer(2, new JRSwapFile("c:virtualizer",4096,50))

Does anyone know how you can use a virtualizer to create a JasperPrint object from an existing jasperPrint object or XML representation of an existing jasperPrint object? The above seems to ignore the virtaulizer, the swap file is created but is always empty whereas when creating new reports via fill process the swap file is generated with content

Thanks in advance...

 

 

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Popular Days

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...