Javascript to download a custom pdf

Hi all, 
I am a pretty adept captivate user, but really have no javascript skill.  I have a button in my project, that when pressed I want to download a custom pdf that pulls from a jpg image and two project variables.  (Essentially I'm creating a certificate but I don't want to be limited to the certificate widget).  Does anyone have same sample script for executing this that they could share?
Thanks!

You can use a procedure like this to allow a download of your file stored as a bfile (in a directory):
   PROCEDURE download_bfile (
      file_in        IN   VARCHAR2 DEFAULT 'test.txt',
      directory_in   IN   VARCHAR2 DEFAULT 'DATA_PUMP'
   AS
      lob_loc    BFILE;
      v_mime     VARCHAR2 (48) DEFAULT 'application/txt';
      v_length   NUMBER;
   BEGIN
      lob_loc := BFILENAME (directory_in, file_in);
      v_length := DBMS_LOB.getlength (lob_loc);
      OWA_UTIL.mime_header (NVL (v_mime, 'application/octet'), FALSE);
      HTP.p ('Content-length: ' || v_length);
      HTP.p (   'Content-Disposition:  attachment; filename="'
             || SUBSTR (file_in, INSTR (file_in, '/') + 1)
             || '"'
      OWA_UTIL.http_header_close;
      WPG_DOCLOAD.download_file (lob_loc);
   END download_bfile;To make this procedure working from apex, you can use approach similar to this one:
http://apex.oracle.com/pls/otn/f?p=31517:15
You can also have a look at this thread:
Re: Need Help Parsing a Blob Into a Table
It will give you a lot of ideas how this could be solved.
Denes Kubicek
http://deneskubicek.blogspot.com/
http://www.opal-consulting.de/training
http://apex.oracle.com/pls/otn/f?p=31517:1
-------------------------------------------------------------------

Similar Messages

  • Looking for a way to create/edit a newsletter online, then be able to generate a customized PDF file

    I am looking for a way to be able to customize a newsletter online, then be able to export/generate a PDF file from that newsletter.
    Basically this is for a friend that is a real estate agent, and currently she is creating the newsletters in MS Publisher. I'm hoping to find a way to be able to allow her to login to a secure area of her webpage(that part isn't a problem) but then be able to create/customize a monthly newsletter that needs to be customizable.
    For example, the August Newsletter will be 2-sided, and most of the newsletter will be the same, but she needs to be able to have a newsletter for different apartment buildings so the customers can just go to their building link/area on the webpage and be able to download that month's custom PDF file that has a portion of the main newsletter that is a table/list of properties for that specific location.  The data will be stored in a database.
    After writing the above, I can probably create a front-end to the database so she can enter everything that way, but I still need a way for her to generate the customized PDFs after she is done with that month's data.
    I was hoping Adobe had something that could be used, or am I stuck using php or Javascript and just doing this with custom scripting?
    Anyone have any ideas?
    Thanks!
    John

    I was hoping Adobe had something that could be used, or am I stuck using php or Javascript and just doing this with custom scripting?
    I think you will have to do the latter.  While you are thinking about writing the PDF file, don't overlook fpdf (google it)....

  • Custom PDF/RTF reports with Cocoon (problem with special characters)

    Hi all,
    I've setup application (APEX 3.0.1) with some custom PDF reports (using Cocoon 2.1.10),
    I'm generating my own hierarchical xml structure, using query with xmlelement() and xmlagg() functions,
    I cannot use built-in xml generator, because I need to get master-detail report with sub-grouping.
    Everything works fine if data in report doesn't contains special characters like "&",
    but Cocoon stops processing XML data when it found special character, following error is written to cocoon log:
    INFO (2007-10-02) 12:34.16:828 [sitemap.transformer.log] (/cocoon/fop_post/) http-8888-1/LogTransformer: [startElement] uri=,local=PRZEDMIOT,raw=PRZEDMIOT
    INFO (2007-10-02) 12:34.16:828 [sitemap.transformer.log] (/cocoon/fop_post/) http-8888-1/LogTransformer: [startCDATA]
    INFO (2007-10-02) 12:34.16:828 [sitemap.transformer.log] (/cocoon/fop_post/) http-8888-1/LogTransformer: [characters] PPHU "T
    ERROR (2007-10-02) 12:34.16:828 [sitemap.generator.stream] (/cocoon/fop_post/) http-8888-1/StreamGenerator: StreamGenerator.generate()
    org.xml.sax.SAXParseException: XML document structures must start and end within the same entity.
    ERROR (2007-10-02) 12:34.16:828 [sitemap.handled-errors] (/cocoon/fop_post/) http-8888-1/ErrorHandlerHelper: Failed to process pipeline
         at <map:serialize type="xml"> - file:/D:/oraclexe/apache-tomcat-6.0.13/webapps/cocoon/fop_post/sitemap.xmap:22:32
         at <map:generate type="stream"> - file:/D:/oraclexe/apache-tomcat-6.0.13/webapps/cocoon/fop_post/sitemap.xmap:18:33
         at <map:serialize type="fo2pdf"> - file:/D:/oraclexe/apache-tomcat-6.0.13/webapps/cocoon/fop_post/sitemap.xmap:58:37
         at <map:transform> - file:/D:/oraclexe/apache-tomcat-6.0.13/webapps/cocoon/fop_post/sitemap.xmap:51:39
         at <map:transform type="log"> - file:/D:/oraclexe/apache-tomcat-6.0.13/webapps/cocoon/fop_post/sitemap.xmap:45:35
         at <map:generate> - file:/D:/oraclexe/apache-tomcat-6.0.13/webapps/cocoon/fop_post/sitemap.xmap:42:38
         at <map:mount> - file:/D:/oraclexe/apache-tomcat-6.0.13/webapps/cocoon/sitemap.xmap:1034:92
    org.xml.sax.SAXParseException: XML document structures must start and end within the same entity.
    This error occur when Cocoon process folowing XML entity:
    <PRZEDMIOT><![CDATA[PPHU "T&M" Ltd.]]></PRZEDMIOT>
    I tried to escape "&" character with CDATA section, but it didn't work.
    I tested following alternatives:
    <pre>
    <PRZEDMIOT>PPHU "T&M" Ltd</PRZEDMIOT>
    <PRZEDMIOT><PPHU &quot;T&amp;M&quot; Ltd.></PRZEDMIOT> --remove '<' and '>' characters
    <PRZEDMIOT><![CDATA[PPHU "T&M" Ltd.]]></PRZEDMIOT>
    </pre>
    but I still get the same error.
    Can anyone help me with this ?
    Thanks
    Tomasz K.

    Ok, I found that only '&' and '%' characters breaks Cocoon processing.
    The workaround is to use replace() function and change:
    '&' to '%26' and '%' to '%25', but I think that is a dirty way...
    Other characters like " - 'double citation' are succesfully escaped with xmlcdata() function.
    Perhaps someone know the simpler way to get Master/Detail PDF reports from APEX without using BI Publisher ???
    Actually I have page process invoked by button, which generates XML data, post it to Cocoon with UTL_HTTP and save generated PDF to database table (for future use).
    The same button invokes branch to URL with download procedure.
    Standard APEX reporting is not very usefull for me, because I don't know how to generate "complex" documents, with several grouping sections.
    I will be gratefull for any aid.

  • Customized PDF

    Hi!!
    I want to create a PDF file with a "x" format, but i don't have Bi Publisher, somebody have a tutorial about how to create a customized PDF without BI Publisher?..
    Thanks!!

    Ok, i understand all is happening here, the server that i'm using has installed PL/PDF, i think this is independent of XLS-FO, i have created a PDF with a stored procedure, but i don't know how can i show these in my APEX pages...
    I have read the examples in www.plpdf.com, but i can't show the PDF file for download or in the page..
    somebody have an example about it?..
    Thanks!!

  • Firefox will not download journal articles (PDFs) from PubMed. Why? Internet Explorer will download them.

    I go to the USC e-journals, as I have done with Firefox for years. Now, when I find a journal article that I want and try to download it, nothing happens. I get a blank screen.
    If I use Internet Explorer, I can download the article (PDF) and print and save it.
    What do I need to do in Firefox to fix the problem. When I first uploaded the newest Firefox I did not have this problem.

    Hi Joe, some other users have reported that the Real Downloader is not working in Firefox 22. If you have updated it and it still doesn't work, you might consider using a different downloader. I don't have any personal recommendations on that, but you can check out the reviews on the add-ons site:
    https://addons.mozilla.org/en-US/firefox/

  • I am getting messages that I can't download and read .pdf files since I have the wrong Adobe reader. I know about their security disasters of course, but I downloaded the latest version of Adobe Reader from the Adobe web site and I have other ,pdf file re

    I am getting messages that I can't download and read .pdf files since I have the wrong Adobe reader. I know about their security disasters of course, but I downloaded the latest version of Adobe Reader from the Adobe web site and I have other ,pdf file readers as well, and for some reason they won't work either. I have 5 computers running top end processors and RAM. By this I mean I have one, this one which I am using that has an AMD Phenom Black 3.2 Quad-core with 8 GBs of Corsair top DDR2 RAM, my other two AMD have either an Athlon II triple core with 4 GBs of DDR2 Corsair RAM, one with the Phenom X4 965 3.4 GHz Quad-core with 8 GBs of their best DDR2 RAM, and two Intels with the i7 920 Processors using the triple channel 1366 socket processors and one with 8 GBs of low latency DDR3 RAM and the other with 4 GBs of the same RAM. I am getting the message on this one, which has a fresh install of XP Pro X64 operating system, as do the other 4 as well. I have run Avast Business Pro Anti-virus on this one, which I am getting the message on with a single result which I deleted, and also both Spybot Search and Destroy, which came back clean as well as Malwarebytes Antimalware, which got a lot of tracing cookies now removed, and SuperAntiSpware which also found a few cookies also now deleted. Can you tell me what I need to do to get these files to show as .pdf files rather than as a clean blank page. One other issue is that I wish to know how to turn off my downloads so they are saved and Mozilla will give me the option of returning them instead of me losing them all together as it does now. Thanks for your assistance. If there is another Adobe reader I should download and install, could you provide me with the link to it? I appreciate your assistance here
    == When I download and try to read a .pdf file and when I am asked to turn off all Firefox files and if I do, I lose them since I need to know how to save them without rebooting my computer.

    Brilliant! Problem solved! Thanks so much.

  • How do you download and open PDF files that come in the email?

    I can NOT download or open PDF files. It prompts me to open in IBooks and then it's not there. I am so frustrated. PLEASE HELP!

    Touch the attachement once to download it.  Then touch it a second time, after it is downloaded ( watch the attachment icon) to open it in quick view. if you want to do something more than just view it, and if you want to save it,  Touch and hold the downloaded attachment to get the 'open in' pop up, and any app that supports PDFs, like I books, or any of the other PDF ready apps.
    If it is not downloaded yet, it will not be in I books.

  • In my "Extra" there is a line: "PDF -download, by Nitro PDF software". When I click on it, appears: "XML-parsefout .." How do I delete a command in "Extra"?

    How do I delete something in "Extra", something I didn't put in! (on my desktop).
    On my laptop the "PDF -download, by Nitro PDF software" doesn't figure and pdf files open normally and not seperatly in the mainframe of for example www.centrum-veurne.be

    Gee, Pat, this is a  real big help.
    Nobody could possibly think anyone would ask for help without first trying to fix the issue oneself. Or maybe you do. I have opened the file and looked under security. I have changed it to owner-notebook (which is what the techs called me) and clicked accept but geepers it didn't work.
    Maybe someone else has an idea.
    Take Ownership of a File or Folder
    The above should be a link. At least I copied and pasted the link. I did what was stated in there. It isn't like brain surgery. But it is not working. I ended up being able to open some pdf files after transferring them from one partition category to another. I wish it was that easy as you seem to think.
    Thanks for the help. Have a great year.

  • Why won't Adobe reader no longer let me view previously download (from Safari) pdf's? I am running OSX 10.8.5 and have uninstalled and reinstalled latest version of Reader?

    Why won't Adobe reader no longer let me view previously download (from Safari) pdf's? I am running OSX 10.8.5 and have uninstalled and reinstalled latest version of Reader. I get this error message "Adobe Reader could not open 'OD Test Bed Proposals_0.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 decoded)."  I have tried changing the 'open with' options too. Thanks

    Try this:
    Go to: Mac HD/Library/Internet Plug-ins
    Trash the AdobePDFViewer.plugin and AdobePDFViewerNPAPI.plugin files
    Empty the trash
    Relaunch Safari. You can now download undamaged PDFs.

  • HT201269 I backed up my 3GS using iTunes. I then restored the file to my new 4GS. Then I synced the apps onto the 4GS. Then I downloaded 2 custom ringtones, and attempted to sync them onto the 4GS, but it says "This Library is already synced with another

    I backed up my 3GS using iTunes. I then restored the file to my new 4GS. Then I synced the apps onto the 4GS. Then I downloaded 2 custom ringtones, and attempted to sync them onto the 4GS, but it says "This Library is already synced with another phone, and if you try to sync, you will lose all of the information on the iPhone." I am a Windows user. This Sync process is VERY confusing.

    How can I possibly get these two new ringtones onto the iPhone without wiping out everything else on the phone? This Sync process is nuts.
    I have Backed Up the phone twice. Why would iTunes try to wipe out the phone?

  • Custom PDF Page Size Disappears

    When I add custom PDF page sizes in the "Printing Preferences" dialog box, they disappear when I restart my computer and I have to create them all over again. 

    Custom page sizes are stored in the Windows Registry at HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Forms. Is this a local install of Acrobat?

  • Javascript error when launching XFA pdf from browser

    Hi all,
    I am trying to use my XFA PDF from a browser. On my local system I have  set up a web server and am launching my PDF from there. However, I am getting a ReferenceError with regards to one of my Javascript functions.
    My PDF has dependency on a javascript file that resides in the Acrobat path as follows:
    C:\Program Files\Adobe\Acrobat 9.0\Acrobat\Javascripts\
    When I use my PDF directly from an Acrobat instance, everything works fine. The issue comes up only when launching from server. How do I link the javascript file to my PDF?
    Edit: The user is going to be launching the PDF from the server via a web browser. In such a case where do I place the javascripts?
    Help appreciated,
    Thanks

    @George: thanks for the quick response!
    My JS code contains a readFileIntoStream which I learnt is also to be run under privileged context. (still learning the ropes here.. ).  I have been trying to incorporate the JS code directly into the PDF to get around this privileged context..  but I am unable to find a non-privileged equivalent for readFileIntoStream..
    Basically my users would be accessing the PDF from the server direct via the browser. For my testing purposes I am able to run the PDF directly from my desktop via an Acrobat instance without any hitch as the scripts are folder level like you mentioned. Is it possible for the users to be able to access the javascripts from anywhere on the server rather than directly from the PDF?  Please note, users will not be saving copies of the PDF on to their local machines (in which case we could have pushed the JS file along to their machines) . I need to ultimately run the PDF from browser.
    I hope I am clear..
    Thanks.

  • How do I download a Adobe PDF file and get it converted to a Word document?

    How do I download a Adobe PDF file and get it converted to a Word document?

    Download: you just download it as you would any other document.
    Convert to Word: either using the ExportPDF online service, or Acrobat.

  • I can download and open pdfs on my macbook air.  Why can't I open a pdf from a webpage?

    I can download and open pdfs on my macbook air.  Why can't I open a pdf from a webpage?

    Back up all data.
    Triple-click the line of text below to select it, the copy the selected text to the Clipboard (command-C):
    /Library/Internet Plug-ins
    In the Finder, select
    Go > Go to Folder
    from the menu bar, or press the key combination shift-command-G. Paste into the text box that opens (command-V), then press return.
    From the folder that opens, remove any items that have the letters “PDF” in the name. You may be prompted for your login password. Then quit and relaunch Safari, and test.
    The "Silverlight" web plugin distributed by Microsoft can also interfere with PDF display in Safari, so you may need to remove it as well, if it's present.
    If you still have the issue, repeat with this line:
    ~/Library/Internet Plug-ins
    If you don’t like the results of this procedure, restore the items from the backup you made before you started. Relaunch Safari again.

  • Why can I no longer download and read .pdf files

    I have never had any problems downloading and reading .pdf files until I 'upgraded' the Adobe reader to version 11. Now all attempted downloads fail because "I don't have the necessary helper application or even C:\DOCUME~1\Will-o\LOCALS~1\Temp\Back Channel II - The Vietnam Betrayal - Chaps 1&2.pdf could not be opened, because the associated helper application does not exist. Change the association in your preferences. What in the world is going on and how do I fix it?
    Under 'Tools - Applications - Adobe Acrobat Document, the I've selected 'Use Adobe Reader.' However since I also have Adobe Acrobat 8.3, I've tried substituting that for the Reader, but that doesn't work either. Please help.

    Brilliant! Problem solved! Thanks so much.

Maybe you are looking for

  • .m2v plays fine in QT but JERKY on DVD

    I've been posting this on the FCP group but nobody seems to know, so I'm hoping someone here has more specialist knowledge. 1) I have an 80 min PAL DV movie which plays beautifully on DVD. 2) In FCP I convert it to NTSC using the Nattress G Coverter

  • What is proceedure to move PC formated songs to Mac?

    My son wants to change format from PC over to Mac but all his somngs came from PC. He now has a Mac, (xmas gift), and wants to make the ipod work nativly on Mac now with his music. Is there a step by step thread for new users of ipod to follow? Or...

  • Mail doesn't copy and paste

    Another problem I have discovered, probably also thanks to Safari 4 is: I select a piece of text in a Mail message, click Copy, and then open any text editor on desktop and click Paste, but nothing happens. Do you have any idea? Riklar

  • When will Oracle end support for Version 7

    We have several servers running Oracle 7.3.4 and we are making upgrade plans. Could anyone tell us when support for version 7 will end. Thanks

  • Automatic Partitioning in 10gR2

    Hi We have a very large table which contains millions of rows in Oracle database 10gR2. In order to increase performance and manageability we want an automatic partitioning scheme in which at the beginning of every month a new partition is added, so