7 Replies Latest reply on Feb 26, 2010 3:14 AM by vu.tuan.anh

    Difference when viewing PDF render with /workspace-server/ and /DocumentManager/

    vu.tuan.anh Level 1

      Hi all,

       

      There are 2 scenarios when viewing file in attachment:

       

      1) When user is processing the form, they view the attachment in attachment tab. The url's format is: https://mydomain/workspace-server/documents/-6195445997301787088-16.pdf

       

      2) My client's requirement is to view files in attachment tab even after the process is complete.

      What i have done is to write a custom java component, retrieve attachment of the last task and return to user.

       

      The url has format: https://mydomain/DocumentManager/docm1266831910962/53650adc3948bd502cf8c81d4885feec?type=Y XBwbGljYXRpb24vb2N0ZXQtc3RyZWFt

      (I also found that the file is generated under GDS folder)

       

      In both of the cases, navigateToURL() function is used to view the pdf in new window.

       

      My trouble starts from here. In several client's machine, case 2 always ask them to save the form instead of viewing in the browser, while case 1 always can be viewable.

       

      Below is the image of case 2 when i click in the link:

      PDFSaving.JPEG

       

      The strange thing is in local environment, both cases are working ...

       

      Is there any idea why it happen?

       

      My client is using windows xp, IE 6 and adobe reader 9. Some of them are using windows vista, IE 7 and adobe reader 9.

       

      In local environment, we have tested successfully with

      1)

      Window XP

      IE6/IE7/FireFox/Google Chrome

      Adobe reader 9

      2)

      Window vista

      IE7

      Adobe reader 9

       

      Regards,

      Anh

        • 1. Re: Difference when viewing PDF render with /workspace-server/ and /DocumentManager/
          Jon Bionda

          Have to do some guessing here, but it appears that your customization is using LiveCycle DataServices Remoting to call your custom component.  Remoting automatically converts an output parm with type=com.adobe.idp.Document into a DocumentReference which contains the DocumentManager url with the content-type added as the "type" parameter (content-type vale is Base64 encoded).

           

          When an attachment is added, it may not have the content-type set in the Document so in the workspace-server/documents servlet we have the following code to set it after we fetch the attachment or form document from taskmanager.  You will need the same type of code to set the document's content-type before you return the document from your custom component.

           

                           String wsFileName = (String)doc.getAttribute("wsfilename");
                           doc.setAttribute("fileName", wsFileName);
                           doc.setContentTypeFromBasename();

          (Not really sure why we also set the "fileName" attribute but we do, so I thought I would include it.)

           

          Jon

           

          1 person found this helpful
          • 2. Re: Difference when viewing PDF render with /workspace-server/ and /DocumentManager/
            vu.tuan.anh Level 1

            Hi Jon,

             

            Thank you for your reply.

             

            In workbench I created a process to use my custom component.

            Input is processId and fileName, output is a document variable.

             

            The output is as follow:

             

            PDFDocumentAttributes.JPG

             

            I see the content type is "application/pdf" already.

             

            By the way, could you tell me where is the method setContentTypeFromBasename() from the Document class? (I assume that the doc variable is Document class)

             

            Regards,

            Anh

            • 3. Re: Difference when viewing PDF render with /workspace-server/ and /DocumentManager/
              Jon Bionda Level 3

              Since the attachment you are displaying has a content type of application/pdf, it will be displayed properly.  It depends on how the attachment is loaded whether or not it will have the proper content type.

               

              In your first email, you provided a DocumentManger url that had the type parm specified as "type=YXBwbGljYXRpb24vb2N0ZXQtc3RyZWFt"

              I took this value and found an online Base64 decoder and the value becomes "application/octet-stream" (note if you want to try it yourself, remember to add "==" to the end).  This mime type is not mapped to any specific program so the browser needs to prompt the user to ask what it is supposed to do with it.

               

              The setContentTypeFromBasename() is a method on the Document class.  Use this in your custom java component.

              • 4. Re: Difference when viewing PDF render with /workspace-server/ and /DocumentManager/
                vu.tuan.anh Level 1

                Hi Jon,

                 

                Thank you for your reply.

                 

                In my client side code, when i receive the url https://mydomain/DocumentManager/docm1266831910962/53650adc3948bd502cf8c81d4885f eec?type=YXBwbGljYXRpb24vb2N0ZXQtc3RyZWFt, i remove the "?type=YXBwbGljYXRpb24vb2N0ZXQtc3RyZWFt" and navigate to the 1st part of URL, i,e, I navigate to https://mydomain/DocumentManager/docm1266831910962/53650adc3948bd502cf8c81d4885f eec

                 

                By the way, I have noticed the difference with the URL in local and client side.

                Client side returns me the "?type=YXBwbGljYXRpb24vb2N0ZXQtc3RyZWFt" (application/octet-stream) while local environment returns me the "?type=YXBwbGljYXRpb24vcGRm"(application/pdf)

                 

                In Server side, the custom component is used in a short-live process, it retrieves list of attachment base on taskId, then set into the list variable. An attachment will be set into a document output-variable.

                 

                In client side, it will call above web service, resultFormat is e4x and parse the content to get the url.

                 

                It is the same code and retrieve the same type of attachment pdf but the content type returned are different, what factor do you think that it can affect the content type? is it relate to environment?

                In local development we use windows XP as server, in client side, they use IBM AIX as server.

                 

                For the method setContentTypeFromBasename(), i cannot find it in the API of com.adobe.idp.Document

                http://livedocs.adobe.com/livecycle/8.2/programLC/programmer/javadoc/com/adobe/idp/Documen t.html

                In the eclipse i also cannot find it. Please advise.

                 

                 

                Thank you and regards,

                Anh

                • 5. Re: Difference when viewing PDF render with /workspace-server/ and /DocumentManager/
                  Jon Bionda Level 3

                  You are confusing me

                   

                  But first, the setContentTypeFromBasename() is an ES2 addition to the Document class.  Didn't realize this was a pre-ES2 case. Sorry about that.

                   

                  Next, you say you are removing the ?type=ASDFASDFASDF from the url on the client. This must be there so the DocumentManager servlet can set the proper content-type in the http response.  I looked at the code and if it isn't there, no content type is set so it will be browser and os dependent on what it will do,although i would expect most to prompt.

                   

                  And however your custom component and the short lived process work, that document output variable needs to have the proper content-type set in it (the Document has a setContentType() method in 8.2 but you will have to do the mapping from file extension to mime-type yourself in 8.2).  If it does and you don't remove the type parm from the url, then things will work.  But if that type parm isn't there or the content-type isn't set in the document output var, the browser will not know which application/plugin to launch and will prompt.

                   

                  Jon

                  • 6. Re: Difference when viewing PDF render with /workspace-server/ and /DocumentManager/
                    vu.tuan.anh Level 1

                    Hi Jon,

                     

                    Thank you for your great help.

                     

                    Yes, this is LCES 8.2.1, sorry for not make it clear at the first post.

                     

                    During development when I try to remove the part "?type=YXBwbGljYXRpb24vb2N0ZXQtc3RyZWFt" it is still able to display the PDF form in the browser, therefore I thought it is not needed. Now I know that it is needed for DocumentManager, I will add it back and test in client side again.

                     

                    Regards,

                    Anh

                    • 7. Re: Difference when viewing PDF render with /workspace-server/ and /DocumentManager/
                      vu.tuan.anh Level 1

                      Hi Jon

                       

                      Thank you very much for your help.

                       

                      After setting  the content-type to "application/pdf" and remain the part "?type=...", client has been able to view the form in the browser.

                       

                      Thank you again and regards,

                      Anh