PDF file cannot be viewed from OA Framework page.

Hi all,
I have developed an OA Framework page which shall present an XMLP report in pdf within the browser.
When I click on my menu item which opens the oa page, the Open file.. diaglog appears. When I open or save the file (and thereafter opening if) the following error appears: _Acrobat could not open [filename] because it is either not a supported file type or because the file has been damaged._
I can open the file if I go to the server and copies the output file to my own machine.
The error that i'm describing is happening on the server and NOT in my development environment. I cannot get it to work at all on my own machine.
Some facts:
JDeveloper 9i RUP7
XML Publisher 6.5.3
APPS 11.5.10 CU2
The code:
package bksv.oracle.apps.bkfnd.bkrepgw.webui;
import oracle.apps.fnd.common.VersionInfo;
import oracle.apps.fnd.framework.webui.OAControllerImpl;
import oracle.apps.fnd.framework.webui.OAPageContext;
import oracle.apps.fnd.framework.webui.beans.OAWebBean;
import oracle.apps.fnd.framework.OAApplicationModule;
import oracle.apps.fnd.common.AppsContext;
import oracle.apps.fnd.framework.server.OADBTransactionImpl;
import oracle.apps.xdo.dataengine.Parameter;
import oracle.apps.xdo.oa.util.DataTemplate;
import oracle.apps.xdo.oa.schema.server.TemplateHelper;
import java.io.OutputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.FileInputStream;
import java.util.Properties;
import java.util.Calendar;
import java.text.SimpleDateFormat;
import com.sun.java.util.collections.ArrayList;
import com.sun.java.util.collections.Iterator;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.ServletOutputStream;
import oracle.cabo.ui.data.DataObject;
* Controller for ...
public class ReportGenerationCO extends OAControllerImpl
  public static final String RCS_ID="$Header$";
  public static final boolean RCS_ID_RECORDED =
        VersionInfo.recordClassVersion(RCS_ID, "%packagename%");
   * Layout and page setup logic for a region.
   * @param pageContext the current OA page context
   * @param webBean the web bean corresponding to the region
  public void processRequest(OAPageContext pageContext, OAWebBean webBean)
    super.processRequest(pageContext, webBean);
    String currentDateTime = ReportGenerationCO.now();
    String filename = "/home/appsamba/kkristoff/KKR_TEST_" + currentDateTime;
    //Get application context
    OAApplicationModule am = pageContext.getApplicationModule(webBean);
    AppsContext appsContext = ((OADBTransactionImpl)am.getOADBTransaction()).getAppsContext();
    DataObject sessionDictionary = (DataObject)pageContext.getNamedDataObject("_SessionParameters");
    HttpServletResponse response = (HttpServletResponse)sessionDictionary.selectValue(null,"HttpServletResponse");
    // Set the Output Report File Name and Content Type
    String contentDisposition = "attachment;filename=" + filename + ".pdf";
    response.setHeader("Content-Disposition",contentDisposition);
    response.setContentType("application/pdf");
    //Initilization//   
    try {
      ServletOutputStream os = response.getOutputStream();
      DataTemplate dataTemplate = new DataTemplate(appsContext, "CS", "BKCSSR");
     //Get Parameters
    ArrayList parameters = dataTemplate.getParameters();
     //set Parameter Values as ArrayList of oracle.apps.xdo.dataengine.Parameter
      Iterator it = parameters.iterator();
      while (it.hasNext())
         Parameter p = (Parameter)it.next();
         if (p.getName().equals("P_INCIDENT_NUMBER")) {
          p.setValue("369");
         if (p.getName().equals("P_REPAIR_ORDER_NUMBER")) {
          p.setValue("");
         if (p.getName().equals("P_REPORT_NAME")) {
          p.setValue("Service Request Overview");
         if (p.getName().equals("P_SERVICE_TYPE")) {
          p.setValue("ALL");
     dataTemplate.setParameters(parameters);
      dataTemplate.setOutput(filename + ".xml");
      dataTemplate.processData();
      OutputStream outputStream = new FileOutputStream(filename + ".pdf");
      InputStream inputStream = new FileInputStream(filename + ".xml");
      Properties prop = new Properties();
      // Process template
     TemplateHelper.processTemplate(appsContext, // AppsContext
     "CS", // Application short name of the template
     "BKCSSR", // Template code of the template
     "en", // ISO language code of the template
     "00", // ISO territory code of the template
     inputStream, // XML data for the template
     TemplateHelper.OUTPUT_TYPE_PDF, // Output type of the procesed document
     prop, // Properties for the template processing
     outputStream); // OutputStream where the processed document goes.
      String sByteArray = outputStream.toString();
      byte[] outputBytes = sByteArray.getBytes();
      response.setContentLength(outputBytes.length);
      os.write(outputBytes, 0, outputBytes.length);
      os.flush();
      os.close();
    inputStream.close();
    outputStream.close();
     } catch (Exception e)
        //throw new OAException("An Error has occured master: " + e.getStackTrace().toString(), OAException.ERROR);
   * Procedure to handle form submissions for form elements in
   * a region.
   * @param pageContext the current OA page context
   * @param webBean the web bean corresponding to the region
  public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
    super.processFormRequest(pageContext, webBean);
  public static final String DATE_FORMAT_NOW = "yyyy-MM-dd";
  public static String now() {
    Calendar cal = Calendar.getInstance();
    SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT_NOW);
    return sdf.format(cal.getTime());
Thank you in advance.
Regards
Kenneth
Edited by: Kenneth_ on 2010-07-30 12:58
Edited by: Kenneth_ on 2010-07-30 13:33

I have now found a solution to this problem. Thank god!
See the code below.
Thank you all for helping me getting this far.
Kenneth
package bksv.oracle.apps.bkfnd.bkrepgw.webui;
import oracle.apps.fnd.common.VersionInfo;
import oracle.apps.fnd.framework.webui.OAControllerImpl;
import oracle.apps.fnd.framework.webui.OAPageContext;
import oracle.apps.fnd.framework.webui.beans.OAWebBean;
import oracle.apps.fnd.framework.OAApplicationModule;n
import oracle.apps.fnd.common.AppsContext;
import oracle.apps.fnd.framework.server.OADBTransactionImpl;
import oracle.apps.xdo.dataengine.Parameter;
import oracle.apps.xdo.oa.util.DataTemplate;
import oracle.apps.xdo.oa.schema.server.TemplateHelper;
import java.io.OutputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.FileInputStream;
import java.util.Properties;
import java.util.Calendar;
import java.text.SimpleDateFormat;
import com.sun.java.util.collections.ArrayList;
import com.sun.java.util.collections.Iterator;
import java.io.ByteArrayOutputStream;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.ServletOutputStream;
import oracle.cabo.ui.data.DataObject;
* Controller for ...
public class ReportGenerationCO extends OAControllerImpl
  public static final String RCS_ID="$Header$";
  public static final boolean RCS_ID_RECORDED =
        VersionInfo.recordClassVersion(RCS_ID, "%packagename%");
   * Layout and page setup logic for a region.
   * @param pageContext the current OA page context
   * @param webBean the web bean corresponding to the region
  public void processRequest(OAPageContext pageContext, OAWebBean webBean)
    super.processRequest(pageContext, webBean);
    String currentDateTime = ReportGenerationCO.now();
    String filename = "/home/appsamba/kkristoff/KKR_TEST_" + currentDateTime;
    //Get application context
    OAApplicationModule am = pageContext.getApplicationModule(webBean);
    AppsContext appsContext = ((OADBTransactionImpl)am.getOADBTransaction()).getAppsContext();
    DataObject sessionDictionary = (DataObject)pageContext.getNamedDataObject("_SessionParameters");
    HttpServletResponse response = (HttpServletResponse)sessionDictionary.selectValue(null,"HttpServletResponse");
    // Set the Output Report File Name and Content Type
    String contentDisposition = "attachment;filename=" + filename + ".pdf";
    response.setHeader("Content-Disposition",contentDisposition);
    response.setContentType("application/pdf");
    //Initilization//   
    try {
      ServletOutputStream os = response.getOutputStream();
      DataTemplate dataTemplate = new DataTemplate(appsContext, "CS", "BKCSSR");
     //Get Parameters
    ArrayList parameters = dataTemplate.getParameters();
     //set Parameter Values as ArrayList of oracle.apps.xdo.dataengine.Parameter
      Iterator it = parameters.iterator();
      while (it.hasNext())
         Parameter p = (Parameter)it.next();
         if (p.getName().equals("P_INCIDENT_NUMBER")) {
          p.setValue("369");
         if (p.getName().equals("P_REPAIR_ORDER_NUMBER")) {
          p.setValue("");
         if (p.getName().equals("P_REPORT_NAME")) {
          p.setValue("Service Request Overview");
         if (p.getName().equals("P_SERVICE_TYPE")) {
          p.setValue("ALL");
     dataTemplate.setParameters(parameters);
      dataTemplate.setOutput(filename + ".xml");
      dataTemplate.processData();
      //OutputStream outputStream = new FileOutputStream(filename + ".pdf");
      ByteArrayOutputStream localByteArrayOutputStream = new ByteArrayOutputStream();
      InputStream inputStream = new FileInputStream(filename + ".xml");
      Properties prop = new Properties();
      // Process template
     TemplateHelper.processTemplate(appsContext, // AppsContext
     "CS", // Application short name of the template
     "BKCSSR", // Template code of the template
     "en", // ISO language code of the template
     "00", // ISO territory code of the template
     inputStream, // XML data for the template
     TemplateHelper.OUTPUT_TYPE_PDF, // Output type of the procesed document
     prop, // Properties for the template processing
     localByteArrayOutputStream); // OutputStream where the processed document goes.
      byte[] b = localByteArrayOutputStream.toByteArray();
      response.setContentLength(b.length);
      os.write(b, 0, b.length);
      os.flush();
      os.close();
    inputStream.close();
    localByteArrayOutputStream.close();
     } catch (Exception e)
        //throw new OAException("An Error has occured master: " + e.getStackTrace().toString(), OAException.ERROR);
   * Procedure to handle form submissions for form elements in
   * a region.
   * @param pageContext the current OA page context
   * @param webBean the web bean corresponding to the region
  public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
    super.processFormRequest(pageContext, webBean);
  public static final String DATE_FORMAT_NOW = "yyyy-MM-dd";
  public static String now() {
    Calendar cal = Calendar.getInstance();
    SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT_NOW);
    return sdf.format(cal.getTime());
}

Similar Messages

  • PDF Files Cannot Be "viewed" Today

    Yesterday and the day before I could "view" PDF internet files/forms - today I cannot. No problem using Firefox. My version of Adobe Reader is 7.0.8, also, have Adobe PDF Viewer plugin v 7.0.5. No changes have been made to my system. This is the web site I was using and the Window > Activity info.
    http://www.irs.ustreas.gov/pub/irs-pdf/f1040.pdf
    Activity: http://www.irs.ustreas.gov/pub/irs-pdf/f1040.pdf "Plug-in cancelled"
    My iBook is OK..

    Problem solved. Downloaded new Adobe Reader. Old Readed bad...

  • "This file cannot be viewed on mobile devices."

    Hi Acrobat.com,
    "This file cannot be viewed on mobile devices."
    I'm wondering why some of my files online aren't "viewable" with an iPhone (3Gs) and other files are readable.
    I noticed that files created (New) on Acrobat.com will not be displayed on the iPhone
    while files created on the workstation (Apple) work fine (on both platforms).
    Please, please, please, help me.
    PS: I searched the forum for an answer or similar post,
    without success. May be I din't use the right keywords ; - )

    Hi there,
    Thanks for posting; I'm sorry to hear that you're having trouble with the Acrobat.com mobile app. The error message that you're seeing (thanks for the screenshot here, very helpful) indicates that the file you're trying to open is not a PDF; the message will appear when you try to open a Buzzword document, for example, or some other filetype that can't be previewed on the iPhone app. We're doing our best to improve the quality of our mobile app, so keep the feedback coming - you can help us by suggesting your ideas for improvements or enhancements at our Ideas site:
    http://ideas.acrobat.com
    We get a lot of our inspiration from the ideas that users post there, so I encourage you to participate.
    Please let me know if you need any more information or assistance.
    Best regards,
    Rebecca

  • The PDF file I just got from my PDF Pack subscription is not right -- why?

    I use Word on the Mac. When I save my document as PDF I get a file bloated file almost 1 Gig long. I subscribed to PDF Pack in the hope of getting a cleaner, shorter file. And it is  --  2.1MB  --  ta-dah? NO!! It does not have the formatting that I want, and that my MAC PDF file has when viewed with Adobe Reader. I have carefully formatted my file to get clean ragged margins and good text blocks. But the file I just got from the subscription service is 5 pages longer (which means my Index is wrong), many pages are laid out differently, and ligatures are not used(!). I don't know what other details are wrong, but what I got is unusable. Money down the drain.
    Perhaps a forum member has a suggestion.
    Why doesn't Adobe provide a simple way to contact an Acrobat expert?

    --| "Contact an Acrobat Expert"
    You can visit the Adobe Support "portal" page and find the click through to open a trouble ticket. To get the ball rolling you'll need to provide your credit card information. Rest assured you will get expert support at a rate that reflects it.
    Or, here or at Acrobatusers.com you can ask a question where knowledgeable / experienced Acrobat users can provide suggestions or perhaps an answer.
    RE: Your question. You are creating a PDF with the online service's heuristics. While adequate for the routinely used "business" cases of documents anything somewhat "custom" can be expected to have an output in the PDF that is not, perhaps, spot on.  As to an Index  -- that's just not going to survive what amounts to a "file conversion".
    Be well...

  • The PDF file and slideshow view corrupted using iPhoto. Macbook air only get corrupted slideshow and Mac Mini both slideshow and PDF file is corrupted.

    The PDF file and slideshow view corrupted using iPhoto. Macbook air only get corrupted slideshow and Mac Mini both slideshow and PDF file is corrupted.

    Saving as a PDF file for some users have been a problem.  If you boot into  Safe Mode and run iPhoto you can create undamaged PDF files.  We don't know why the problem but this is a workaround.
    This problem prevents many from ordering books, calendars and cards since iPhoto creates PDF file of them for uploading and printing.  Booting into Safe Mode lets them successfully order those items.

  • Busrting pdf file cannot be open with Adobe Reader

    OBIEE 10.1.3.4 on Linux redhat 5.2. Configured busting to local file system in BIP, with file format PDF and HTML. The bursting query used is select distinct today KEY,'2297-hen' TEMPLATE,
    'RTF' TEMPLATE_FORMAT,'en-US' LOCALE,'HTML' OUTPUT_FORMAT,
    'FILE' DEL_CHANNEL,'/tmp/cmisout' PARAMETER1,
    'cmis_unmatched_'||to_char(sysdate,'yyyymmdd_hh24_miss') ||'.html' PARAMETER2
    from rpt2298
    union
    select distinct today KEY,'2297-hen' TEMPLATE,
    'RTF' TEMPLATE_FORMAT,'en-US' LOCALE,'PDF' OUTPUT_FORMAT,
    'FILE' DEL_CHANNEL,'/tmp/cmisout' PARAMETER1,
    'cmis_unmatched_'||to_char(sysdate,'yyyymmdd_hh24_miss') ||'.pdf' PARAMETER2
    from rpt2298The job ran successfully and two files generated in the target location. While the html files is OK but the pdf file cannot be opened with Adobe Reader. Verified that my Adobe Read is ok to open pdf files from other sources.

    Do you have any password or encryption settings in your Runtime Properties?I do not think so, but not sure. Is there a way to check it? Is there a properties file.
    Did I misunderstood it? but I can place both PDF and HTML files to the target location, the HTML filess are good only PDF files cannot be open by Adobe Read.

  • Some PDF files, cannot be opened by Preview version 6.0.1. The system ask me to upgrade the version and direct me to Adobe site

    Some PDF files, cannot be opened by Preview version 6.0.1. The system ask me to upgrade the version and direct me to Adobe site to install Adobe Reader

    Below a link to a file which is an application to canadian visist visa, you can find the link also in the folowing site:
    http://www.cic.gc.ca/english/information/applications/visa.asp.
    I ttried to open the PDF file form Web, and down loaded from web to my Mac, but in both attempts did not work, and I 've beem asked to upgrade to a later Adobe version from the site or from the PDF file.
    Application for Temporary Resident Visa [IMM 5257] (PDF, 338 KB)

  • Opening pdf file cannot complete command, not enough memory ram?

    while trying to open pdf file size of 117000 kb, photoshop CS6 cannot complete command, not enough ram memory.

    Yes, the pdf file can be viewed using Acrobat and AI.  But when opening in CS6, it show cannot complete the command, not enough enough memory.  I tried in edit menu>preference->performance -> Increase the Ram also cannot be open.

  • My Office Print Pro 8600 Plus will not print pdf files sent to it from an iPad using ePrint.

    My Office Print Pro 8600 Plus will not print pdf files sent to it from an iPad using ePrint.  I just get an error message when I go to the  HP Eprint centre.  It does print the cover e-mail but nothing else.  The attachment is not secure as far as I can see.  I have tried sending an attachment from my Mac and that worked fine.
    This question was solved.
    View Solution.

    Hello krnkln3.
    Are you trying to send the PDF as an attachment in an e-mail sent to the ePrint e-mail address of the printer or are you trying to print using the ePrint app?
    Try sending the same PDF document to the printer's ePrint e-mail address and let us know if that works. If this works but using the ePrint app is not working, maybe the ePrint app is not working fine with this PDF document (it could be due to it's size or something else). Remember that you can always use the e-mail ePrint address of the printer to send PDF documents as the processing is happening at the HP servers and not in your iPad as when you try to send it using the ePrint app.
    Cheers!
    Wixma.
    I am an HP employee.
    Say thanks by clicking the Kudos star in the post.
    If my reply resolved your problem, please mark it as as Accepted Solution so that it can be found easier by other people.

  • How to create pdf files in UNIX directory from oracle reports

    I would like to know how to create pdf files in UNIX directory from oracle reports.
    Thanks,

    Please make your question more clear . Also mention the reports version.
    1) If you are runnning reports in Unix, you can give
    .... destype=file desformat=pdf desname=<filename>
    in command line
    Please refer docs below.
    2) If by your question you mean
    "My reports server is running in Windows but I want to ftp my files to Unix after creating it"
    then the answer is that you can use pluggable destination "ftp"
    .... destype=ftp desformat=pdf desname=<ftp url>
    Pluggable destinations download
    http://otn.oracle.com/products/reports/pluginxchange/index.html
    Thanks
    Ratheesh
    [    All Docs     ]
    http://otn.oracle.com/documentation/reports.html
    [     Publishing reports to web  - 10G  ]
    http://download.oracle.com/docs/html/B10314_01/toc.htm (html)
    http://download.oracle.com/docs/pdf/B10314_01.pdf (pdf)
    [   Building reports  - 10G ]
    http://download.oracle.com/docs/pdf/B10602_01.pdf (pdf)
    http://download.oracle.com/docs/html/B10602_01/toc.htm (html)
    [   Forms Reports Integration whitepaper  9i ]
    http://otn.oracle.com/products/forms/pdf/frm9isrw9i.pdf

  • When attempting to open a hyperlink to a PDF file on the web from a Microsoft WORD for Mac 2011 (14.3.9) document, Safari 7.0 instead displays the file as text?

    When attempting to open a hyperlink to a PDF file on the web from a Microsoft WORD for Mac 2011 (14.3.9) document, Safari 7.0 instead displays the file as text?

    As seen in http://answers.microsoft.com/en-us/mac/forum/macoffice2011-macword/has-the-word- 2011-for-mac-invisible-toolbars/018a3ab6-0570-4ad5-abf8-5b6427fdde3e?msgId=e111b f0a-0e32-4fa3-9536-f349dad8439d
    and it worked for me:
    1. Quit Word
    2. In the Finder's menu bar, select Go > Go to folder and type or paste: ~/Library/Preferences/
    3. Click on Go
    4. Locate the preference file com.microsoft.Word.plist, then Option-drag it to the desktop to create a backup copy
    5. Go to Applications/Utilities and open Terminal
    6. Paste the following bold command at the $ prompt (it's a single line):
         defaults write com.microsoft.Word 14\\Toolbars\\Show_HIToolbar -boolean TRUE
    7. Press Return and then quit with Command Q
    8. Start Word and test. If the fix works, trash the backup file in the Desktop file. Otherwise, restore it.
    In the original source the author also mentions the change in Word 2008

  • How to send a PDF file as a FAX from Oracle Reports 6i

    Hi
    I want to know how to send a PDF file as a FAX from Oracle Reports 6i. Or please post any sample code in reports that sends PDF document as FAX
    Help need immediately.
    Thanks in advance. my email id is
    [email protected]
    Arun
    null

    hello,
    there is no native support for directly faxing a report. you could e.g. use a fax-software that has a printer-driver that supports this.
    regards,
    the oracle reports team

  • Pdf-file with clickable links from iweb 09

    How can I create a pdf-file with clickable links from a website created in iweb 09?
    All iwork apps have an export button, which fulfills this task, but iweb does not.
    Any idea?

    I am running 10.5.6 on a MacBook Pro 2.53 GHz. I create my PDFs via the print dialogue. I tried to create a PDF from iweb with Hyperlinks activated and all links are dead. I tried to create the PDF from the Safari window, were all links are active, and – funny enough – sometimes all, sometimes half of my links are dead. But most of them do not work. As soon as I create PDFs from third party sites, everything works fine.

  • PDF files break up when scrolling down the page

    Embedded pdf files break up when scrolling down the page i.e.
    http://www.wight-cam.co.uk/WightCAM/HTML/2011/110321.htm

    Go to the "inspector"-click on the "table" icon-then "headers and footers" where you can set the number of headers or footers you want and click/unclick "freeze". You can also do that directly from the button bar on the "header-footer" buttons

  • When I try to open a PDF file in safari I get a grey page, I don't have this problem in Firefox

    When I try to open a PDF file in safari I get a grey page, I don't have this problem in Firefox?

    Tried reinstalling Adobe, didn't change anything.I've tried Control click when opening the PDF link, still a blank, grey page.

Maybe you are looking for

  • Cannot access MS office files on OS X partition from windows partition running bootcamp s

    I've installed a trial version of Microsoft Office 2010 on the Windows partition of my iMac.  Microsoft Office 2011 for Mac is installed on the OS X partition. When I try to open a file on the OS X partition an error displays saying the file is corru

  • Horizontal scroll bar not appearing-Alert report screen

    Hi All, I have an agent setup which shows alerts and a report is fed as an input/delivery content. The report is fairly big with many columns and cannot fit in the standard alert screen hence need a horizontal scroll bar to view all the columns. But

  • Data Maintenance Web Dynpro ABAP versus Classic ABAP

    I am working on a project where I will have to create a couple of custom master data tables. In classic SAP it is very easy to create standard table maintenance screens for master data via transaction SE54 where you can assign an authorization group

  • Connect to OWB from a client computer

    hi , i have installed Oracle 10g and owb 10 on my computer , i have a designed and implemented a WH on it . can another user from another computer (which have installed OWB 10 on it's computer ) connect to my computer as a client and work with it's s

  • Cannot open drawer on left to view folders

    I have tried to open it by clicking on the button in the centre of the left side. This shows the two opposing arrows which usually allow one to widen a column.I read that by quitting iPhoto and then opening the User folder you can access the Preferen