Problem After writing the Jfree chart into pdf

Hi All,
I am writing the Jfreechart object with my company logo into JSP and and setting the content type as "application/pdf". I am getting the error as
java.lang.IllegalStateException: getOutputStream() has already been called for this response.
I have searched for it in the google as well as sun forums for so many hours and i implements so many suggested solutions but i am unable to remove the exception.
The problem might be using response.getOutputStream() to get the output stream to in the response.
But while debugging the code I observed that I am getting the error after complete execution of the code ie. after displaying the pdf.
I am using JSF with JBoss portlets.
Could any one help me in solving this problem as soon as possible..
Thanks in advance.

I am using the fallowing code to write into response. After execution of all the code and after displaying pdf its throughing the exception
*OutputStream outStream = response.getOutputStream()*
//To get the logo path from propeties file
ResourceBundle resourceBundle = ResourceBundle.getBundle("imagepath");
                  String imagePath = resourceBundle.getString("imagepath");
                  Image image2 = Image.getInstance(imagePath);
                    image2.scaleToFit(100, 100);
                    PdfPTable pdfPTable =  new PdfPTable(2);
                    pdfPTable.getDefaultCell().setBorder(0);
                    PdfPCell cell = new PdfPCell(image2);
                    cell.setHorizontalAlignment(Element.ALIGN_LEFT);
                    cell.setBorder(0);
                    pdfPTable.addCell(cell);
                    pdfPTable.addCell("");
                  //get the Pdf writer object
               PdfWriter     writer = PdfWriter.getInstance(document, outStream);
                   document.open();
               document.add(pdfPTable);
                  PdfContentByte contentByte = writer.getDirectContent();
                  PdfTemplate template = contentByte.createTemplate(1200, 750);
                  Graphics2D graphics2d = template.createGraphics(600, 750, new DefaultFontMapper());
                  Rectangle2D rectangle2d = new Rectangle2D.Double(0, 0, 540, 700);
                  jfreechart.draw(graphics2d, rectangle2d);
                  graphics2d.dispose();
                  contentByte.addTemplate(template, 50, 25);
                  //setOldchartObject(chartInfoBean);
                  System.out.println("This is before closing th edocument.");
                  document.close();

