Making pdf content downloadable via link in Iview problem

Hi,
I have been having problems with the following scripting code, where I have a link that when clicked makes a PDF file stored in the KM downloadable to the users local area.The file does download to the users desktop but when opened, the content is corrupt. So when a user clicks the view link the PDF document is loaded into the browser iframe with no issues. However when they click the download link they get the attached error.The file can be viewed properly through an  iframe in an iview on the portal but when downloaded via this script 'token missing' errors occur.
I have pasted the code and would appreciate any help offered.
Thanks
Rebecca
pResponse.write("<a onClick=\"blur(); downloadDoc('" + fileIds<i> +  "'); return false;\" href=\"javascript: void(0);\">");
                                   pResponse.write("<img src=\"" + docURL + downloadGif + "\" border=0 width=\"16\" height=\"20\" alt=\"Download\"></a></td>");
                                   pResponse.write("</tr>");
                         pResponse.write("</table>");
Generate the link to use for file downloads
                         IPortalComponentURI componentURI = pRequest.createPortalComponentURI();
                         componentURI.setContextName(downloadPCDPath);
                         String uri = componentURI.toString();
                         pResponse.write("<script>");
                         pResponse.write("function downloadDoc(docToDownload)");
                         pResponse.write("{");
                         pResponse.write("document.getElementById('downprint').src = '" + componentURI.toString() + "?rid=' + docToDownload; ");
                         pResponse.write("}");
                         pResponse.write("</script>");
                         pResponse.write("<script><!--\n");
                         pResponse.write("function changeURL(newurl) {\n");
                         pResponse.write("this.location.href = newurl;\n");
                         pResponse.write("}\n");
                         pResponse.write("//--></script>");
                         pResponse.write("<iframe name=\"downprint\" src=\"\" style=\"width: 0; height: 0;\"></iframe>");
                    } //end if
               printStyle(pResponse);
          } catch (AccessDeniedException ex) {
               ex.printStackTrace();
               mDbUtil.writeException(ex, pResponse );
          } catch (ResourceException ex) {
               ex.printStackTrace();
               mDbUtil.writeException(ex, pResponse );
          } catch(Exception ex) {     
               ex.printStackTrace();
               mDbUtil.writeException(ex, pResponse );

I am not quite sure what this is supposed to be doing, however, a better method would be to have a custom component which accepts a RID to a resource. This component would then read the content of the PDF (using its bytes) and write these bytes out to the HttpServletResponse output stream. You need to make sure that the HTTP header content-disposition is also set correctly (can't remember exactly what this should be, however, a quick google search should return the correct results).
This should be all you need to do I believe. Let me know if you need any help with this further
D

Similar Messages

  • Making .pdf files downloadable

    How do I make .pdf files downloadable in my iWeb page?
    I have several .pdf files on my desktop that I'd like to make available to visitors to my iWebsite for download. Please forgive me if this is "intuitively obvious." I am new to the forum and am also navigationally clumsy until I use it a while.

    You either need to Zip or Compress, as it is in 10.5 and then in iWeb click on Inspector and then Hyperlink and just create a hyperlink to a file. One someone clicks the link, it will then be downloaded as a Zip file containing the pdf.

  • Cannot read PDF files downloaded via acsm

    The app does not allow copying and reading the PDF downloaded via acsm delivery mechanism as it reports to be protected.  Is this known issue or needs to be treated like a feature request. On PC, you read this document via Adobe Digital Editions.
    Thanks, soujanna

    That is definitely a very old Reader version!  Uninstall it, then install the latest Reader for Vista, which is 10.1.9

  • PDF force download via jsp not possible in IE ??????????????

    Hi guys,
              I am providing a jsp page which when displayed will prompt the user to Open or Save or Cancel on a PDF file. For some reason, the code is not working in Internet Explorer. Its working in Opera, Mozilla, Mozilla Firefox. But not working in IE. However, in my organisation, only IE is used. Therefore its paramount that it works in IE. Pls help me.
              Im attatching the snnipet of code that i am using.
              <%@ page language="java"%>
              <%@ page import="java.io.*"%>
              <%
              File file = new File ("C:\\Documents\\List.pdf");
              response.setContentType ("application/pdf");
              response.setHeader ("Content-disposition", "attachment; filename=List.pdf");
              BufferedInputStream in = new BufferedInputStream(new FileInputStream(file));
              ServletOutputStream outs = response.getOutputStream();
              byte bytes[] = new byte[4096];
              int i = 0;
              try
              while ((i = in.read(bytes,0,4096)) != -1)
              outs.write(bytes,0,i);
              catch (IOException ioe)
              ioe.printStackTrace();
              in.close();
              outs.flush();
              outs.close();
              %>
              The problem is as follows:
              The name of the jpf that forwards the requet to the jsp is DownloadPDFController.jsp and the url in IE comes as http://localhost:8053/downloads/DownloadPDFController.jpf
              Now, when this jpf runs and the control comes to the jsp, the pop-up box comes with three options Open, Save and Cancel. But the name of the file to be saved is not the PDF file but the jpf file that is displaying the file.
              This means that what actually is happening is that , the pop download box is coming with the name DownloadPDFController.jpf. I cant understand why its trying to save the JPF.
              The funny bit is that this happens only in IE and not in any other browser.
              Please help !!
              Thanks guys,
              Nikhil

    Put this at start:
              out.clear();
              if it does not work then... are you using post or get... use Post if you are using get...

  • Online PDF landing page via links

    This is an odd How-To question, so here goes.  I have a document of about a dozen abstracted text records.  Each abstracted record, actually deeds from the 1700's, has the full image in a PDF file.  In my Word file I want to create a link to the internal page of the PDF.  For example:
    Daniel Shumat (Greenbrier Co.) to Jacob Miller (Bedford Co.) ₤300, 296 acres on both sides of north fork of Black Water River, part of 396 acres ‘survad’ for James Rentfro, August 29, 1785, witnesses: Jacob [German Script], Daniel Miller, Jacob Wimmer, Philip Lybrook, recorded May 1, 1786 Franklin County VA. DB 1, pp 30-31.
    The abstract refers to page 24 in my online PDF.  So, how do I create a link using the colorized text above, pointing it to page 24 of the online PDF?

    Create a regular URL link to the PDF, and then add this at the end of it: "#page=24"
    You can find the full documentation for the PDF Open Parameters here:
    http://partners.adobe.com/public/developer/en/acrobat/PDFOpenParameters.pdf

  • Using IE V.11 and blocks PDF from opening via links?

    Using IE V.11 and can't open PDF from links. Help PLZ!

    What exactly means "can't"?  Is this perhaps the problem: http://support.microsoft.com/kb/2716529 ?

  • When downloading a pdf file from a link the page displays "done" but with no content displayed

    This relates to pdf document downloads from a website link. This has been a recent phenomenon. I have no idea as to the possible source of the problem. I discount an adobe problem. No problem downloading in explorer

    https://support.mozilla.com/en-US/kb/Using+the+Adobe+Reader+plugin+with+Firefox
    https://support.mozilla.com/en-US/kb/Opening+PDF+files+within+Firefox

  • Link to iview or page in content area

    hello,
    can i have links to iviews or pages in the content area? if yes, how do i do that?
    thx
    irina
    points will be given for any answer that helps

    Hi Galan,
    One way that you can link to an iview is by using what's called a Quick Link. Open up the properties to the iview that you want to link to, give a name to your iview in the 'Quick Link' field, and then save your changes. Then, use a url like this to access your quick link:
    https://portal.mydomain.com/irj/portal/MyQuickLink
    For example, if we named our Quick Link 'MyApplication', our url would look like this:
    https://portal.mydomain.com/irj/portal/MyApplication
    Give it a try. I hope this helps!
    -StephenS

  • PSE 9 content download link

    I purchased PSE 9 and PRE 9 along with the PLUS package.  The problem is that I lost the link to the PSE 9 plus content downloads.  I received it once, but the download failed and I lost the link.  Can someone point me to the right place to download the plus content for PSE 9?

    Raeeds I am sorry there is no public download available for Acrobat 9 Standard.  If you purchased Acrobat 9 Standard from Adobe directly and choose the download option at the time of purchase then the installation files will be located under your account.  You can find more details at Find a download link on Adobe.com.

  • I can no longer open pdfs in Firefox. I don't get an error message. Nothing happens when I click on the link. Same problem with downloads.

    Never had a problem like this before, I was always able to open a pdf or download a file from any site. I used Firefox exclusively to download my credit card statements, bills, etc. but I can no longer do this.

    Hi lornetz,
    Have you looked at the [[Opening PDF files within Firefox]] Knowledge Base article? There is some good troubleshooting information in there. They also list 2 different PDF plugins. I'd try both just to be safe.
    Hopefully this helps!

  • Error while opening PDF file downloaded  from database Blob column

    Hi All,
    I am working on jdev 11.1.1.4.0.
    In my use-case I am using filedownload Actionlistner on a link to get the PDF file stored in the database in blob field. These files are being uploaded from other use-case in adf only.
    After getting the dialog box to open/save/cancel for the PDF file when i click on open then i am getting an error *'Adobe Reader could not open 'abc.pdf' because it is either not a supported file type*
    or because the file has been damaged (for example, it was sent as an email attachment and wasn't correctly docoded)' for some files , and to my surprise I am able to open some files.
    When I open these PDF files separately from desktop I am able to view the content of each and every file in adobe reader.
    I dont know where the problem exactly lies , while uploading/downloading the file . Any ideas/thoughts to resolve this issue?
    Thanks
    Kanika

    Thanks a lot Timo...!!!
    I checked the PDF file downloaded directly from the blob column in DB, there only it is corrupted so must be the problem in uploading the file. I am checking the code line by line,, but no problem in setting the file content type,size etc.
    Here is the code snippet ..
    byte[] buff;
    buff = new byte[(int)length]; -- Length is the file size
    int bytesRead = is.read(buff);
    for (int i = 0; bytesRead < buff.length; i++) {
    // int b = is.read();
    int b = is.read();
    if (b == -1)
    break;
    buff[i] = (byte)b;
    BlobDomain blobDomian = new BlobDomain((buff));
    TestVORow = (TestVORow Impl)TestVO.createRow();
    if(blobDomian != null) {
    TestVORow.setAttachment(blobDomian);
    am.getTransaction().commit();
    This seems to be Ok to me..the same issue, file is still corrupting.
    Any thoughts from your side ???
    Thanks
    Kanika
    The problem is resolved.
    Changes made are instead of
    InputStream is;
    used ... BufferedInputStream bis ;
    and after
    for (int i = 0; bytesRead < buff.length; i++) {
    // int b = bis.read();
    int b = bis.read();
    if (b == -1)
    break;
    buff[i] = (byte)b;
    bis.close(); // use this close bufferedInput Stream.
    Able to open each and every file now..Thanks for your suggestions Timo and Frank.
    Edited by: Kanika on Mar 6, 2012 3:15 AM

  • Pdf file download problems

    I use the Adobe Creative Cloud file storage system to store and also share pdf files with my customers. When I need to share a pdf file, I create a link for the folder containing the correct pdf files. Then I paste the link to that folder into the body of an email that I then send to the customer. Often I will paste several different links into the same email. Normally, when a customer downloads, they simply click on the link, then they are directed to the folder contents. They then click on each individual file within the folder...on the next page there is a download drop down menu button at the left of the screen.....the dropdown menu normally give 3 or 4 options to download as: PDF, jpg, png and ease. For some reason the last week, at least 50% or more of my customers are not able to download.... they are telling me that the drop down menu does not give them the pdf option. I talked with Adobe customer support but the lady didn't seem to have the foggiest idea why this was happening or how to fix it...she said she would look into a solution and call me back but she never did. This happened about a month ago too and the problem seemed to correct itself a day or two later.... and again no one at Adobe could tell me what was up or how to fix the problem. Anyone out there experienced anything like this? Or maybe I am the only one using this service to share PDF files?

    Having the exact same problem, really frustrating. It's not working with new files I put up on the Cloud and even the files that were working previously are not downloadable as PDFs. I think Adobe has broken something…oddly when I'm logged in with my account, the download as PDF option is there, if I log out and try to get the file, then it's not there. I even tried to create another Adobe account and it's not possible to download when logged in using that account either.
    I wish that the Cloud sync and sharing worked more reliably, but it's frequently down, not working completely, not building previews etc.
    Really frustrating.

  • PDF content not searchable from Sharepoint 2010 Sever tried every thing

    I have checked many blogs and tried many option i am unable to search the pdf content using Adobe filter
    (1)i have installed the adobe filter from
    http://www.adobe.com/support/downloads/detail.jsp?ftpID=4025
    (2)set the envoirment variable in the control panel to the bin directory of ifilter on the server
    (3)Download
    PDF icon picture (17x17) from Adobe web  site http://www.adobe.com/misc/linking.html and Copy to
    C:\Program  Files\Common Files\Microsoft Shared\Web Server  Extensions\14\TEMPLATE\IMAGES\
    Backup the docicon.xml file, and Add an  entry in docicon.xml for the PDF icon:
    C:\Program Files\Common Files\Microsoft Shared\Web Server  Extensions\14\TEMPLATE\XML
    <Mapping  Key="pdf" Value="pdficon17.gif">
    (4)Add  PDF file type on the File Type page under Search Service
    (5)added the followng registry
    \\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office Server\14.0\Search\Setup\Filters
    "Extension"="pdf"
    "FileTypeBucket"=dword:00000001
    "MimeTypes"="application/pdf"
    \\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office Server\14.0\Search\Setup\ContentIndexCommon\Filters\Extension
    added .pdf and set the below value
    {E8978DA6-047F-4E3D-9C78-CDBE46041603}
    (6)Stop and start the search service using below
    Net Stop OSearch14
    Net Start OSearch14
    (7) restart the server
    (8)reset the index
    (9) run the full crawl
    still i am unable to search the PDF content from Sharepoint search
    can any one help in this i will be thankful
    regards
    MCTS,ITIL

    Hello Shahid,
    Your question has been quite clearly answered here http://social.technet.microsoft.com/Forums/sharepoint/en-US/126076e8-7511-44cc-9c59-ce8cdd534758/sharepoint-foundation-2010-ocr-help?forum=sharepointgeneralprevious
    If you are looking for an OCR solution that will allow you to use the full-text search without having to dive into all the technicalities of it, maybe Udocx is something for you (see Udocx.com). It allows you to upload documents from your MFP and desktop
    directly into SharePoint folders including OCR and metadata.
    Cheers,
    Iris

  • Can I have Email Recipients of a PDF Form Complete via Smart Phone Email?

    Hello Adobe PDF Forum,
      Is it possible to have email recipients of my PDF form complete via their smart phone email platform?  If so, could you step me through the 'how to' process in making this possible for my recipients?
    Thank you!  Have a great afternoon.
    Eric

    Hi Eric,
    Your recipients can use the free Adobe Reader mobile app for iOS or Android to fill out PDF forms via their smart phones. They can download the Reader mobile app from Features | Adobe Reader mobile app. Then, when they receive an email from you with your form attached, they can open it directly from the email client into the Reader mobile app and fill it out. Easy!
    Please let us know if you have additional questions.
    Best,
    Sara

  • Version of file protected by timestamp signature (3161) alone shows "Unrecognized PDF Content"

    Documents which have been signed with a RFC 3161 timestamp signature alone show "Report Code: 4000" described as "Unrecognized PDF Content" in the PDF Signature Report.  I access this report by selecting the signature in the panel and "Click to view this version", then an option to "View Report" is in the top right corner.
    Documents with digital signatures and attached timestamps from the same TSA verify properly and show no errors in the PDF Signature Report.
    All of the timestamps verify properly, though the TSA root certificate must be downloaded and trusted manually.
    Any ideas as to what's going on here?
    An example called InvoiceTS.pdf can be found here. You may also use the link to StarField below to timestamp any PDF you like; the problem occurs universally.
    Version Info: Problem shows in Acrobat X and XI and Reader X and XI, occurs in files with timstamps attached by both Acrobat X and XI.
    TSAs affected: DigiStamp, StarField
    Explicit Error:
    Unrecognized PDF content: The document contains PDF content or custom content not supported by the current version of Adobe Reader.The document appears to have been produced by a later version of Acrobat.

    I have been on the phone with Adobe support more times than I care to remeber about this issue.  It would be nice if the problem would be addressed so a capability Adobe claims to exist with Adobe X actually functions properly.

Maybe you are looking for

  • 10g904 - custom login pages & development method of applics for SSO

    i am getting baffled with these custom login pages and their connection with the SSO. I have now read extensive documentation from the following: Oracle® AS SSO Admin Guide for release 10g (9.0.4) (B10378-01) Oracle® AS SSO App Developers Guide for r

  • How do I get my Mac Pro to see the second monitor through a video splitter and/or switcher?

    In a recording studio we have a Mac Pro with two video display monitors in the control room and we want to be able to show the content of the second monitor to the person in the recording room on a big display monitor there. However, when we interpos

  • Adobe Photoshop Album Starter Edition 3.0 in taskbar

    Adobe Photo Downloader icon appears in taskbar after booting up. Disable, Launch and Exit appear only options on right-clicking. I can't find anything in set-up or preferences to remove this icon from my taskbar. Suggestions?

  • Standalone decrypt returning an error

    Dear All, As the part of MAC check mechanism, We need to decrypt the original data(un encrypted). But we are getting an error .Can any one suggest on this? SQL> DECLARE 2 encryption_type PLS_INTEGER := -- total encryption type 3 DBMS_CRYPTO.ENCRYPT_A

  • Modify MSS with version 60.1.18  ( JSP Dyn Page Concept)

    Hi All, We are working with MSS Business package.Our requirement is to display the custom fields data(infotype P0006) in Emergency contact details in the employee profile details.We were able to track the par file from the business package. It is com