Jump to content
Changes to the Jaspersoft community edition download ×

mackensen

Members
  • Posts

    18
  • Joined

  • Last visited

mackensen's Achievements

Apprentice

Apprentice (3/14)

  • Week One Done
  • One Month Later
  • One Year In
  • First Post Rare
  • Collaborator Rare

Recent Badges

0

Reputation

  1. Hello, Is it possible to set the WillPrint or DidPrint actions when export to pdf from a java web application ? I mean....when the exported pdf stream opens in the web browser I need to count the clicks on the print icon (of the pdf) and put the clicks number in a database. There are some javascript actions (like WillPrint, DidPrint, etc...there's something here: http://www.appligent.com/docs-apjavascript-command ) that one can set with Adobe Pro but this can be done after the pdf is saved and opened with Adobe Pro, etc So, the question is : Is it possible to set these actions when exporting the document as a pdf stream ? Thankx, Mack Post Edited by mackensen at 04/16/2010 00:20
  2. After reading another post I found this solution...maybe somebody needs it (my report has only one page so indexPage=0): Code:out = response.getOutputStream(); if (printType==0) //if pdf stream { JasperExportManager.exportReportToPdfStream(jasperPrint, out); } else { // if jpeg image stream int pageIndex = 0; BufferedImage pageImage = new BufferedImage(jasperPrint.getPageWidth() + 1, jasperPrint.getPageHeight() + 1, BufferedImage.TYPE_INT_RGB); JRGraphics2DExporter exporter = new JRGraphics2DExporter(); exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint); exporter.setParameter(JRGraphics2DExporterParameter.GRAPHICS_2D, pageImage.getGraphics()); exporter.setParameter(JRExporterParameter.PAGE_INDEX, new Integer(pageIndex)); exporter.exportReport(); ImageIO.write(pageImage, "jpeg", out); } out.close();
  3. Hello, Is it possible to export a report as image stream ? I mean (pls see the code) from the JasperPrint to PNG or JPG but not to a saved image to harddisk, just as a stream. Now the export to pdf stream is ok. The final goal is to have the report as a preview (like a tooltip) at mouseover event. So it has to be generated on the fly and displayed in a div or something, without saving the image. Thankx, Mackensen Code: Post Edited by mackensen at 02/27/2010 21:43
  4. Yes, there's no datasource. It works now !!! Thanx a lot ! Mack
  5. Hello, I have a web app with Struts 1.2.9 and JasperReport 3.5.2. The problem is that when I create an Action to generate a pdf I get an empty pdf. I created the .jrxml file with iReport 3.5.2 and I put on it just a static text. I also tried to export to XML. I get the XML tree but there's only the name of the report so I presume that the path to the report is ok, I mean, the application gets the right report file. Below is the code: Thanx, Mack Code:public ActionForward printPdf(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { ServletOutputStream out=response.getOutputStream(); //i also tried with OutputStream response.setContentType( "application/pdf" ); JasperDesign jasperDesign=null; JasperReport jasperReport=null; String reportFile=""; reportFile=this.getServlet().getServletConfig().getServletContext().getRealPath("/reports/Print_indComm.jrxml"); Map parameters_header=null; parameters_header=this.getParametersHeaderPdf(idComm); //this method and parameter are defined try { jasperDesign = JRXmlLoader.load(reportFile); jasperReport = JasperCompileManager.compileReport(jasperDesign); JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, parameters_header); JasperExportManager.exportReportToPdfStream(jasperPrint, out); out.flush(); out.close(); } catch (Exception ex) { String connectMsg = "Could not create the report " + ex.toString() + " " + ex.getLocalizedMessage(); response.setContentType("text/html;charset=UTF-8"); PrintWriter out1 = response.getWriter(); out1.println(connectMsg); out1.close(); } return mapping.getInputForward(); }
  6. I did it !! I added a parameter to the main report: parameters_header.put("connection", conn.getConnection()); Then I set this as the connection for the subreport. Then I wrote the query in the subreport: It's the only way I found. See you, M
  7. I can now display the main report and subreport, both with datasource supplied from java code but I cannot "connect" the records of main report with those of the subreport, I mean all the records of the subreport come out as soon as the first record of the main record is displayed, instead of having some records of subreport for every record of main report. So, in the main report and subreport designed with iReport there is no SQL code; the main report has two parameters ("subReport" - type net.sf.jasperreports.engine.JasperReport and "datasource" - type net.sf.jasperreports.engine.data.JRBeanCollectionDataSource). The main code is: //for the main report parameters_header=generadatipdf.creaMapHeader(request); dataSource = generadatipdf.createReportDataSource(request, response); ServletContext context = this.getServletConfig().getServletContext(); File reportFileSubRep = new File(context.getRealPath("/reports/subreport.jasper")); JasperReport jasperReportSubRep=null; jasperReportSubRep = (JasperReport)JRLoader.loadObject(reportFileSubRep.getPath()); //for the subreport dataSourceSubrep=(Collection) generadatipdf.createSubReportDataSource(request, response); //the parameters for the main report parameters_header.put("subReport", jasperReportSubRep); parameters_header.put("datasource", new JRBeanCollectionDataSource(dataSourceSubrep)); jasperDesign = JRXmlLoader.load(reportFile); jasperReport = JasperCompileManager.compileReport(jasperDesign); ........... The problem now is how to "connect" the main report with the subreport. If somebody knows..... See you, Mackensen
  8. Hello, I have a web application with a main report that is ok. All the data comes from the servlet (including datasource) so there' s no SQL query or database connection in the main report. In the main report there is one subreport (or even two). How can I connect this subreport to a datasource (the same db connection as for the main report) and use some SQL query the same way as for the main report, I mean without SQL code inside the subreport ? The subreport should receive the id field from the main report as a parameter (for every record of the main report there are some records for the subreport). Thanx, mackensen
  9. Hello, I have a web application with a main report that is ok. All the data comes from the servlet (including datasource) so there' s no SQL query or database connection in the main report. In the main report there is one subreport (or even two). How can I connect this subreport to a datasource (the same db connection as for the main report) and use some SQL query the same way as for the main report, I mean without SQL code inside the subreport ? The subreport should receive the id field from the main report as a parameter (for every record of the main report there are some records for the subreport). Thanx, mackensen
  10. It still didn't work. I have a small servlet with this code: int i=0; Font[] fontlist=java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts(); Font unfont=null; for (i=0;i<fontlist.length;i++) { unfont=fontlist; out.println("Name:"+unfont.getName()+"---Family: "+unfont.getFamily()+"---FontName:"+unfont.getFontName()+"<br>"); } It displays a list of fonts like this: Name:39251---Family: 39251---FontName:39251 Name:Agency FB---Family: Agency FB---FontName:Agency FB Name:Agency FB Bold---Family: Agency FB---FontName:Agency FB Grassetto Name:Allegro BT---Family: Allegro BT---FontName:Allegro BT Name:Andale Mono---Family: Andale Mono---FontName:Andale Mono Name:Arial---Family: Arial---FontName:Arial Name:Arial Black---Family: Arial Black---FontName:Arial Black Name:Arial Black Italic---Family: Arial Black---FontName:Arial Black Corsivo Name:Arial Bold---Family: Arial---FontName:Arial Grassetto I simply took some fonts from here (the "Family" item) and put in the jrxml so the "Font name" and "pdfFontName" have the same name. It's right ? Thanx, Mackensen
  11. Sorry, I didn't study very much. I already found something to see the JVM fonts. But I still don't understand. I'm in a web application and I use just jsp, beans and servlet. So, I created the jrxml file and set the fonts with iReport and then the pdf is created with Jasperreport from a servlet. You say the problem is there when I set the fonts in iReport ? (in the Properties window, where there are 2 dropdown menus: "Font name" and "Pdf font name") ? These fonts should match ? If yes, how can I set the fonts dynamically, I mean if the application runs on another jvm ? Thanx again, Mackensen Post edited by: mackensen, at: 2008/02/28 11:05
  12. thanx, The jrxml I sent you it was just a test...I tried with many fonts...So, the problem is that the fonts don't match. How can I see what fonts has the JVM ? Or, better, is there a way to set the font dynamically on every JVM the program runs ? Thanx again, Mackensen Post edited by: mackensen, at: 2008/02/26 12:26
  13. Va salut, As vrea sa intreb, ce pot sa fac ca sa vad textul intreg (in textbox, in pdf) extras din database ? In sensul ca uneori se vede tot, alteori nu (lipsesc cateva cuvinte sau chiar o linie intreaga). Am incercat cu "property name="net.sf.jasperreports.print.keep.full.text" value="true", m-am uitat si in "Samples" si am citit si FAQ-urile. Trimit si fisierul jrxml. Multumesc, Mackensen Hello, I would like to ask, what can I do in order to see the whole text (in the textbox, pdf) from the database ? I mean, sometimes it's displayed ok but sometimes not (a few words missing or even 1 line). I tried with "property name="net.sf.jasperreports.print.keep.full.text" value="true", I also looked in "Samples" and I read the FAQ. Here is the jrxml. Thanx, Mackensen [file name=req_off-94669bb7e3b91b00ae72cbf6616f3442.jrxml size=21040]http://www.jasperforge.org/components/com_joomlaboard/uploaded/files/req_off-94669bb7e3b91b00ae72cbf6616f3442.jrxml[/file]
  14. Thanx...I almost solved the problem...but the textbox still doesn't display all the text...sometimes a line is missing, sometimes all the text is displayed. Here is the jrxml. [file name=req_off-a4d6cf7414bf335f75bfd759d946147d.jrxml size=21040]http://www.jasperforge.org/components/com_joomlaboard/uploaded/files/req_off-a4d6cf7414bf335f75bfd759d946147d.jrxml[/file]
  15. Sorry, I forgot the file. :-) [file name=req_off.jrxml size=21040]
×
×
  • Create New...