Setting the filename of inline objects

I am working on a website where we dynamically build up pdf files and display them in the browser (inline) to the user. However, when you click on Save As on the pdf file's menu, the filename is set to the url to that page. Is there anyway to specify a different name? (without saving a temporary file on the server everytime a user wants to do this)
Below is the code that builds up the content:
byte[] content = objXSLT.transform_pdf(strXHTML, map);
response.setContentType("application/pdf");
response.addHeader("Content-Disposition", "inline; filename=\"test1234.pdf\"");
response.setContentLength(content.length);
OutputStream outStream = response.getOutputStream();
outStream.write(content);I've also attempted to send the file as an attachment instead of inline. When I do this the user can only save the file. If they attempt to open it then Adobe Reader complains and says that it couldn't find the file. I'm assuming this is because the file doesn't actually exist on the server. Is there any way around this (minus the temp file again)?

Hi,
In the past I have used the following code which gets a file (any type) from the database, and allows the user to download it. I was able to open any type of file with the OS's default helper app (i.e. MS Word or Adobe Acrobat). In my case, the file only exists in the database and NOT as a file on the server. So maybe this is similiar to your situation:
  protected void doGet(HttpServletRequest request, HttpServletResponse response)
  throws ServletException, IOException {
    ServletOutputStream out = response.getOutputStream();
    // GET PARAMETERS FROM REQUEST
    String id = request.getParameter("id");
    String type = request.getParameter("type");
    String contentType = request.getParameter("ct");
    String docName = request.getParameter("docName");
    byte[] downloadData = getBlob(id, docName, type);
    //response.setContentType(contentType);
    response.setContentType("*/*");
    response.setHeader("Content-disposition",
                  "attachment; filename=" +
                  currentDownloadFilename );
    out.write( downloadData );
    out.flush();
    out.close();
  }I'm not sure that this helps you much though, since it is practically what you have already.