Similar Messages

  • I set up the primary language to English while initializing the MBP, but at the log-in page, the language appears to be a foreign language I don't use, after restart, the language turned into English, has anyone come across the same problem

    I set up the primary language to English while initializing the MBP, but at the log-in page, the language appears to be a foreign language I don't use, after restart, the language turned into English, has anyone come across the same problem, and is that normal?

    i have a similar problem...It seems to be tied to my guest account. It is set to Japanese as primary language but my main login is set to English. I tried changing the guest account to english but the change won't hold. It always reverts to Japanese.

  • No Microsoft files listed in the settings "convert into PDF files"

    Hi, I wanted to convert different Microsoft Office files, but it doesn't work. There are no Microsoft files listed in the settings "convert into PDF files". I had the trial version of Adobe Acrobat Pro XI installed on a MAC in Windows that runs trough Parallels. Hope somebody can help. Thx

    Hi Rahul,
    many thanks for your suggestion.
    Yes, Parallels is a virtual machine on the top of MAC and I can see all files in the Windows Explorer. Also the ones I created on the MAC top with the Microsoft Office Software Word or Excel for MAC as well the ones I created earlier on a Windows PC.
    Unfortunately there is no possibility to convert files into PDF format with a click on the right mouse. And Adobe also doesn't open Word documents because it doesn't support this format.
    But nonetheless it wouldn't be a solution that I prefer to convert in adavance every single file in a PDF format. I need to create a PDF package from different formats.
    I assume this issue has to do something with MAC or Parallels, because this function of the Adobe Versions Acrobat 8 Pro and XI Pro work well on a Windows PC. I just don't understand why there are no Microsoft Office file formats listed in the Adobe settings. This settings also can't be changed. I tried to find out but couldn't find any hint for this problem thus I'm a bit at a loss... Maybe you have another idea?
    Regards
    Ly

  • Converting the WAD applications into PDF format

    Hi SAPians,
    I'm in need to convert WAD results into PDF Format using SAP BW 3.5 and Acrobat Reader 7.0. And I've referred some documents in Net, But,they gave ideas only for 3.5 and Acorobat 5 version.
    But i've to convert the WAD results into PDF format only by using Acrobat Reader 7.0. So, kindly let me know the steps to do so.
    Thanks in Advance.
    Jayaprakash J

    Hi Shahid syed,
    Thanks for your reply.
    It was very useful.
    But, i've askd the solution for sap bw 3.5 with Acrobat reader 7.0.
    So, plz let me knw if any solutions for that to make wad reports into pdf format.
    Points will be awarded.
    Thanks & Regards
    Jayaprakash J

  • Setting the UNIX file permissions after writing the file to a directory

    Hi Experts,
    Can we set the UNIX file permissions after writing the file to a directory using Receiver File Adpater in SAP PI 7.1 ?
    Thanks in Advance.
    Regards,
    Jyoti

    Hi
    you can use the option "Run Operatiing system Command after File Processing" in the file adapter.
    Thanks
    Rinku Gangwani

  • Can I insert the image file into PDF file  in Adobe X Standard ?

    can I insert the image file into PDF file in Adobe X Standard ?

    http://matt.coneybeare.me/how-to-make-an-html-signature-in-apple-mail-for-maveri cks-os-x-10-dot-9/

  • Not able save the mapping after writing the 4th UDF (in PI 7.1)

    Hi All,
    After writing the 4th UDF i am not able to save the mapping in PI 7.1, i am getting the following error "the length 3 of the array 'sortedFunctionKeys' is not equal to the number 4 of functions".
    Please let me know how to overcome this
    Regards
    Vinay P

    can you check the syntax of the UDF?
    seems there is some issue in it.
    Also sortedFunctionKeys is this part of the UDF? then make sure the logic is correct behind the code.

  • Problem in generating the Oracle report6i to PDF file.

    Hi guys,
    I had encounter problem in generating the Oracle report6i to PDF file. The Amount column once the report is genrated to PDF it double the amount reflected in the PDF file report. See sample scenarios below:
    Can anybody help me explain this issue how it really happens?
    Example:
    FROM ORACLE REPORTS6i :
    ITEM # PRODUCT AMOUNT
    1 PRINTER 5,000
    2 KEYBOARD 2,000
    TO PDF FILE :
    ITEM # PRODUCT AMOUNT
    1 PRINTER 10,000
    2 KEYBOARD 4,000
    Thank you.
    Lala

    Hi "LawlordsX",
    I do understand the issue, something seems to have messed up the Shell Extensions on the 2 Lenovo laptops you talked about.
    Could you please check if the 2 m/c(s) have an additional version of Office installed in parellal to Office 2007, say Office 2010 trial pre-installed on them. This can be verified via CONTROL PANEL > PROGRAMS AND FEATURES > Check for the versions of Office installed. If yes, please let me know the additional Office software version/type.
    Also, could you be more specific about the bitage of the system, i.e. whether the Windows 7 m/c is 32-bit or 64-bit?
    This can be checked from CONTROL PANEL > SYSTEM > Under "System" section check for "System Type".
    If converting multiple files at a time to PDF is an issue, as an alternate you could use FILE > CREATE > BATCH CREATE MULTIPLE FILES to workaround the problem for the time being.
    Thanks!

  • How do I save the Combine Files Into PDF steps?

    I have a set of steps that I would like to repeat in the Combine Files into PDF screen, but I can not figure out how to save that definition file. I am using Adobe Acrobat Pro 10.
    Thanks,

    Hi MarGal,
    Can you please elaborate what you actually want to perform.
    Also let us know what you mean by filing system.

  • How to download the script data into pdf file

    how to download the script data into pdf file
    i have one option to download the script data to pdf file --->rstxpdft4 program.
    i have one doubt how to use this proogram.or any function module to download the script data to pdf file.
    Thanks and regards,
    Sri.

    Hi      Sri Sai,
    I know one method to convert the sapscript to pdf file :
    first generate a Spool Request for the required Sapscript
    then goto transaction SP01 and copy the generated Spool Request number
    now execute the SAP report RSTXPDFT4
    here enter the copied Spool request number and the target directory into the parameters
    execute the report
    required pdf file will be generated into the target directory
    i hope it will help you out
    Please refer this simple program:
    http://www.sapdevelopment.co.uk/reporting/rep_spooltopdf.htm
    Reward points if found helpful....
    Cheers,
    Eshwar.

  • Printing problems after installing the Epson Printer Driver 2.16

    Has anyone experienced any problems after installing the Epson Printer Driver 2.16 through Software Update? I am having problems printing. It denotes an error message, specifically the rastertoescpii.app isn't working?

    Oops, wanted everyone to know that the driver that Software Update downloaded and installed was 2.18, not 2.16 (which was the last one that worked for me). I just got done downloading the 2.18 driver directly from the Apple support website and installing it. Guess what? My printer is now working and everything is fine. If you are having issues, I suggest this route. Guess I solved my own problem, but hope this helps someone else.

  • Problem after activating the ECC 6.0 DIMP

    I am getting the serious problem after doing the activation of this ECC 6.0 DIMP by installing some package.
    What the problem is that the tables which are having the table class W are giving the problems.
    Suppose whenever you are reterving data from this type of tables it is taking so much of time and finally a runtime error is coming showing TIME OUT.
    Might be after installing that package we have to regenerate the tables. and how to do that i don;t know.
    So all the tables which are having the table class W ,E and S are giving the problems.
    For eg table DD02l this is the table for table fields and when i am making some changes in this table by using access key and after that if i have to make activate
    it , it is going for short dump and similar cases are there for the tables of the condition type.
    Please give me your helpful answers to solve this issue.
    Thanks

    Hi
    From the command prompt following command i am executing
    <b>c:\dump\oracle\NT\IA64>sapserver.cmd</b>
    After executing the command Screen1 appears
    <b><i>Screen1</i></b>
    <b>**********************************************************************************
    Specify the drive letter of the local disk where
    you want to install the oracle software
    Local Disk Drive [C:]:D:
    SID (consists of 3 alphanumeric characters,
    starting with a letter (a...z)):D11
    ***********************************************************************************</b>
    After giving the parameter as shown in Screen1 the Screen2 will be popup and it stay for 2min and then close automatically and screen1 will come to normal prompt
    <i><b>Screen2</b></i>
    <b>***********************************************************************************
    Starting Oracle Universal Installer...
    No pre-requisite checks found in oraparam.ini, no system pre-requisite checks will be executed.
    Preparing to launch Oracle Universal Installer from C:\DOCUME1\ADMINI1\LOCALS~1\Temp\Orainstall2007-11-30_08-20-49PM. Please wait ...
    *************************************************************************************</b>
    I cant found what is actual problem why OUI is not starting
    Thanks and Regards,
    Vishal Kalekar

  • Why does the pop up window for a printable coupon only appears briefly (in the upper left corner) and then disappear, even after putting the web site into the Tools,Options,Content,Pop-Up Exceptions?

    I am at http://www.closys.com/samples_&_coupons/get_a_coupon.html and the pop up window for a printable coupon only appears briefly (in the upper left corner) and then disappears, even after putting the web site into the Tools,Options,Content,Pop-Up Exceptions. What gives and how can it be fixed. I have a time limit.
    Thanks for your solution.
    Dan

    Mha007:
    Sorry, but I have already tried this too and verified that the web addresses are listed as Allow, rather than Block. After restart there was no difference, I still get the disappearing pop-up windows.
    Thanks for offering suggestions though.
    Have you heard of any issues like this occurring based on the number of tabs that are open in Firefox?
    Just a thought, even though I have not heard of this as an issue before. I keep about 80 tabs open regularly, because of research that I am always conducting (I am a blogger, a writer/author, a technophile-especially Green Tech.,), email, work, etc.?
    I do have a check in the box for Firefox to let me know if the number of open tabs is causing slow down or other issues.
    Thanks for any help.

  • Problem with conversion of Vc output into PDF format

    hi all,
    In r/3 i created a RFC to get a company detail list.
    I am calling this RFC into iview.
    outputs of the iview are a char info field called 'REPTNAME' and a table which displays the list.
    i have created a button called 'PDF' on a table .
    for this button i have written a code like
    "pcd!portal_content!com.sap.gm.cnt!platform-add_ons!com.sap.ip.bi!iview u1!?QUERY="&STORE@REPTNAME&"&BI_COMMAND_1-EXPORT_FORMAT=PDF&BI_COMMAND_1-SHOW_EXPORT_DIALOG=X&BI_COMMAND_1-null="
    but when i am clicking this button , its takin me to another window of  cluster administration.
    i am not getting why this is happening.
    and i also don have idea about BI statements. i copied this code( For button) from existing Documents on VC provided on the site

    hi,
    yes i have gone only through this link..
    i tried every way..
    i have created a button using edit toolbar for table control.
    Using system action, and in hyperlink i have put the below formula in 'formula' window.
    i have come across a point i would like to discuss.
    and that is,
    If i enter
    "pcd!portal_content!com.sap.gm.cnt!platform-add_ons!com.sap.ip.bi!iview u1!?QUERY="&STORE@REPTNAME&"&BI_COMMAND_1-EXPORT_FORMAT=PDF&BI_COMMAND_1-SHOW_EXPORT_DIALOG=X&BI_COMMAND_1-null="
    this in formula for the button,
    after clicking the button it takes me to the cluster administration window
    and if i enter
    "pcd!portal_content!com.sap.gm.cnt!platform-add_ons!com.sap.ip.bi!iviews!com.sap.ip.bi.bexwebanalyzer?QUERY="&STORE@REPTNAME&"&BI_COMMAND_1-EXPORT_FORMAT=PDF&BI_COMMAND_1-SHOW_EXPORT_DIALOG=X&BI_COMMAND_1-null="
    it takes me to the exception error.
    if you observe these two ,there is a difference of
    ' com.sap.ip.bi.bexwebanalyzer '  this statement.
    so can you pls tell me wat this will be??

  • Problem with Installing the Oracle8i PO into Windows ME

    I think I have the same problem as some of you had. Recently, I bought the Oracle Book and it has 3 discs: 1 for Oracle Developer 6 for Win 95 or 98, 1 for Oracle 8i PO (release 8.1.5) for Win 95, also 1 for Win 98.
    My computer had no problem when I installed the Or. Developer. However, my computer won't allow me to install the Oracle 8i PO Win 98 disc. Instead of that, I have no problem of installing the Oracle 8i PO Win 95 disc. After I installed the Win 95 disc with all correct configuration according to the instructions, I can not CONNECT to the database. So, is this mean the Windows ME is compatible with the Win 95 disc? Or my computer is "screw up"? Because I know Win Me is very much the same as Win 98. If I installed the Win 98 disc, it should be ok. Anyway, I installed the Win 95 disc successful, but can not CONNECT.
    So if anyone can help me out, or need a specific error message, I will post up next time. For now, I think I already gave you guys a "head-ache"... sorry.... Thanks all! Wait for your helps guys!

    What drivers are you attempting to install?
    - Peter

Maybe you are looking for