Open PDF with commandLink

Hi,
I'm trying to generate and open a PDF file in a new window, but i'm having problems showing the file. My main doubt is what to return from the Action method:
The button:
<h:commandLink styleClass="commandLink" id="link1" target="_blank" action="#{pc_MyClass.doLink1Action}">
Open File                                   
</h:commandLink>The method doLink1Action:
StringBuffer sbFilename = new StringBuffer();
               sbFilename.append("filename_");
               sbFilename.append(System.currentTimeMillis());
               sbFilename.append(".pdf");
               resp.setContentType("application/x-download");
               StringBuffer sbContentDispValue = new StringBuffer();
               sbContentDispValue.append("attachment");
               sbContentDispValue.append("; filename=");
               sbContentDispValue.append(sbFilename);
               resp.setHeader(
                    "Content-disposition",
                    sbContentDispValue.toString());
               resp.setContentLength(baosPDF.size());
               ServletOutputStream sos = resp.getOutputStream();
               baosPDF.writeTo(sos);
               sos.flush();
               getFacesContext().responseComplete();It generates the PDF, but i don't know how to open it.
Hope you can help me.
P.S.: I need a solution that doesn't require invoking servlets.

I had encountered this problem earlier. Check your server log if you see an IllegalStateException.
This might be the solution: http://balusc.xs4all.nl/srv/dev-jep-pdf.html

