pedro.riky Posted February 1, 2011 Share Posted February 1, 2011 Hi all i have a merged jasperprint with some document in lanscape and some in portrait, just because jasper is not able to preview a document with different orientation i have to export it.The problem is, that if i have a pdf document, i want to preview it but i don't want to open it with acrobat reader, so there is a solution that able me to open a pdf file without call an external application? Link to comment Share on other sites More sharing options...
shertage Posted February 1, 2011 Share Posted February 1, 2011 Hi,Indeed, if you need to create a document with different page orientations, the solution is to create several reports with a given page orientation, and then concatenate them using the batch export. The generated report is a single JasperPrint list object. This serializable JasperPrint object can be further visualized using the embedded JasperViewer tool, or exported to any available output format (HTML, PDF, etc).Once you exported the document to the PDF format, you can visualize the PDF file using a dedicated PDF viewer only, such as Adobe Reader. The JasperViewer tool cannot be used to view PDF files.Please take a look to the batchexport sample in the samples directory, to see an example of generated document with different page orientaions.Hope this helps,sandaPost Edited by shertage at 02/02/2011 15:06 Link to comment Share on other sites More sharing options...
pedro.riky Posted February 2, 2011 Author Share Posted February 2, 2011 Thank you very much Sanda!Have a nice day! Link to comment Share on other sites More sharing options...
pedro.riky Posted February 2, 2011 Author Share Posted February 2, 2011 Excuse me but i speak to early!I see the example but the exporter needs a output object like file,stream how i can get a jasperprint object? Thanks! Link to comment Share on other sites More sharing options...
shertage Posted February 2, 2011 Share Posted February 2, 2011 Compile your reports first, fill them, then add the resulting JasperPrint objects to a list. Set the JASPER_PRINT_LIST export parameter with your JasperPrint list.More about report design, compiling and filling can be found in this tutorial. You can find out in the batchexport sample how to set the JASPER_PRINT_LIST parameter (see the BatchExportApp.java file).HTH,sandaPS: It is recommended to read this post too. Link to comment Share on other sites More sharing options...
pedro.riky Posted February 2, 2011 Author Share Posted February 2, 2011 Hi i read the documentation and i used in past the exporte like this in the example dir: List jasperPrintList = new ArrayList(); jasperPrintList.add(JRLoader.loadObjectFromLocation("build/reports/Report1.jrprint")); jasperPrintList.add(JRLoader.loadObjectFromLocation("build/reports/Report2.jrprint")); jasperPrintList.add(JRLoader.loadObjectFromLocation("build/reports/Report3.jrprint")); JRPdfExporter exporter = new JRPdfExporter(); exporter.setParameter(JRExporterParameter.JASPER_PRINT_LIST, jasperPrintList); exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, "build/reports/BatchExportReport.pdf"); exporter.setParameter(JRPdfExporterParameter.IS_CREATING_BATCH_MODE_BOOKMARKS, Boolean.TRUE); exporter.exportReport(); but in this way i get a phisical file pdf and with the other output i have .xml,.xsl ecc file or maybe i have a inputstream;but i want a JasperPrint and preview it with a JRViewer.Excuse me but are two day that i'm going around on this problem and i don't find the solution. Link to comment Share on other sites More sharing options...
shertage Posted February 2, 2011 Share Posted February 2, 2011 Now I see the problem. I was thinking that you need to generate and see the PDF file ('Open pdf File' is the title).While the JasperPrint list gets exported as single PDF, XLS, etc document, the JasperPrint objects themselves are stored separately in a JasperPrint list only. And the JasperViewer can visualize only a JasperPrint at a time. Sorry for my misunderstanding. There is no possibility to visualize a list of JasperPrint objects using JasperViewer. But one could extend the JasperViewer class in order to accept an input JasperPrint list, and modify the next/previous buttons behavior in order to jump to the next/previous JasperPrint in the list.It could be a challenging task.Have a nice day,sanda Link to comment Share on other sites More sharing options...
pedro.riky Posted February 2, 2011 Author Share Posted February 2, 2011 Thanks again for your time! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now