Loading ...
Sorry, an error occurred while loading the content.

Stream FOP results through COM to ASP

Expand Messages
  • tarh33l
    I ve been looking through all of the archives here and on the web for an answer to this, but no dice. I m hoping someone has encountered this before. The
    Message 1 of 2 , Mar 10, 2004
    • 0 Attachment
      I've been looking through all of the archives here and on the web
      for an answer to this, but no dice. I'm hoping someone has
      encountered this before.

      The project I'm currently working on is web based using VB COM and
      IIS. In order to provide creation of dynamic PDFs, I've decided to
      incorporate FOP into our solution. I've created a Java class that
      consumes an FO formatted XML document. As output, I'd like the
      class to stream the results back to the calling component (in this
      case, a COM class).

      Creating the Java class and exposing it via the ActiveX bridge is no
      problem at all. I can even call into the class via COM with no
      problems. Upon debugging from VB, I'm able to see that I'm getting
      back the PDF data. However, if I attempt to perform a
      Response.BinaryWrite to the browser, the PDF data is being streamed
      as unicode (and thus, Adobe will not open it).

      I've tested my Java class in a standalone manner, and it can save
      the PDF no problem. It seems that somewhere from the ActiveX bridge
      on, the data is being improperly encoded.

      I'd like think that my problem is the type of output stream I'm
      using from Java (ByteArrayOutputStream), but changing this to
      various types (String, Object, etc) has not helped.

      If anyone's run into this before, I would greatly appreciate the
      help. At this point, it looks like I'm stuck having the Java class
      generate a file and redirecting the ASP to the newly generated
      file. This isn't ideal as I don't want to have to manage PDFs on
      the app server.

      Thanks...

      Terence
    • Chris Bowditch
      ... By VB COM, do you mean VB6 as opposed to VB.Net? ... Well you need to convert the byte array containing unicode encoded characters into ASCII text. You
      Message 2 of 2 , Mar 11, 2004
      • 0 Attachment
        tarh33l wrote:

        > The project I'm currently working on is web based using VB COM and
        > IIS. In order to provide creation of dynamic PDFs, I've decided to
        > incorporate FOP into our solution. I've created a Java class that
        > consumes an FO formatted XML document. As output, I'd like the
        > class to stream the results back to the calling component (in this
        > case, a COM class).

        By VB COM, do you mean VB6 as opposed to VB.Net?

        >
        > Creating the Java class and exposing it via the ActiveX bridge is no
        > problem at all. I can even call into the class via COM with no
        > problems. Upon debugging from VB, I'm able to see that I'm getting
        > back the PDF data. However, if I attempt to perform a
        > Response.BinaryWrite to the browser, the PDF data is being streamed
        > as unicode (and thus, Adobe will not open it).

        Well you need to convert the byte array containing unicode encoded
        characters into ASCII text. You could do it either on the server or on
        the client. This is easy to do in java, just create a new string passing
        the bytes from the byte array output stream into the constructor. You
        can then return the string across your ActiveX bridge without fuss.

        In VB.Net it is also possible to do this conversion on the client, but I
        dont know how to do it in VB6, probably some obscure API call.

        <snip/>

        This question is very Off Topic for a generic XSL-FO list like this one.

        Chris
      Your message has been successfully submitted and would be delivered to recipients shortly.