Similar Messages

  • Can't open pdfs with Adobe Acrobat X

    I can't open pdfs with Adobe Acrobat X. I get this message:
      Warning: Distiller will not process .Log, .PDF or .JDF file extensions
    What do I need to do to be able to open .pdf files? I could open them previously.

    What are you getting the message in response to? Was this a creation of a PDF that resulted in the message? What are you using Distiller for? Distiller can only open PS and EPS files for processing to create a PDF.
    PDF files are opened in Acrobat. For opening PDFs, Distiller has nothing to do with the opening. So I really have no idea. It sounds like you may just be having a creation error since you mentioned a log file. If you were creating a PDF, have you checked the LOG file for the errors? The log file is usually located where you were going to create the PDF, but is created as Distiller processes the file (part of the general Acrobat creation process) and is deleted if successful.
    If you were trying to create, go back to the original application and print to file with the Adobe PDF printer. Then open that file in Distiller to create a PDF. Any errors will be shown in the window and an indication if the PDF was created or not.

  • Cannot open pdf with safari

    I cannot open pdf with safari

    Adobe Reader installed? If so, remove Reader.
    Macintosh HD > Library > Internet PLug-ins
    Look for these two files.
    AdobePDFViewerNPAPI.plugin
    AdobePDFViewer.plugin
    Right click those and select “Move To Trash’.
    Best.

  • How to use Adobe Reader, open pdfs with OS X 10.6.7?

    I just got a new MacBook Pro. When I try to download Adobe Reacer or open PDFs, I get messages that say this type of Mac doesn't support Adobe Reader. I use PDFs all the time.  How do I get around this?

    I am not being allowed to downoad/install Adobe Reader or open PDFs.  When I try to do either one, I get a message that this type of Mac doesn't support Adobe Reader.  I just talked to Apple Care. They told me how to open PDFs with another application andd referred me to Adobe for installation questions.  Thanks.

  • Can't open PDF with newest version of reader says it's not supported?

    Can't open PDF with new version says it's not supported?

    Since you don't answer my last question, all I can do is point you to https://helpx.adobe.com/acrobat/kb/pdf-error-1015-11001-update.html

  • Firefox not opening PDF with Adobe Reader for Mac

    I can't open PDF in Firefox with Adobe Reader for Mac, what should i do?

    I have come across this problem, but i have solved my problem. The default PDF viewer with Firefox browser on Mac is Preview, so you can't use adobe reader to open PDF files, if you want to use Adobe Reader to open pdf with Firefox on mac, you need set adobe reader as your mac's default pdf viewer. Do as follows:
    1. Select any PDF file and choose File > Get Info.
    2. Choose Adobe Reader as your default PDF files viewer from the Browser in Download Action window.
    3. Click OK to set Adobe Reader as your default PDF files viewer.
    If you want to learn more, you can go to this website,
    http://www.downloadatoz.net/download/adobe-reader-for-mac/
    http://www.downloadatoz.net/download/adobe-reader-for-mac/using-the-adobe-reader -plugin-with-firefox-on-mac_g.html

  • Windows 8.1 - problem opening pdf with reader

    Hi, I am using windows 8.1 (not touch). Every time I try to open a pdf with reader, it brings up a previous document and not the one i'm trying to open. As there are not many menu options with windows 8 I can only close it.
    Can someone tell me what I need to do to be able to open pdf files. Thanks in advance

    I am having the same problem. Did you ever get a workable solution or anxwer?

  • Unable to open PDFs with CR in the file name or folder name?

    We are unable to open any PDFs with capital CR in the title of the document or if they are stored in a folder with CR in the name of it. This is quite a large problem as we are a CRC (Cooperative Research Centre) and need to use this in most file and folder names.

    Can you please update to the latest version of Adobe Reader available i.e. 10.1.4 (By clicking on Help > Check For Updates from within the Reader application). This should fix your issue.

  • IE 8 "Runtime Error" trying to open PDF with Reader 9.5.1

    I've seen many variants of this problem on the forum.  Running Win7, IE 8, Firefox 14, and Reader 9.5.1.
    For some little while, I've had a problem opening PDF files from links on Webpages that I view in IE8.  I see the following Runtime Error message:
    More recently, I've seen a similar problem with Firefox 14.  The difference is that there's no error message with Firefox ... it opens a new tab, but the browser tab remains blank.
    Could the problem be from installing Reader 9.5.1 recently?  How do I back out that update, and resort to the previous version of Reader -- which ran error free?
    Thanks
    Jerry

    We created a small standalone test application, which just opens a PDF. Same issue was found, with just this one User. Here's the code:
    <?xml version="1.0" encoding="utf-8"?>
    <s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
            xmlns:s="library://ns.adobe.com/flex/spark"
            xmlns:mx="library://ns.adobe.com/flex/mx"
            width="1004" height="510" backgroundColor="#000000" creationComplete="windowedapplication1_creationCompleteHandler(event)">
    <fx:Script>
      <![CDATA[
       import mx.events.FlexEvent;
       protected function windowedapplication1_creationCompleteHandler(event:FlexEvent):void
        myHtml.location = "vt1_04_using_flash_builder.pdf";
      ]]>
    </fx:Script>
    <fx:Declarations>
      <!-- Place non-visual elements (e.g., services, value objects) here -->
    </fx:Declarations>
    <mx:HTML id="myHtml" left="10" right="10" top="10" bottom="10"/>
    </s:WindowedApplication>

  • Export to PDF from Autocad: Acrobat always opens PDF with 'layers panel and page' shown.

    Hello,
    Whenever I export to PDF from Autocad, Adobe Acrobat opens the PDF with the 'Layers Panel and Page' shown.
    Each time I have to manually go to 'Properties' and select 'Page only', close 'Properties' and close the PDF and select to save the changes, in order to show the just the page.
    Is there a way to make PDFs always export to 'Page only' automatically as default?
    Thanks!
    Ione

    Thakns Peter, I had seen this thread, but it doesn't really address my issue. I've exported individual chapters from the book file, all with success, so I know there isn't a file corruption issue.  The problem seems to do more with memory allocation/usage. 
    I have tried: quitting and then immediately exporting the file, and even rebooting and then relanuching and exporting.  Both of these allow me to get a few pages farther along, but still not through the entire book.
    I remember back in the day there used to be a setting for how much RAM/dis c space was allocated to a certain applicatino (I knowm it was a long time ago).  I didn't know if there might be something like this hidden somewhere

  • Open PDF with Parameters has no effect if PDF is already open

    Hello Users,
    I try to open a PDF at a named destination. This works fine. But if the PDF is already open and I change the nameddest-Parameter, nothing happens. The Document don't jump to the new destination:
    I try this on the DOS-Shell, finally I would like to open the PDF with VB.NET with "shellwait":
    acrobat.exe /A nameddest=Z1 c:\temp6\Test.pdf
    --> the PDF opens and jump to destination "Z1"
    acrobat.exe /A nameddest=Z2 c:\temp6\Test.pdf
    --> no jump to destination "Z2"
    Can anybody help ?
    Hagen

    You can use OLE automation or DDE messages. See the document 'Interapplication Communication API Reference'.

  • Cannot open pdf with IE/ windows 7.

    Dear friends, and those who understand better than I.  I have been working on this situation for over a week.  I cannot open pdf from the browser.  I tried the "patch " as discussed in a different forum, but still only get the link to open in a seperate white blank page.  Any ideas?  I dont mind going back to an older version other than 10.1.2. I just dont know how to do that either, as I have not had to work this in depth with any software for years.

    Thanks for responding to this matter.  When I double click the link to open the pdf... a new tab opens with a blank screen.  It is white.  When I try to refresh, nothing happens.  I have also tried to save/download the file, and open it through that way.  When asked to save the document "pdf" is not available.  Only "all files."  However when I try to retrieve it, it says download is not available, as in... it did not download or save. 
    1.  All web browser options are selected.  I have already tried to uncheck, one, and all of these boxes.  Still the same results. 
    2.  I have tried several URL... All of the documents I have tried to retrieve have been within a secured website, such as salliemae.com (trying to view a 1098 for my student loan), and mycheckfree.com (trying to view bills from ComED and Nicor Gas). 
    If I open an old pdf on my computer... I can still read that.   
    Thank you for your time and help.  Im so frustrated, and missing deadlines!

  • Opening pdf with android reader

    help! i have a new samsung galaxy 10.1 tab. i downloaded adobe reader app from google play store  i cannot open pdf documents created with windows 8  does anyone have a solution? when i attempt to open a pdf it says 'error cannot open document'

    What's,with,the,commas?
    If you have a tablet that runs full Windows 8 - not Windows 8 RT, which is limited.
    And if you install the full Adobe Reader for Windows, not the special Adobe Reader Touch for Windows 8.
    Then you will have the same features as a desktop.
    Unless they can't be accessed in touch mode, since it isn't a touch app.

  • Opening PDF with navigateToUrl on Android

    Hi,
    i'm developping an enterprise application in AIR on Android which show a list of PDF's on your device and should open them when you press on it.
    However, when using navigateToUrl for this purpose, it doesn't open the PDF in Adobe Reader (which is installed) but in another app, called HP IPrint.
    Even uninstalling HP IPrint, setting Adobe Reader as the default app for reading PDF files doesn't change this behaviour. It either opens it in HP IPrint, or if IPrint is not available not at all. Opening the PDF from outside the AIR app with Adobe Reader works fine however.
    Since openWithDefaultApplication is not supported under the mobile profile, how do I make AIR open PDF's in Adobe Reader?
    Thx in advance.

    Do you have the latest version of Adobe Reader installed?
    -Pahup

  • Issues Opening PDFs with Reader 10.1.5

    Since upgrade to Adobe Reader 10.1.5 our users have had problems opening PDF files. Most times it takes at least 5-6 attempts at trying to open the file and sometimes it just never opens. It doesn't matter if the PDF is in an email, local, on the network or on the Internet.
    For now, I have put them back on 10.1.4 with no issues. Any ideas if this is a known issue with 10.1.5 and if there will be a patch released soon?
    Windows 7
    Thanks!

    I am having a similar problem and was wondering if there is an update yet. I am running Windows 7 and Acrobat 9 Pro. I can open local PDFs in Acrobat. If I am in IE links for PDFs open in Acrobat, however, in Chrome PDFs don't open and I usually, eventually get this message:
    Also, when I tried to open Reader, I got a few messages that went by quickly that couldn't capture, but one said something like "looking for updates." Then nothing opened. However, when I opened Task Manager, I saw several processes for AcroRd32.exe *32.
    This has been going on for a couple of weeks and previously I have rebooted and this has sometimes fixed the problem. But this doesn't seem to work anymore. A couple of days ago I rebooted and was able to open Reader and run repair. It appear to fix the problem, but now it's back again and this time I am not even able to open Reader to run repair again.
    If there is no response in the short term, I will uninstall and reinstall to see if it corrects. If that doesn't work I will see if I can install an earlier version.

Maybe you are looking for

  • Mac Pro Boot Problems. Kona 3?

    I'm having booting problems with a Mac Pro. It's got a kona 3 card in one of the PCI slots, and we've been tinkering with it to try to get the audio to work right. However, I've been having huge problems whenever I try to restart the computer. After

  • FireWire out to HD

    I'm editing on my PowerBook (soon on my MacBook Pro) and I will be needing a way to monitor out to HD. In SD, I just use a cheap little camera to act as a pass-thru to my Broadcast monitor. Now that I have the HVX200, it doesn't allow FireWire pass t

  • Error during Production Order release

    Hi Experts, When I am releasing one production order follwoing messege appearing. Error during availability check for order xxxxx (see log) co02>goto> logs--> release Date 22000504 lies after the end of the valid factory calendar (please correct). I

  • Horizontal Scrollbar help

    Hello. I am trying to build a webpage with a fixed sized window in the centre of the page. Within this window I would like to display some photos I have taken. What I would like to happen is for people to be able to scroll right to view my pictures,

  • JVC Everio GZ-MC200 compatible?

    JVC Everio GZ-MC200 compatible with minimac? http://www.apple.com/macosx/upgrade/camcorders.html there is no my camcorder!