Cfdocument and binary output

I'm using the Fusebox3 framework.
file: dsp_Invoice.cfm
<cfdocument format="pdf" orientation="portrait"
name="myPDF" overwrite="true">
<cfcontent type="application/pdf" variable="#myPDF#">
I get the binary results opened in Wordpad with the filename
default.cfm
Any ideas?
Tried using Foxit PDF reader on IE7 and Firefox2. Both
usually open PDF correctly from anywhere on the web.

<cfheader name="Content-Disposition" value="inline;
filename=invoice.pdf">
<cfcontent type="application/pdf" variable="#myPDF#">
in place of just the cfcontent tag alone.
In any case, I would build the invoice document in
dsp_Invoice.cfm. Then I would open it in a separate page,
dsp_showInvoice.cfm, say, that contains just a cfheader and
cfcontent tag.

Similar Messages

  • Execute command and save output in a HTML File

    Hello Guys,
    I have a requirement and for that i have to do following. a) read a file in an array and then execute a command for each value in that array. after that i want to store the output of command and value of array in another array.
    i am doing something like below.
    set objtextfile = objfso.opentextfile _
    ("c:\temp\aaaa.txt", forreading)
    j=0
    Do until objtextfile.atendofstream
    redim preserve arr123(j)
    arr123(j) = objtextfile.readline
    j = j+1
    Loop
    for each server in arr123
    chk_status = "command" &" "& server
    set objexecobject = objshell.exec(chk_status)
    'Here i am not sure how to proceed further to achieve what i described above.
    Next
    Can someone help me with this?
    -KAKA-

    Thank you for your response.
    So here is what i want to do.
    Query a database using odbc from my management server (odbc is configured and connection is tested) and based on the query it will result out few list of servers. then from the same management server i want to execute a command against all the resulted server
    (management server has a binary which can execute remote action). this remote action will get output back.
    then i would like to store the name of server and resulte output in a html file which should look like below.
    which i will later host on apache.
    YOu do not need to move things in and out of arrays and files.
    >>>> You are right but as i stated, i am not a core programmer and due to nature of my job i have to work on perl, shell and VB Script, apart from my actual technology so it becomes difficult to write it with perfection.
    I hope you understand.
    -KAKA-
    -KAKA-

  • Passing binary output in servlets

    Hi all,
    I am new to struts.In Jsp i need to give three text field values
    1.category
    2.two date fields.
    On click of submit button,it should export the csv file from db into excel sheets.
    If i didnt give the input values properly and clicking the submit button will display the error msg.
    But next time if i give the proper input values,then it should disappear.
    but my problem is the err msg is not removing from jsp but export is working and in my console :
    SEVERE: Servlet.service() for servlet action threw exception+
    java.lang.IllegalStateException: Cannot forward after response has been committed*
    **and in my action class:**
    The following condition is to check existence of err:
    if (category.length() == 0 || startdate.length() == 0
                        || enddate.length() == 0) {
                   ActionMessages errors = this.getErrors(request);
                   errors.add("fatal", new ActionMessage(DATE_FIELD_MISSING, ""));
                   saveErrors(request, errors);
                   return mapping.findForward("failure");
    The following code is for export  the data:+
    if (category.equals("book")) {
                   String fileName = "part.csv";
                   response.setContentType("application/octet-stream");
                   response.setHeader("Content-Disposition", "attachment; filename=\""
                             + fileName + "\"");
                   try {
                        OutputStream oStream = response.getOutputStream();
                        oStream
                                  .write(" Number, Description, Revision, Dummy, Manual, Classification, Owner, Global Effective Date, Global Expiration Date, New Part\n"
                                            .getBytes());
                        for (int i = 0; i < result.size(); i++) {
                             PartDTO part = (PartDTO) result.get(i);
                             StringBuffer sbpart = new StringBuffer(part.getPartNumber());
                             sbpart.append(',');
                             sbpart.append(part.getPartDescription());
                             sbpart.append(',');
                             sbpart.append(part.getRevision());
                             sbpart.append(',');
                             sbpart.append(part.getIsDummy());
                             sbpart.append(',');
                             sbpart.append(part.getIsManual());
                             sbpart.append(',');
                             sbpart.append(part.getClassification());
                             sbpart.append(',');
                             sbpart.append(part.getOwner());
                             sbpart.append(',');
                             sbpart.append(part.getEffectiveDate());
                             sbpart.append(',');
                             sbpart.append(part.getExpirationDate());
                             sbpart.append(',');
                             sbpart.append(part.getIsNewPart());
                             sbpart.append("\n");
                             oStream.write(sbpart.toString().getBytes());
                        oStream.close();               } catch (IOException ioe) {
    return mapping.findForward("success");
    I think oStream.close() will return to jsp .. so the last return statement is not working..
    I dont know how to do it in someother way......Plz help me.its urgent yaar......Thanks in advance....

    It's been awhile since I've used Struts, so don't put too much stock in this answer. That said...
    Generally, you should not close the response output stream, ever. The application server takes care of this, when and if the time is right.
    Also, it appears that you're writing output within an action, and then forwarding to a JSP. If you want to write binary output or some other type of output for which a text-template based JSP is not appropriate, forward to a plain old servlet, and write your output there. Define the servlet as you would any other in web.xml, and dispatch to it from Struts instead of going to a JSP.
    Good luck!
    - Jerry Oberle

  • How to display binary output in numeric indicator

    Hai
        How to display binary output in a Numeric display.
    in my program i use numeric display for displaying numeric values in one case
    in the other case i want to display binary output in the same numeric display window as binary,
     i don't want to make seperate o/p display for binary o/p i want change the property of the Numeric display to binary display .
    is it possible to display Binary data in numeric indicator, please give me an idea to do this.
    thanks
    sk
    Attachments:
    DBL2BIN.vi ‏39 KB

    Alternatively, you can use the FormatString property node, and use %08b as format string : 08 means : pad the output with 0 to get a 8 digits wide result.
    See attachment.
    Chilly Charly    (aka CC)
             E-List Master - Kudos glutton - Press the yellow button on the left...        
    Attachments:
    DBL2BIN[1].vi ‏21 KB

  • Linear search and binary search

    Hi
    can any one tell me what is linear and binary search in detail.
    and what is the difference between them .
    which one is useful in coding.
    Thanks&Regards,
    S.GangiReddy.

    hi,
    If you read entries from standard tables using a key other than the default key, you can use a binary search instead of the normal linear search. To do this, include the addition BINARY SEARCH in the corresponding READ statements.
    READ TABLE <itab> WITH KEY <k1> = <f1>... <kn> = <fn> <result>  BINARY SEARCH.
    The standard table must be sorted in ascending order by the specified search key. The BINARY SEARCH addition means that you can access an entry in a standard table by its key as quickly as you would be able to in a sorted table.
    REPORT demo_int_tables_read_index_bin.
    DATA: BEGIN OF line,
            col1 TYPE i,
            col2 TYPE i,
          END OF line.
    DATA itab LIKE STANDARD TABLE OF line.
    DO 4 TIMES.
      line-col1 = sy-index.
      line-col2 = sy-index ** 2.
      APPEND line TO itab.
    ENDDO.
    SORT itab BY col2.
    READ TABLE itab WITH KEY col2 = 16 INTO line BINARY SEARCH.
    WRITE: 'SY-SUBRC =', sy-subrc.
    The output is:
    SY-SUBRC =    0
    The program fills a standard table with a list of square numbers and sorts them into ascending order by field COL2. The READ statement uses a binary search to look for and find the line in the table where COL2 has the value 16.
    Linear search use sequential search means each and every reord will be searched to find. so it is slow.
    Binary search uses logrim for searching. Itab MUST be sorted on KEY fields fro binary search. so it is very fast.
    The search takes place as follows for the individual table types :
    standard tables are subject to a linear search. If the addition BINARY SEARCH is specified, the search is binary instead of linear. This considerably reduces the runtime of the search for larger tables (from approximately 100 entries upwards). For the binary search, the table must be sorted by the specified search key in ascending order. Otherwise the search will not find the correct row.
    sorted tables are subject to a binary search if the specified search key is or includes a starting field of the table key. Otherwise it is linear. The addition BINARY SEARCH can be specified for sorted tables, but has no effect.
    For hashed tables, the hash algorithm is used if the specified search key includes the table key. Otherwise the search is linear. The addition BINARY SEARCH is not permitted for hashed tables.
    Binary search must be preffered over linear sarch.
    Hope this is helpful, Do reward.

  • Formatting Binary Output

    I want to format binary output in text fields to confrom to the following scheme:
    head data1 data2 return offSet id
    6 bits 5 bits 5 bits 5 bits 5 bits 6 bits
    where the first row are field names and the second is the filed width.
    What that means is that, using the value 1 (base 10) as an example, a 6 bit filed will read 000001 and so a 5 bit field will read 00001.
    My program converts to binary no worries, but how do I enforce the width requirements? I am using Integer.toBinaryString(int) to convert, if that helps.
    Thanks

    public String intToJustifiedBinaryString(int number, int length)
      StringBuffer buffer = new StringBuffer(Integer.toBinaryString(number));
      while (buffer.length() < length)
          buffer.insert(0, "0");
      return buffer.toString();It works great! Now for the learning. I looked up StringBuffer and found this explanation:
    StringBuffer(String str)
    Constructs a string buffer so that it represents the same sequence of characters as the string argument; in other words, the initial contents of the string buffer is a copy of the argument string.
    What I am trying to figure out is how it is not overwriting what already exists in the buffer. Lets pretend with int = 7 and a 6 bit field.
    So initially, buffer.length() = 3 and my buffer looks like 1 1 1.
    From the API: The principal operations on a StringBuffer are the append and insert methods, which are overloaded so as to accept data of any type. Each effectively converts a given datum to a string and then appends or inserts the characters of that string to the string buffer. The append method always adds these characters at the end of the buffer; the insert method adds the characters at a specified point.
    If I am specifying my insert point as 0 (insert(int offset, char c) Inserts the string representation of the char argument into this string buffer.) How am I not overwriting one of my bits comprising my binary 7? My only guess is that insert operation first shifts what is already there over the necessary amount, based on the length of what is being inserted, before inserting at the specified point. I have read nothing to support this theory. Please let me know if it is correct.
    Thanks for the help!

  • How to send a binary output from ni daq 6009

    I am trying to get a binary output from ni daq 6009 to make the selections of a multiplexer.
    I am trying to make the selection directly from the labview program.
    Please help me in getting this binary output from ni daq 6009 to do the selection

    Try something like this. 
    I'm not a fan of daq-assistant express vi's... use the primitives.  Create the task outside the main structure, pass that task inside the loop and do a write where needed.  Close the task after the main loop.  This improves speed and labview performance.
    Attachments:
    ocelot.png ‏43 KB
    ocelot.vi ‏21 KB

  • Console grab binary output

    I'm playing around with a small app that will save mysqldump output to file.
    I managed to get it working, except when there's binary data on blob fields.
    So, if I run from a console:
    mysqldump -h server -u uni testdb > /tmp/test.1sql
    and then the program listed below, I get excessive garbage in the binary fields and file sizes grow up:
    -rw-r--r-- 1 nobody nobody 4535097 Aug 20 14:36 /tmp/test1.sql
    -rw-r--r-- 1 nobody nobody 6493448 Aug 20 14:51 /tmp/test.sql
    So, I tried executing with the --hex-blob flag in the mysqldump command, but in this case I've to pay the extra size cost:
    -rw-r--r-- 1 nobody nobody 7131966 Aug 20 14:47 /tmp/test1.sql
    As you will see, I'm grabbing the contents through an InputStreamReader
    and then I write they with OutputStreamWriter. I didn't choose execute the command and save the file by the console 'cause I would prefer know what's going on, count bytes, showing a progress or whatever...
    I would like to know how could I grab the binary output of the command ?...
    It seems like the sh command is not binary...
    Thank you!
    This is the code:
    class StreamGobbler extends Thread
    InputStream is;
    String type;
    String Filename;
    StreamGobbler(InputStream is, String type,String Filename)
    this.is = is;
    this.type = type;
    this.Filename=Filename;
    public void run()
    try
    PrintWriter out;
    InputStreamReader isr = new InputStreamReader(is);
    BufferedReader br = new BufferedReader(isr);
    if (type=="ERROR") {
    FileWriter outFile = new FileWriter("/tmp/error.log");
    out = new PrintWriter(outFile);
    String line=null;
    while ( (line = br.readLine()) != null)
    if (type=="ERROR") {
    System.out.println(type + ">" + line);
    out.println(line);
    } else {
    out.println(line);
    out.close();
    } else {
    // FileWriter outFile = new FileWriter(Filename);
    // out = new PrintWriter(outFile);
    FileOutputStream fos = new FileOutputStream(new File(Filename));
    OutputStreamWriter outs = new OutputStreamWriter(fos,"UTF8");
    int len = 512;
    char buf[] = new char[len];
    int numRead;
    while ((numRead = isr.read(buf, 0, len)) != -1)
    outs.write(buf, 0, numRead);
    outs.close();
    } catch (IOException ioe)
    ioe.printStackTrace();
    public class mxdump {
    public mxdump(String Cmd) {
    try {
    Cmd="/bin/bash /usr/bin/mysqldump -h server -u uni testdb";
    /* String cmd[]={"sh", "-c",Cmd,""} ; //"mysqldump";
    ProcessBuilder pb=new ProcessBuilder(cmd);
    System.out.println("Start");
    pb.start();
    System.out.println("Termino"); */
    String cmd[]={"sh", "-c",Cmd,""} ;
    Runtime rt = Runtime.getRuntime();
    System.out.println("Execing " + cmd[0] + " " + cmd[1]
    + " " + cmd[2]);
    Process proc = rt.exec(cmd);
    // any error message?
    StreamGobbler errorGobbler = new
    StreamGobbler(proc.getErrorStream(), "ERROR","");
    StreamGobbler outputGobbler = new
    StreamGobbler(proc.getInputStream(), "OUTPUT","/tmp/test.sql" );
    // kick them off
    errorGobbler.start();
    outputGobbler.start();
    // any error???
    int exitVal = proc.waitFor();
    System.out.println("ExitValue: " + exitVal);
    catch(Throwable t)
    //System.out.println(e);
    t.printStackTrace();
    }

    Don't use Readers and Writers on binary data. Use Streams.

  • Display PDF from BAPI's binary output

    Dear All,
    I am struck badly with this scenerio here.
    we have a Bapi which is generating an adobe form in the backend and providing that as an attribute of type binary.
    i used the following code to display that binary output, to be opened in Acrobet reader.
    byte[] pdfContent= wdContext.nodeZhra_Get_Lettertype_Desc_Input().nodeOutput().currentOutputElement().getE_Bin_File();
         IWDCachedWebResource pdfResource = WDWebResource.getWebResource(pdfContent,WDWebResourceType.PDF);
         IWDWindow win = wdComponentAPI.getWindowManager().createExternalWindow(pdfResource.getURL(),"PDF in Arabic",true);
         win.setTitle("PDF in Arabic");
         win.removeWindowFeature(WDWindowFeature.ADDRESS_BAR);
         win.removeWindowFeature(WDWindowFeature.TOOL_BAR);
         win.removeWindowFeature(WDWindowFeature.MENU_BAR);
         win.removeWindowFeature(WDWindowFeature.STATUS_BAR);
         win.show();
    the problem is that the acrobet reader opens and says it could not display the file and it may be not supported or might be damaged.BUT
    1. the file is being generated and correctly displayed on another system
    2. both systems have the same version and updates of acrober reader 9.
    Kindly let me know the solution or some work-around to solve this problem. Is there a way,where i should use interactive form to do this...
    thanks in advance

    Hello!
    If it works on one client but not on the other i think it is not a Server problem.
    Check th following:
    Open the document in the Browser where it is displayed and save it on a thumbdrive and open it on the other client.
    -> If it works: it must be Browser settings
    -> If not: the generated PDF is not valid for the Adobe Reader of the other client.
    If it works on the Server but not on the client, try to dump it to a file on the Webserver to see if the BAPI call (RFC/WS) is the problem. When you use XString for exampe I think there is a problem with the data beeing split into several lines. If you have the file you should be able to open it. Compare the size of the File on the WebAS and the backend.
    Kind regards
    Matthias
    Edited by: Matthias Schneider on Nov 4, 2008 6:19 PM

  • Text mode and Binary mode

    Can anybody give the differences between Text and Binary modes that are used with Datasets??

    For Binary Mode
    The contents of the file are not structured in lines in the  READ DATASET or  TRANSFER operations. Instead, they are input or output as a stream. You do not have to specify the  IN BINARY MODE addition explicitly.
    For Text Mode
    If you use this addition, the contents of the file are structured in lines. Each time you use the  READ DATASET or TRANSFER statement, the system reads or writes a single line. If the data object to which you are transferring the data is too big, it is padded with spaces. If it is too small, the data record is truncated.
    Hope this helps.
    ashish

  • What is difference between TEXT mode and BINARY mode?

    Hi,
              What is difference between TEXT mode and BINARY mode? In TEXT mode what is "ENCODING DEFAULT".
    OPEN DATASET wl_filename FOR INPUT
                              IN TEXT MODE ENCODING DEFAULT.
      OPEN DATASET wl_filename FOR INPUT
                              IN BINARY MODE .

    Hi vishnu,
    1. files like .TXT files are considered to be text,
       and other files like .EXE . DOC etc are binary files.
    2. In text files, after each line, there are two
       internal binary characters
      one for line feed and another one for newline.
    3. But, we don't have any meaning for it,
       when we view such files in notepad, for eg.
       Hence, to only get the understandable content,
       we should open such TXT files, in text mode.
      (we can also open them in binary mode,
      but we will get two extra characters after each line,
       and such two extra characters are meaningless
      for interpreting the text)
    4. In binary mode, each byte by byte is considered,
       without any meaning.
    regards,
    amit m.

  • Sharpener Pro 3 has problems in Aperture as the Pre sharpener continually asks one to buy or activate and the Output Sharpener causes Aperture to hang. Have removed all duplicate fonts and tried using a new user account. Any ideas?

    I am experiencing problems with Sharpener Pro 3 as an Aperture 3 plug-in. These are:  the Pre sharpener continually asks one to buy or activate and the Output Sharpener causes Aperture to hang. Following discussions with Nik Software I have removed all duplicate fonts and tried using a new user account. Neither of the courses of action worked. Have other users experienced these difficulties? Can you suggest an alternative remedy?

    I am experiencing problems with Sharpener Pro 3 as an Aperture 3 plug-in. These are:  the Pre sharpener continually asks one to buy or activate and the Output Sharpener causes Aperture to hang. Following discussions with Nik Software I have removed all duplicate fonts and tried using a new user account. Neither of the courses of action worked. Have other users experienced these difficulties? Can you suggest an alternative remedy?

  • Simultaneously read more than one input and generate output

    Is it possible To simultaneously read more than one input and generate outputs depending on these inputs? If this isn't possible what is the best way to go about making some sort of timed loop that will read an input, read the next input, decide whether or not to output and so on. Hope someone can help. Thanks.Message Edited by Esmith13 on 05-25-2005 01:36 PM

    Hi,
    You should look at the synchronized examples for analog input and output that can be found in the example finder under:
    Help>>Find Examples>>Hardware Input and Output>>DAQmx>>Synchronization>>Multi-Function
    These will get you started to being able to handle multiple tasks at the same time.
    I hope this helps. Have a Great Day!
    George

  • Bug in PDF and print output with gradients?

    I've got a document that makes use of a gradient fill in a table, and I find that (at least for the < 2pt border widths) the border has a thin white line to either side. It shows up readily in both the print and PDF outputs. Is this a known issue? Where can I file a bug for it? I'm using iWork 6.0 with the latest patches applied. This all worked and looked fine under iWork 5.0. :-(
    <br>
    PowerMac G5   Mac OS X (10.4.7)  

    What are you using to view/print the pdf's?
    Make sure you have the latest Adobe Reader, found
    here:
    Adobe - Adobe Reader - Download
    I'm using Preview. I did check it using Acrobat reader on Windows, and the problem still exists. I suspect there was an error made (by Pages) computing the edge of the rectangle for the gradient. It renders correctly in iWork '05.
    -John

  • Mac user, PS CC 2014 latest version. When using "Save for Web" I bring my 900 x600px @72 ppi in to SFW and the output becomes 300ppi. The only way it stays at 72ppi is if I check "none" for metadata. I know to should not matter much, but I would prefer to

    Mac user, PS CC 2014 latest version. When using "Save for Web" I bring my 900 x600px @72 ppi in to SFW and the output becomes 300ppi. The only way it stays at 72ppi is if I check "none" for metadata. I know to should not matter much, but I would prefer to keep all my web jpgs @ 72ppi. Any solutions?

    It opens up as 900x600 @300ppi
    Here's a screenshot-

Maybe you are looking for

  • Multiple Libraries

    Is it possible to have multiple itunes libraries on one computer? I already have one on here and my brother also has an IPOD that is linked to our lap top but we'd prefer to put it on here, it'd just be much easier to deal with. Is there any way we c

  • ITunes keep rejecting my credit card. What do I do?

    I have re-entered my credit card info about 30x and it keeps saying my card isn't valid, but it works everywhere else. HELP PLEASE!

  • Make an object blink or flash?

    Is there a way to make an object blink or start flashing in Catalyst?

  • Re-sizing Macintosh HD 2 Partition

    While trying to install OS X I had to partition my hard drive in to 2 disks, because the OS wouldn't install onto the first disk. So now I have it running fine on Macintosh HD 2, which is at 123.95GB, but I have 125.12GB of space on the first disk th

  • Imported events unable to edit/add comments

    Hi, I've imported a large number of events into Calendar from Entourage 2008. The events appear ok, but I can not edit or add any comments. Can anyone suggest a fix? Many thanks, James