Add Image to Jasper Report with Struts 2 and Hibernate

Hi I want to add image to jasper report[pdf] in the environment of Struts 2 framework and hibernate. I am trying
this for last couple of days, but i am unable to get the work done. if any body know the steps to add image to
jasper reports, please help me or if u have any tutorials please let me know. I am using iReport-nb-3.5.0 to generate jasper files.
Thanks in advance

Finally i found a way to add image to jasper report. It is pretty simple, just give the exact image location to the image expression. In your web application, the image location may vary so, dynamically set the image location from your model class. Also, make sure that your lib folder contains itext-1.3.1.jar. If your lib folder contains itext-1.3.1.jar and iText-2.1.3.jar u will get like: java.lang.NoSuchMethodError: com.lowagie.text.Image.plainWidth()F
So remove the iText-2.1.3.jar and keep only itext-1.3.1.jar, try this will work

Similar Messages

  • Jasper report with Struts2 and hibernate.

    Hey all!
    I'm new to Struts2, Hibernate and jasper report. I want to make a report using those tools. Can anybody pls help me by providing a step by step process for it?
    I'm using eclipse Ganymede IDE. And want to view report on page with two search criteria as start date to end date and an option choosing.
    Can any body pls response me for this?

    Yes you can, you'll need to create a new library in JDeveloper with the Jasper reports JARs.
    See: Re: JasperReport with Jdeveloper

  • How to add images to a report with action links

    I am working with Action Links between OBIEE 10.1.3.3 and EBS 11.5.10.2
    I would like to hide the action link URL with an image. Can someone point me to documentation for adding images to a report with action links.
    Regards,
    Manav

    I am working with Action Links between OBIEE 10.1.3.3 and EBS 11.5.10.2
    I would like to hide the action link URL with an image. Can someone point me to documentation for adding images to a report with action links.
    Regards,
    Manav

  • Add Image in ABAP Report

    Hi All,
    I want add image in ABAP Report.
    Please let me know how it can be done?
    Regards,
    Jagdish More

    Hi Jagdish,
    to upload the image follow these steps.
    1. Upload image in web repository.
    Go to Transaction SMW0 to upload the image in SAP web Repository. elect second radiobutton u201DBinary data for WebRFC applicationsu201D and click on find.
    2.     Click on Execute.
    3.     Click on Create and give the obj.name and description and click on import.
    once the image gets uploaded.in your program do the following
    1.     Create a Screen.Go to Layout and create Custom Control.I have named it as u2018CONTAINERu2019.
    2.     Declare container(Custom Control name),picture(child of Container) and url in Top of the program.
    data container type ref to cl_gui_custom_container.
    data picture type ref to cl_gui_picture.
    data url(256).
    3.     Now create the object Container and Picture.
    create object container
           exporting container_name = 'CONTAINER'.//name of the custom control
        create object picture
           exporting  parent = container
           exceptions error = 1.
    4.     Now we have to load the picture from the database which we have uploaded. For this we need to declare the following:-
      data query_table like w3query occurs 1 with header line.
      data html_table like w3html occurs 1.
      data return_code like  w3param-ret_code.
      data content_type like  w3param-cont_type.
      data content_length like  w3param-cont_len.
      data pic_data like w3mime occurs 0.
      data pic_size type i.
    5.     Refresh the Query table and give the name of Query table as u2018_OBJECT_ID_u2019 and value as the name of logo/Image which u have uploaded.Append the value in the Query Table.
      refresh query_table.
      query_table-name = '_OBJECT_ID'.
      query_table-value = 'ZLOGO.GIF'."name of logo
      append query_table.
    6.     Now call the function WWW_GET_MIME_OBJECT to get the logo/image which u have uploaded and call the function DP_CREATE_URL to create the url where the image is present.
    call function 'WWW_GET_MIME_OBJECT'
        tables
          query_string        = query_table
          html                = html_table
          mime                = pic_data
        changing
          return_code         = return_code
          content_type        = content_type
          content_length      = content_length
        exceptions
          object_not_found    = 1
          parameter_not_found = 2
          others              = 3.
      if sy-subrc = 0.
        pic_size = content_length.
      endif.
      call function 'DP_CREATE_URL'
        exporting
          type     = 'image'
          subtype  = cndp_sap_tab_unknown
          size     = pic_size
          lifetime = cndp_lifetime_transaction
        tables
          data     = pic_data
        changing
          url      = url
        exceptions
          others   = 1.
    7.     Finally we have to upload the image from the URL, this can be done by calling the method: picture->load_picture_from_url
    call method picture->load_picture_from_url
    exporting
    url = url.
    Now Save,Activate and Execute the Program , Image/Logo got successfully uploaded.
    I have already done this program and uploaded the image...
    this will surely help you
    Thanks and regards,
    Tanmaya

  • Can i add JPanel to Jasper Report

    I have a panel on which I have drawn some graphics and now I want this panel to be added on report, is this possible?
    Can we add Jpanel to Jasper report, if anybody has any thoughts and ideas please share with me?
    Thanks & regards,
    - Prashant

    Don't know exactly what you mean but this is how I add a JPanel to a JScrollPane.
    public class Scroll extends JFrame{
    JScrollPane jsp;
    JPanel panel;
    public Scroll(){
    jsp = new JScrollPane();
    panel = new JPanel();
    jsp.getViewPort().add(panel);
    getContentPane().add(jsp, BorderLayout.CENTER)
    }

  • Using jasper Reports with Tomcat5.5

    hi ,
    i am trying to use Jasper Reports with Tomcat 5.5 but not able to do it.
    i have written a simple java program to read data from MySql database and generate a report in PDF format. the good thing is that when i am doing this as a independent java program and running it in Eclipse3.2 then its working fine. but i am not able to run it as a sevlet thru Tomcat5.5.
    any help ? is there any issue with version ...
    i am using JDK 1.5 , Tomcat5.5
    regs,
    sajid

    i am not able to figure it out. usually all web app picks files in WEB-INF folder . see below the exception ....
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    javax.servlet.ServletException: Servlet execution threw an exception
         org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
    root cause
    java.lang.VerifyError: (class: net/sf/jasperreports/engine/xml/JRXmlDigesterFactory, method: configureDigester signature: (Lorg/apache/commons/digester/Digester;)V) Incompatible argument to function
         net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:202)
         net.sf.jasperreports.engine.JasperCompileManager.compileReport(JasperCompileManager.java:195)
         com.iflex.poc.reports.ReportManager.generateReport(ReportManager.java:25)
         com.iflex.poc.reports.ReportServlet.doGet(ReportServlet.java:15)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
    note The full stack trace of the root cause is available in the Apache Tomcat/5.5.16 logs.

  • Is there any ECC report with PurchOrder and Purchase Requisition Selection

    Hi there,
    for one of my BI report reconciliation with ECC requirement, I would like to know how many POs are there without Purchase requisitions, same way want to know how many POs are there with Purchase requisition.
    I know some tables where we can find this info, unfortunately I cannot ask my user to go and check in Tables for Acceptance testing. So I am looking for any standard ECC report with POs and PRs as Columns
    Due to time constraints, I cannot go build any ABAP queries in ECC at the moment,
    Any insights are greatly appreciated.
    Thanks

    Hi Curious ,
    Check if the following link is helpful. The link is from the SDN Wiki for creating a Z Report in R/3 for Purchase Requisition.
    http://wiki.sdn.sap.com/wiki/display/ABAP/PurchaseRequisitionDetail+Report
    Or try the following transactions:
    ME5A - Purchase Requisitions: List Display
    ME53  - Display Purchase Requisition
    ME53N - Display Purchase Requisition
    Hope this helps your cause.
    Regards,
    Kush Kashyap

  • I need to make a report with graphs, and generate an exit file to word

    I have to do the acquisition for a laboratory and to make inmediately a report with graphics and a constant test about the method of the experimentation

    Probably your best bet is to use ActiveX and control Word from LabVIEW, this way, you can act as you were using Word directly, automating all the steps to create your report. Look for examples in the developer zone, although there will be more examples relating Excel, that can show you the way to act. If you need to use this intensively, i think NI has created a Word toolokit that you can buy.
    For any particular question, just ask.
    Good luck

  • Connecting Crystal reports with dashboards and passing parameters

    Hi ,
    Can anyone have any document on Connecting Crystal reports with dashboards and passing parameters.
    I would appreciate for this.
    Thank You.

    Hi Ganesh,
    You can refer the following links for connecting Crystal reports with dashboards:
    Dashboard integration in Crystal Reports using flash variables | Clariba Blog
    https://websmp102.sapag.de/~sapidp/011000358700001426732009E/Xcelsius_EmbeddingInCR2008.pdf
    http://events.asug.com/2012BOUC/0315_Integrating_SAP_Dashboards_into_SAP_Crystal_Reports.pdf
    Regards,
    Renu

  • Enhancing Customer Reports with Commands and Parameters

    Hi All,
    I am implementing the mentioned tutorial. I have succesfully deployed the AccessStatisticApplication PAR on portal. While scheduling the report from Content Management -> Reports -> Running Reports, it is giving error "<b>Can't find bundle for base name com.sap.netweaver.km.stats.reports.DocumentAccessReport, locale en_US</b>". Has anyone faced the problem, can anyone please help to remove this runtime error.
    Related Link: <a href="https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/7d28a67b-0c01-0010-8d9a-d7e6811377c0">Enhancing Customer Reports with Commands and Parameters</a>
    Regards
    Poonam

    <i>True, the application property service is apparently not to be used for a real-life scenario</i>
    You can definitely use the application property service in production scenarios - it's used by other components in a standard KM install, i.e. out-of-the-box.
    <i>in our case it forced the server down with deadlocks. </i>
    This should definitely not happen! Did you get SAP support to take a look at this? Was it the most popular documents report that caused this, or some other custom code? There should be no such problem with this service, since it's been around for quite some time and in production use.
    <i>
    Even if the code sample is not to be used for real-life scenarios it could at least make use of something else than the application property service which isnt't optimal for this use.
    </i>
    The application property service is good for a lot of scenarios, so it is realistic to use in in real-life scenarios. The only time I have seen this approach (storing the number of hits on documents in the database) fail is in very high-load scenarios.
    <i>Could you provide me with a link to the documentation for the logging framework?</i>
    <a href="http://http://help.sap.com/saphelp_nw70/helpdata/en/d2/5c830ca67fd842b2e87b0c341c64cd/frameset.htm">Logging and Tracing</a> on help.sap.com and <a href="https://help.sap.com/javadocs/NW04S/current/en/index.html">Logging and Tracing API (J2EE Engine API)</a> for NW 7.0.

  • Connect jasper report with swing

    hai
    can any one tell me how to connect jasper report with swing plz.
    Thanks in advance.

    Thanks for your reply
    i tried the code you gave. but i get following error during runtime
    java.lang.NoClassDefFoundError: org/apache/commons/javaflow/bytecode/Continuable
         at java.lang.ClassLoader.defineClass0(Native Method)
         at java.lang.ClassLoader.defineClass(Unknown Source)
         at java.security.SecureClassLoader.defineClass(Unknown Source)
         at java.net.URLClassLoader.defineClass(Unknown Source)
         at java.net.URLClassLoader.access$100(Unknown Source)
         at java.net.URLClassLoader$1.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.net.URLClassLoader.findClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClassInternal(Unknown Source)
         at java.lang.ClassLoader.defineClass0(Native Method)
         at java.lang.ClassLoader.defineClass(Unknown Source)
         at java.security.SecureClassLoader.defineClass(Unknown Source)
         at java.net.URLClassLoader.defineClass(Unknown Source)
         at java.net.URLClassLoader.access$100(Unknown Source)
         at java.net.URLClassLoader$1.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.net.URLClassLoader.findClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClassInternal(Unknown Source)
         at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:402)
         at Report.runReport(Report.java:35)
         at Report.main(Report.java:47)
    Exception in thread "main" & this is the code i used
    import java.sql.*;
    import net.sf.jasperreports.view.JasperViewer;
    import net.sf.jasperreports.engine.xml.JRXmlLoader;
    import net.sf.jasperreports.engine.JasperCompileManager;
    import net.sf.jasperreports.engine.JasperFillManager;
    import net.sf.jasperreports.engine.JasperPrint;
    import net.sf.jasperreports.engine.design.JasperDesign;
    import net.sf.jasperreports.engine.JasperReport;
    import java.io.File;
    import java.io.OutputStream;
    public class Report {
         public static Connection connectDB() {
              Connection jdbcConnection = null;
              try {
                   Class.forName("com.mysql.jdbc.Driver");
                   jdbcConnection = DriverManager
                             .getConnection("jdbc:mysql://localhost/example?user=root&password=yspl");
              } catch (Exception ex) {
                   String connectMsg = "Could not connect to the database: "
                             + ex.getMessage() + " " + ex.getLocalizedMessage();
                   System.out.println(connectMsg);
              return jdbcConnection;
         public static void runReport() {
              try {
                   JasperDesign jasperDesign = JRXmlLoader
                             .load(new File("F:\\Reports\\testReport.jrxml"));
                   JasperReport jasperReport = JasperCompileManager
                             .compileReport(jasperDesign);
                   Connection jdbcConnection = connectDB();
                   JasperPrint jasperPrint = JasperFillManager.fillReport(
                             jasperReport, null, jdbcConnection);
                   JasperViewer.viewReport(jasperPrint);
              } catch (Exception ex) {
                   String connectMsg = "Could not create the report "
                             + ex.getMessage() + " " + ex.getLocalizedMessage();
                   System.out.println(connectMsg);
         public static void main(String[] args) {
              runReport();
    }why i occurs please tell me
    anticipating for your reply
    Thanks once again

  • Books on Struts and Hibernate

    Could anyone tell me the best(means best) books for Struts and Hibernate for beginner. As i've a sound knowledge of jsp and servlets, i would like to add this technology (Struts) in my project..

    Go to Amazon and type "Hibernate" into a search. You'll see all the Hibernate books available.
    "HIbernate In Action" is out of date now. There's a new one due out on 1-Nov if you can wait that long.
    %

  • Shelf ageing report with qty and value

    hi
    i want shelf ageing report with stock value and stock quantity together.
    or any other way to club together the reports which will having stock qty and stock value

    Hi,
        How about TRC:MB5M( Expiration Date List).   But the function is qty only.
       Maybe you have to make add on program.
    Regards,
       Gaito

  • Reports with jsp and excel?

    Hello all..
    I'm Struggling with my application when i need reports.. i use jsp and servlets. How can i build reports and load them into a excel spreadsheet?
    PD: i dont have time to work with jasper reports.. :/ so if there's a faster and easier solution please let me know!
    Thanks.

    JExcel and POI are commonly used

  • If image file not exist in image path crystal report not open and give me exception error problem

    Hi guys my code below show pictures for all employees
    code is working but i have proplem
    if image not exist in path
    crystal report not open and give me exception error image file not exist in path
    although the employee no found in database but if image not exist in path when loop crystal report will not open
    how to ignore image files not exist in path and open report this is actually what i need
    my code below as following
    DataTable dt = new DataTable();
    string connString = "data source=192.168.1.105; initial catalog=hrdata;uid=sa; password=1234";
    using (SqlConnection con = new SqlConnection(connString))
    con.Open();
    SqlCommand cmd = new SqlCommand("ViewEmployeeNoRall", con);
    cmd.CommandType = CommandType.StoredProcedure;
    SqlDataAdapter da = new SqlDataAdapter();
    da.SelectCommand = cmd;
    da.Fill(dt);
    foreach (DataRow dr in dt.Rows)
    FileStream fs = null;
    fs = new FileStream("\\\\192.168.1.105\\Personal Pictures\\" + dr[0] + ".jpg", FileMode.Open);
    BinaryReader br = new BinaryReader(fs);
    byte[] imgbyte = new byte[fs.Length + 1];
    imgbyte = br.ReadBytes(Convert.ToInt32((fs.Length)));
    dr["Image"] = imgbyte;
    fs.Dispose();
    ReportDocument objRpt = new Reports.CrystalReportData2();
    objRpt.SetDataSource(dt);
    crystalReportViewer1.ReportSource = objRpt;
    crystalReportViewer1.Refresh();
    and exception error as below

    First: I created a New Column ("Image") in a datatable of the dataset and change the DataType to System.Byte()
    Second : Drag And drop this image Filed Where I want.
    private void LoadReport()
    frmCheckWeigher rpt = new frmCheckWeigher();
    CryRe_DailyBatch report = new CryRe_DailyBatch();
    DataSet1TableAdapters.DataTable_DailyBatch1TableAdapter ta = new CheckWeigherReportViewer.DataSet1TableAdapters.DataTable_DailyBatch1TableAdapter();
    DataSet1.DataTable_DailyBatch1DataTable table = ta.GetData(clsLogs.strStartDate_rpt, clsLogs.strBatchno_Rpt, clsLogs.cmdeviceid); // Data from Database
    DataTable dt = GetImageRow(table, "Footer.Jpg");
    report.SetDataSource(dt);
    crv1.ReportSource = report;
    crv1.Refresh();
    By this Function I merge My Image data into dataTable
    private DataTable GetImageRow(DataTable dt, string ImageName)
    try
    FileStream fs;
    BinaryReader br;
    if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + ImageName))
    fs = new FileStream(AppDomain.CurrentDomain.BaseDirectory + ImageName, FileMode.Open);
    else
    // if photo does not exist show the nophoto.jpg file
    fs = new FileStream(AppDomain.CurrentDomain.BaseDirectory + ImageName, FileMode.Open);
    // initialise the binary reader from file streamobject
    br = new BinaryReader(fs);
    // define the byte array of filelength
    byte[] imgbyte = new byte[fs.Length + 1];
    // read the bytes from the binary reader
    imgbyte = br.ReadBytes(Convert.ToInt32((fs.Length)));
    dt.Rows[0]["Image"] = imgbyte;
    br.Close();
    // close the binary reader
    fs.Close();
    // close the file stream
    catch (Exception ex)
    // error handling
    MessageBox.Show("Missing " + ImageName + "or nophoto.jpg in application folder");
    return dt;
    // Return Datatable After Image Row Insertion
    Mark as answer or vote as helpful if you find it useful | Ammar Zaied [MCP]

Maybe you are looking for

  • GR/IRclearing in MR11 in case of exchange rate difference

    Hi Gurus, My client has got one issue on GR/IR clearing thru MR11. There is one PO with IR happend first( lets say on 01/01/2008) and then GR on 15/01/2008 . on the same day of GR , there is Goods return ( 15/01/2008) for complete good receitpt. Cred

  • White MacBook cracks, are they ever going to offer a perm. solution?

    I'm well aware of the issue of the White 15" MacBooks cracking, mine cracked on me, almost completely breaking my computer apart, even though I'm very careful. I called them w/2 weeks to go on my warranty and they fixed it, I should have been smart a

  • Why need to update ADF BC connection details for ensuring deployment??

    I know it is a ADF question but still posting in this forum as it was encountered deploying a BPM application on OBPM 11.1.1.6. I get a bpm project from the internet and decide to test it out on my local. The objective was to populate the payload of

  • PL/PDF EXAMPLE

    For creating PDF's using PL/PDF how would I pass a report that is say on page 4 to the PL/PDF methods? I'm able to create a simple "test page" by creating a pl/sql block before header loads. Now I need to determine how to pass the report itself to di

  • Problems to differentiate between attachments and embedded in an email

    In my code i have something like that to verify if the attachment is embedded or not: public static bool IsEmbeddedAttachment(Outlook.Attachment attachment) //Anexos que não são embedded são obrigatóriamente olByValue, porém os embedded podem ser de