Similar Messages

  • Set the filename in a textframe with JS in Illustrator CS2 WIN

    Hello and good morning (and sorry for my bad english),
    I found some possibilities to set the filename in a textframe. But only in applescript or for CS (WS-dateandtime v0.8 from Wolfgang Reszel)
    b There is no JS-script, which works correctly in Illu CS2 Win.
    Please, help me to get a JS-script that proper works.
    Here is the code:
    //////////////////////////////////////////////////////////// english //
    // -=> WR-DateAndTime <=-
    // A Javascript for Adobe Illustrator
    // by Wolfgang Reszel ([email protected])
    // Version 0.8 from 30.8.2004 (also should work with Illustrator CS)
    // This script inserts the actual date or the actual time to a
    // predefined position in the document.
    // To define the position, you'll have to create an textobject and
    // execute this script while the object is selected. The whole object
    // has to be selected and not words or letters. You can mark more
    // objects, if you select each object separate and execute
    // the script on it.
    // With the placeholders {DATE} and {TIME} you are able to define a
    // particular point, where the date or the time should be replaced.
    // If there is no placeholder in the textobject
    // "{FILENAME} ({DATE}, {TIME})" will be used as standard placeholders.
    // To update the date and time execute this script without any object
    // selected.
    // There are some additional placeholders:
    // {FILE} - complete document-filename with path
    // {FILEPATH} - only the documents filepath
    // {FILENAME} - the filename of the document
    // On my system this script can't see the path of the document, when
    // it was opened directly from windows Explorer (double click).
    // In Illustrator CS it is now possible to edit a DateAndTime-Object.
    // To enable the english messages and date-format change the "de"
    // into "en" in line 90.
    // Sorry for my bad english. For any corrections send an email to:
    // [email protected]
    //////////////////////////////////////////////////////////// Deutsch //
    // -=> WR-DateAndTime <=-
    // Ein Javascript fuer Adobe Illustrator
    // von Wolfgang Reszel ([email protected])
    // Version 0.8 vom 30.8.2004 (sollte auch unter Illustrator CS laufen)
    // Dieses Skript fuegt das aktuelle Datum und die aktuelle Uhrzeit an
    // eine vorher bestimmte Stelle im Dokument ein.
    // Um eine Stelle zu bestimmen, muss man ein Textobjekt erzeugen, es
    // markieren und dann dieses Skript aufrufen. Es muss das gesamte Objekt
    // ausgewaehlt sein, nicht etwa Buchstaben oder Woerter. Es lassen sich
    // nacheinander auch mehrere Objekte als Datum/Uhrzeit markieren.
    // Mit den Platzhaltern {DATE} und {TIME} (in geschweiften Klammern)
    // kann man bestimmen, wo genau im Text das Datum und die Uhrzeit
    // erscheinen soll. Sind die Platzhalter nicht vorhanden, wird
    // automatisch "{FILENAME} ({DATE} - {TIME})" verwendet.
    // Zum Aktualisieren des Datums/Uhrzeit muss man dieses Skript aufrufen
    // wenn kein Objekt ausgewaehlt ist.
    // Es gibt noch einige zusaetzliche Platzhalter:
    // {FILE} - kompletter Dateiname mit Pfad
    // {FILEPATH} - nur der Verzeichnispfad des Dokuments
    // {FILENAME} - der Dateiname des Dokuments
    // Auf meinem System kann der Pfad nicht ermittelt werden, wenn das
    // Dokument vom Windows Explorer geoeffnet wird (Doppel-Klick).
    // InÿIllustrator CSÿkann man nun ein Datum/Uhrzeit-Objekt bearbeiten.
    // Um dieses Skript mit deutschen Meldungen und Datumsformat zu
    // versehen, muss in Zeile 90 das "en" durch ein "de" ersetzt werden.
    // Verbesserungsvorschlaege an: [email protected]
    //$.bp();
    var language="de"; // "de" fuer Deutsch
    var WR="WR-DateAndT

    Hello Steve Light,
    Thanks a lot for answering me. I did it (renamed and added this two lines at new line 89 and 90 in the Script, selected Textframe and execute the jsx from Windows-Explorer) but nothing happened. Only a warning message appeared. It sayed: "You used an illustrator-12 Script " The Message is in German, I cannot to translate literally.
    No filename and no date wasn't fill in textframe.
    It's a great pity, the same Script runs in CS3 without problems. But I need it for CS2 :-(
    What can I do?
    Sorry for my bad english again.

  • Can I set the stroke of an object to be on top/in front and the fill on the bottom/in back?

    Can I set the stroke of an object to be on top/in front and the fill on the bottom/in back?  I asked this question before and was told to go to appearance and drag the fill and stroke around as if they were a layer, but this did not bring my stroke to the top of the image.  Did I do this wrong somehow or is there another method?

    Erin,
    The default stacking order for an object with fill and stroke, such as a simple path, is that the stroke is on top and the fill is beneath it.
    You may change that in the Appearance palette, but it should not be necessary.
    Can you show a screenshot with the object and the Appearance palette and the Layers palette with the relevant (part of the) Layer expanded and visible?
    If things are really wrong, you may start considering going down this dark road:
    The following is a general list of things you may try when the issue is not in a specific file (you may have tried/done some of them already); 1) and 2) are the easy ones for temporary strangenesses, and 3) and 4) are specifically aimed at possibly corrupt preferences); 5) is a list in itself, and 6) is the last resort.
    1) Close down Illy and open again;
    2) Restart the computer (you may do that up to 3 times);
    3) Close down Illy and press Ctrl+Alt+Shift/Cmd+Option+Shift during startup (easy but irreversible);
    4) Move the folder (follow the link with that name) with Illy closed (more tedious but also more thorough and reversible);
    5) Look through and try out the relevant among the Other options (follow the link with that name, Item 7) is a list of usual suspects among other applications that may disturb and confuse Illy, Item 15) applies to CC, CS6, and maybe CS5);
    Even more seriously, you may:
    6) Uninstall, run the Cleaner Tool (if you have CS3/CS4/CS5/CS6/CC), and reinstall.
    http://www.adobe.com/support/contact/cscleanertool.html

  • How do I set the filename using the inline reader with a web browser?

    Hi all,
        Most likely an age-old question that I have not been able to track down an answer for ...
        My application presents a pdf to the user using an embedded reader and gives them the saveas button as an option in the toolbar.
        When they go to save the file it defaults the filename to be the entire URL of the document.
        How can this be changed to be something more user-friendly??
        Thanks in advance for any help you can provide for this issue.
    -Dennis

    I suppose you could use Javascript.
    Or you could display the content within the applet itself.
    But probably the best thing would be to have the server return a URL (or an identifying token to be added to a URL) and the applet could use AppletContext.showDocument to send the user to another page.
    That's my opinion anyway.

  • FtpAdapter How to set the filename

    Hi,
    I am using FtpAdapter to put files I want to set the custom filename how do I do that. I am storing a filename in a variable and needs to have that name when FtpAdapter puts the file on a Ftp Server.
    Thanks

    Well to dynamically assign file name to the FTP'ed file, need to use the ftpAdapterOutboundHeader.wsdl
    Create a variable of OutboundHeader_msg message type which is defined in ftpAdapterOutboundHeader.wsdl
    Assign the custom file name to this newly created variable's fileName element.
    For example if Variable_File_Name_Obj is the variable created then the code should include
    Variable declaration
    <variable name="Variable_File_Name_Obj"
    messageType="namespace:OutboundHeader_msg"/>
    Assign
    <assign name="Assign_File_Name">
    <copy>
    <from some variable>
    <to variable="Variable_File_Name_Obj"
    part="outboundHeader"
    query="/namespace:OutboundFTPHeaderType/namespace:fileName"/>
    </copy>
    </assign>
    Kalidass
    http://oraclebpelindepth.blogspot.com/

  • Setting the frame of an object based on collisions

    I'm almost done with a project I've been working on for a while and need help with the Actionscript.  I first got help here: http://forums.adobe.com/message/4706107#4706107 ; basically what I set up was that an object would change its frame based on what other objects it was colliding with.  I'm working with hundreds of objects that will change based on their position onscreen so it's necessary to set up a script to do this automatically.  I don't know Actionscript at all, but I got a lot of help and we finally came up with this code:
    stage.addEventListener(Event.ENTER_FRAME, checkForHit);
    var objects:Array = new Array(obj, obj2);
    function checkForHit():void {
         for(var i=0; i<objects.length; i++){
              for(var n=1; n<22; n++){
                   if(objects[i].hitTestObject(this["invisibleObj"+String(n)]){
                         objects[i].gotoAndStop(n);
                         break;
    The problem I'm running into now is that if an object specified in "new Array" isn't onscreen, none of the rest of the objects respond to the code.  Is there a way to make this code work regardless of whether all objects specified are onscreen or not?  Also, would there be a way to set the new Array objects to something like "obj*" so I didn't have to actually type in every single one of the hundreds of objects I'll be placing onscreen?
    Thanks so much for the help!  I'm really stuck without it.

    If you place all the objects in a container they will still be able to be hitTested with objects outside of the container.  If the objects are all passing by, then having them in the container might ease your burden since you could nove the container rather than each individual object.
    To make the container just create an empty movieclip (or Sprite) symbol and place it on the stage at 0,0.  Open it up for editing and plant your 'object's as needed inside of it -  no names needed unless you have other need for them.  Then when you want to do your hitTesting you loop thru the children of the container.  Here's how the code changes if you do that and assign a name to that container of "objectContainer" (name it as you please)...
    function checkForHit():void {
         for(var i=0; i<objectContainer.numChildren; i++){
            var obj:MovieClip = MovieClip(objectContainer.getChildAt(i));
              for(var n=1; n<22; n++){
                   if(obj.hitTestObject(this["invisibleObj"+String(n)]){
                         obj.gotoAndStop(n);
                         break;

  • Set the value of a object in request scope

    I have the object in my req scope. I need to set value to one of the object attributes if that attribute is blank. How can I set its value.
    <c:set var="benefitVO" value="${requestScope.BenefitVO}" />I need to set the following Object attribute value, if it is blank.
    something like --- > benefitVO.setBnftCd("asdf");
    How can I set it using JSTL tags?
    any ideas
    Thanks

    I need to set value to one of the object attributes if that attribute is blank.This is some kind of a default value that you want, then? If so then just take care of that when you output it. Use <c:if>, and if the attribute is blank then output the default value, otherwise output the attribute.
    Or have the servlet that created that request attribute take care of that requirement.

  • How to set the filename when downloading a file?

    I'm working on mvc4. I have generated excel file dynamically using following simple code my hosting is on Azure
    I have created a Root path and then try to save that excel file.
    Problem is when my Action Result method response comes back it is giving default popup to open a file but file name is having a GUID instead my provided file name
    What id wrong any clue?
    Excel file generation code:
    Microsoft.Office.Interop.Excel.Application xlApp =
    new Microsoft.Office.Interop.Excel.Application();
    return tempPath;
    This method returns something like C:\AppData\Local\dftmp\Resources\11a2435c-998c-4fe8-aa55-8bb42455b4ca\directory\myexcelFILE.xls.
    The Download File popup does not give file name as myexcelFILE.xls it gives some GUID why so?
    Action
    Result method code
    public ActionResult DownloadExcel(){
    string path = ExcelGenerationCode(fileName);
    Stream s = new FileStream(path, FileMode.Open, FileAccess.Read);
    return new FileStreamResult(s, "application/vnd.ms-excel");
    Ashish Fugat (ashuthinksatgmail.com) SE

    http://forums.asp.net/
    The above forum has the MVC section.

  • Changing the filename prefix or setting the starting number

    I have two PowerShots. I have been using one for years. My newer one sets the filenames with the same prefix, IMG, and starts numbering at 0001. Can I change this so I don't get duplicate filenames in my photo library. I realize that having the new photos in different folders will help to prevent overwriting the existing ones. I would like to prevent the confusion or possible overwriting by mistake.
    Thanks for any advice.

    Hi Apic13,
    To keep your camera from resetting the file numbers, press the MENU button and go to the settings tab, It's yellow and normally has a wrench and hammer on it.  Now scroll down to "File Numbering", then use the right or left arrow to choose "Continuous", then press the MENU button again.
    This may vary slightly from model to model.
    I hope this helps,
    Richard
    Did this answer your question? Please click the Accept as Solution button so that others may find the answer as well.

  • How I set the Focus in object

    Hello.
    I need set the focus on first object in a JInternalFrame.
    The form JInternalFrame contain a JTabbedPanel and this include object jFormatedTextFields.
    I need when the init form set the focus over first object in the first tab of JTabbedPanel. How I do?.
    Than You

    works OK in this
    (tabbed panes seem to be working OK for focus now, don't know what's changed)
    import javax.swing.*;
    import java.awt.*;
    import  javax.swing.text.*;
    class Testing extends JFrame
      MaskFormatter mf;
      JFormattedTextField ftf;
      public Testing()
        setLocation(300,200);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        try{mf = new  MaskFormatter("###.###.##.##");}
        catch(Exception e){e.printStackTrace();}
        ftf = new JFormattedTextField(mf);
        JTabbedPane tp = new JTabbedPane();
        tp.addTab("A",ftf);
        JDesktopPane dp = new JDesktopPane();
        JInternalFrame if1 = new JInternalFrame( "I-F1", true, true, true, true );
        if1.setLocation(50,50);
        if1.getContentPane().add(tp);
        if1.pack();
        if1.setVisible(true);
        dp.add(if1);
        getContentPane().add(dp);
        setSize(400,300);
        setVisible(true);
        ftf.requestFocusInWindow();
      public static void main(String[] args){new Testing();}
    }

  • Setting the JMS Header from Payload

    Hi Experts,
    My requirement is to send the payment data coming from ECC to non sap system.Sender adapter is proxy and receiver is JMS.ECC will be sending the filename in one field and payload content as a string in another field.PI has to set the filename coming from ECC in JMS header property.What configuration changes should i need to make in JMS adapter to achieve it?
    Converting the XML to string is possible in PI.But my question is converting the string XML data into XML fields is possible in SAP PI?If so how to do that?
    Please provide your suggestion.
    Regards,
    Karthiga

    Hi Karthiga,
    The UDF is there in blog
    DynamicConfiguration dynamicconfiguration = (DynamicConfiguration)param.get("DynamicConfiguration");
                DynamicConfigurationKey dynamicconfigurationkey = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/JMS", "DCJMSMessageProperty0");
                String s = dynamicconfiguration.get(dynamicconfigurationkey);
                CorrID.append(s);
    Please let me know if you have any issue.
    regards,
    Harish

  • Can we set the dynamic data source when using getReportParameters() ?

    Hello!
    I have a report where one of its parameters refers to a list of values (LOVs). This list of values is an SQL Query type. When the data source used in the report is defined in the BI Publisher server, I'm able to get the report parameters using the getReportParameters() function in my application. However, if the data source is not defined the function throws an exception, which is understandable.
    I decided to dynamically set the data source so that even if the data source used by the report is not defined in the BI Publisher server, it still will be able to get the LOVs for the parameter. I tried setting the JDBCDataSource of the dynamicDataSource for the ReportRequest object that I passed to the getReportParameters() function. Please see the sample code below:
    reportRequest.dynamicDataSource = new BIP10.BIPDataSource();
    reportRequest.dynamicDataSource.JDBCDataSource = new BIP10.JDBCDataSource();
    setReportDataSource(reportRequest.dynamicDataSource.JDBCDataSource, connectstr, jdbc, dc); //function to set the values for JDBCDataSource object
    reportParams = webrs.getReportParameters(reportRequest, uid, pwd); //call the getReportParameters
    I was expecting this to work as this is what I did to dynamically set the data source before calling the runReport function. So, my question is -- can we set the dynamic data source when using getReportParameters() ? I tried this both in versions 10g and 11g. It does not seem to work on both versions.
    Regards,
    Stephanie

    report_id column of apex_application_page_ir_rpt can help us uniquely identify each saved report.
    We can assign this report_id value to a page item and this page item can be put in the Report ID Item text box of the Advanced section of the Report Attributes page of the IR.
    This should load the saved report identified by report_id and you can get rid of javascript
    Regards,
    Vishal
    http://obiee-oracledb.blogspot.com
    http://www.packtpub.com/oracle-apex-4-2-reporting/book
    Kindly mark the reply as helpful/correct if it solves your problem

  • Pre-fill the filename in Fileupload UI

    Hi,
    I am unable to pre-fill the filename in fileupoad UI.
    When I launch the WD app, on the browser it get the following URL
    http://devai063.private.xxxx.com:8081/sap/bc/webdynpro/sap/zgi_file_upload?sap-language=EN
    at the end I add &filename=c:benefit.txt and hit enter,
    http://devai063.private.xxxx.com:8081/sap/bc/webdynpro/sap/zgi_file_upload?sap-language=EN&filename=c:benefit.txt
    In WD window HANDLEDEFAULT method I am checking for the filename parameter if not empty I am setting the 'filename'  to the context of filename of fileuploadUI, but the app does not show the file name C:
    benefit.txt in the fileupload UI.
    I debugged the HANDLEDEFAULT and I can see the filename but somehow it is not setting to the filname for uploadfile UI.
    any advice is highly appreciated.
    Thanks,
    Ram

    From the online help:
    Technical Browser Details Beyond the Control of WDA
    Due to browser restrictions that are unrelated to Web Dynpro ABAP, the previously entered data path might disappear when a FileUpload UI element is clicked. In newer versions of the browser, it is therefore impossible to enter the file name in the entry field. The field always remains empty. The selection of the file name is therefore only possible in new browser versions using the Browse... button. You cannot enter the file name manually (using the keyboard or the Copy and Paste functions) or by setting the file name from the back end (directly or using context binding). For more details, read the security-related information in Internet Explorer 6 about handling <input type=file>.
    http://help.sap.com/saphelp_nw70ehp1/helpdata/en/b3/be7941601b1d09e10000000a155106/frameset.htm

  • Specifying the filename for outbound FTP transport in OSB

    I want an OSB based service that will send via FTP a file with a specific name to a remote ftp location.
    It appears OSB can't do this because the FTP transport on a business service only allows you to specify the prefix and suffix and then generates a big long file name for the midlle parts.
    Does someone know how to override this and specify the name that you want teh remote file name to be called?

    mdsrobbins wrote:
    Your response was helpful but being new to OSB I'm still not quite there because I want to pass a "variable" to the file name. Now given I want to ftp a CSV file I've specified a proxy messaging service in an MFL format behind a jms queue. The business service underlying this is the ftp service again using the MFL format. This all works but in the message flow I for the proxy I can't seem to get access to a user defined property which contains the filename which I could then pull out and stuff into the "filename" header as suggested above.
    Doe anyone have any ideas how I can get access to a filename property from a JMS message?From what i understand
    JMSQ--- JMS PRoxy (MFL)----Pipeline ----->BS (MFL/FTP)---FTP server
    So you would like to set the filename that is contained the JMS message custom headers?. While creating your JMS Proxy you have to follow these steps
    1) While creating JMS Proxy in Transport Configuration page select Get All Headers =Yes
    2) If file name is set as user defined property in JMS message then use $Header in you pipeline/message flow. This variable will hold your user defined properties. If the user defined property is part of JMS message then use $body.
    thanks
    Manoj

  • Receiver determination based on the filename of the incoming xml file

    hi folks,
    is it possible to base the receiver determination from the filename (pattern) of the incoming xml file?
    suppose, if the filename is partner1.xml, then the receiver determination has a condition of partner1.  in this case, the message is received by partner1.
    any advise please?
    thanks!
    -lex

    Hi Lex,
    You can use Enhanced Receiver Determination for this. Do your normal mapping from source to target. And another mapping for the receiver determination. In that mapping you can use the UDF for Dynamic Configuration and set the filename as the receiver service name.
    Use the following blog for Enhanced Receiver Determination:
    /people/venkataramanan.parameswaran/blog/2006/03/17/illustration-of-enhanced-receiver-determination--sp16
    This blog explains the usage of Dynamic Configuration:
    /people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14
    Regards,
    Sanjeev.

Maybe you are looking for

  • Relationship between Form, Datablock, Canvas

    What is the relationship between these items? Since now, to me, a form seems to be synonymous with canvas. As for datablock, i dont know what this is. It seems to be a collection of fields. Would anyone care to clarify?

  • I want to see lead sheets/lyrics during play back.

    I want to be able to set the visualizer to display full screen text/ or pdf images I've added. There is all this wasted real estate during playback. It would be best if there were options to: 1. auto close the added text and return to the library @ t

  • Mail Service is strangely interrupted

    Hello everybody, since the Upgrade from 10.7 to 10.8 the mailservice isn't working like it used to. After the Upgrade Mail-Application on the Apple-Laptops show a green dot when verifying connectivity but the users can't send mails any more Some inte

  • But i cant transfer data between iphone/ipad to apple tv  any suggestions?

    so i purchased 2nd gen apple tv everthing is up to date on homesharing is on but i cant transfer data between iphone/ipad to apple tv  any suggestions?

  • OSA - Appraisal template

    Hi, I'm new to the PD side of HR.  I've been following documentation to create the appraisal catalog and so forth. However, I cannot create an appraisal template. I've searched the help.sap.com for it and to no avail. Can someone tell me how to creat