1 2 3 4 5 Previous Next 269 Replies Latest reply: Nov 6, 2014 10:58 PM by jyoshna09 Go to original post RSS
      • 80. Re: Using Adobe LiveCycle Designer with ASP.NET to populate PDF Forms from Server Database.
        tarekahf Community Member

        Hi Kumar,

         

        This is to confirm your approach and clarify some points.

         

         

        - The logic you have mentioned is correct, excpet for the points mentioned here.

         

         

        - I do not see the need to convert PDF back to word, unless there is a direct requirement to change the PDF Content in MS Word. This kind of requirement is outside the scope of LC Desinger and there is no direct and easy way that I know to do that programatically from within PDF say using JavaScript.

         

         

        If you want to do that, then you have to give the user 2 options: 1. Generate PDF, 2. Generate MS Word. You have to write 2 separate ASP.NET Programs to render the PDF and MS Word, separately, from the Server to the client using Response.ContentType + Response.Write (bla bla bla) + Response.end.

         

         

        - You can definitally use single Adobe Acrobat Prof. 9 to Desing the Form and Reader-Enable it. But, you will lose some of the advanced features provided by Adobe LRES such as Allow Using Digital Signature under Adobe Reader. I am not exactly sure what else you will loose.

         

         

        - When you generate the PDF using XDP Format, there is no way you can save the result in PDF Binary Format. I hope I made this point clear. At this point in time, you can only get a TEXT Representation of the XDP File (XML Format). At any point in time, you can "Response.write" the content of this file back to the client, and it will work as long as the ContentType is set properly.

         

         

        At this point in time, you can Merge Data with the PDF Form. So, here, get all the data you want from the Database using .NET APIs, and merge it with the PDF Form.

         

         

        - When the PDF File is Rendered back to the client (generated for the first time), and you provided a "Submit" button which will submit the Data + PDF, then, on the server, you can receive the submitted stream which has the Form Field Values (Data) + the PDF Binary (under the "chunk" element) in Base64 String Format, which can be converted easily to a Binary Format using .NET APIs, and saved as PDF on the Server.

         

         

        - After the PDF File is saved as PDF Binary Format, then, there is no easy way you can push more data back to the PDF from the Server. You can do that, but it will require very complex programming which is not really worth it. Unless, however, you are using some Adobe LC Server Product (I forgot the name) which will enable such functionality, but it will cost a lot.

         

         

        - After the PDF is Generated and finally saved on the Server using a well-defined naming criteria (use GUID if you like), you have to save all the forms under a special web folder. Then, you have to generate a URL link to the generated PDF, and either save the URL in a record in the Database, or send the user an email with a link to the PDF, or just give him confirmation as Response.Write message. This way, the user can refer back to the PDF to complete the work later, to allow another user to complete his part.

         

         

        - The "Submit" logic on the PDF Button, and the related ASP.NET part, will work correctly in both cases: 1. After the PDF is Generate for the first time, 2. After it was saved, and rendered back to the client using direct URL. But, you have to wirte the .NET part in a flexible way to check if the file exists, and if you want to keep different versions after each submit.

         

         

        - To generate the form in MS Word Doc, kindly do google on this as I have never done this before, but I am sure it is only a matter of generateing HTML Tags properly, and set the Respose.ContentType to indicate MS Word Doc, and finally Response.Write ....etc. Maybe it is much simpler to ask the user to try "Save As" the PDF to MS Word, but he must have Acrobat I think.

         

         

        I hope this will help you implement your project.

         

         

        Tarek.

        • 81. Re: Using Adobe LiveCycle Designer with ASP.NET to populate PDF Forms from Server Database.
          ksADOBE2009 Community Member

          Hi Tarek:

           

          Cannot see such a sincere responder to questions raised by me. Cannot thank you enough.

           

          Now I need to respond with some real "action" which will take sometime. I will test the options given by you and send you the code whenever it is completely ready..may be it will take a few weeks for me since I do lots of other things along with this development. As of now I would go with all your ideas. I will not be able to respond in the forum as of now anything until I see some results from my side.

           

          Shall remind you about the class you have written after Aug 10, 2009.

           

          Thanks once again

          regards

          Kumar

          • 82. Re: Using Adobe LiveCycle Designer with ASP.NET to populate PDF Forms from Server Database.
            Vidya_radkrish Community Member

            Hi Tarek,

             

            It's been some time since I visited the forum. I had a previous request to create dynamic PDF and populating the data using XML and .net.
            I was able to complete it and it's working fine, I had multiple choices provided to the user as a radio button list and based on selection generated the documents.
            Now they want checkboxes instead of radio buttons, so I have to merge the multiple xdps created to a single xdp.
            each selected option is a unique pdf file, can you provide me some suggestions for merging xdps at runtime based on selection?
            We are not planning to use any third party tools for pdf merge, I have only adobe livecycle and .Net to work with.

             

            Thanks,
            Vidya

            • 83. Re: Using Adobe LiveCycle Designer with ASP.NET to populate PDF Forms from Server Database.
              tarekahf Community Member

              Hi Vidya,

               

              I did not understand your requirements. If you can clarify or provide some layout as a sample to give more details, I will try to help.

               

              Tarek.

              • 84. Re: Using Adobe LiveCycle Designer with ASP.NET to populate PDF Forms from Server Database.
                Vidya_radkrish Community Member

                Hi Tarek,

                 

                Currently I have three documents A,B and C.

                I have provided the user a radio button to select these documents, based on the selection I generate a dynamic pdf with values populated from database.

                 

                The requirement is instead of generating a single document at a time, I should provide  the user to select multiple documents and when selected I should generate a single pdf with doc A and B combined as one.

                 

                When I Provide a checkbox selections, the user selects doc A,B then I should generate the dynamic pdf A, B and merge both the documents as a single document and display to the user.

                 

                I am not planning to use any third party pdf tools for this. Is it possible using Adobe and .Net to merge documents as required.

                 

                Sorry for not being clear previously.

                 

                Thanks,

                Vidya

                 

                 

                 

                 

                 

                 

                 

                 

                 

                Date: Tue, 15 Sep 2009 19:54:49 -0600

                From: forums@adobe.com

                To: vidya_radkrish@hotmail.com

                Subject: Using Adobe LiveCycle Designer with ASP.NET to populate PDF Forms from Server Database.

                 

                Hi Vidya,

                 

                I did not understand your requirements. If you can clarify or provide some layout as a sample to give more details, I will try to help.

                 

                Tarek.

                >

                • 85. Re: Using Adobe LiveCycle Designer with ASP.NET to populate PDF Forms from Server Database.
                  gurlnpink

                  Hi Tarek,

                   

                  You have helped so many people and I was hoping you could help me with my requirement.

                   

                  I am designing an ASP.NET page containing an embedded PDF form.  This PDF form will be displayed within this ASP.NET through a click of a LinkButton.  I am able to achieve this requirement so far.  One thing I am missing is to have the connectivity between this PDF form and my ASP.NET page to submit the user-filled PDF form to my web application's file directory (a folder within my website) as a PDF file using another LinkButton.  I know you have a similar requirement with sample codes posted in this thread.  Only thing is it is being submitted as 'XDP' which I know nothing about.

                   

                  By the way, I am using LiveCycle Designer ES 8.2 to create my interactive PDF forms and my users will be using Acrobat Reader to fill out the form.  I hope you can lead me to the right direction.  Thank you.

                  • 86. Re: Using Adobe LiveCycle Designer with ASP.NET to populate PDF Forms from Server Database.
                    gurlnpink Community Member

                    Tarek, please disregard previous request.  A resolution has been reached.  Thank you for your time.

                    • 87. Re: Using Adobe LiveCycle Designer with ASP.NET to populate PDF Forms from Server Database.
                      $Aravind.K$

                      Hi Tarek,

                       

                       

                      I am very new to this adobe life cycle though i learnt alot from your favorite post in less time. Really thank you very much,

                       

                      My requirement is as below,  i need help / suggession from you..

                       

                       

                      1. The user will login to the system, Then we show two section on fill able pdf form

                                a) Part I: preloaded user information, I am able to achieve this by creating xml file after user successful login, after that I can embed this xml file to pdf form. (DONE)

                                b) Part II set of questions need to be answer by user.

                       

                       

                      I need help on below issue,

                       

                      1. I need to validate the part II, need to check for user answered all the questions or not. (How to check can you provide any sample code available)

                       

                      2. I need to save pdf (with data key-in by user) after user click submit button [which located on pdf form].(How to save pdf file in Server folder)

                      [I refered in from this article and notice that using "chunk" convert binary data to pdf and save to server, am i correct?]

                      3. I had signature field on the form, so when save as pdf can we save form including signature field.(is this can be achieved)

                      [After i sign the form using signature field why received save form dialog? do we can control this?]

                       

                      I am using Adobe life cycle 8.2 to design pdf form, and client will use adobe reader to fill up the form.

                       

                      Thanks in advance.

                       

                      Thanks.

                      • 88. Re: Using Adobe LiveCycle Designer with ASP.NET to populate PDF Forms from Server Database.
                        tarekahf Community Member

                        Hi $Aravind.K$

                         

                        I have read your post and I will be able to reply by next coming Sunday God Willing. I am preparing for my return to the Office after comleting my Eid Vacation and I have very limied access to the Internet. Sorry about that.

                         


                        Tarek.

                        • 89. Re: Using Adobe LiveCycle Designer with ASP.NET to populate PDF Forms from Server Database.
                          $Aravind.K$ Community Member

                          I did place button(Normal button) on pdf form, and wrote validation in button click event, its working fine for me, the page validation and singnature validation(weather signed or not) is in place.

                           

                          afte i click the submit button i am using below code..

                           

                           

                          var myURL = "../Acknowledge.aspx";

                           

                          var myDoc = event.target;

                          myDoc.submitForm({cURL

                          : myURL,cSubmitAs: "PDF",cUsageRights: submitFormUsageRights.RMA});

                           

                          the page redirecting correctly... but i am not sure how to save pdf file to server folder from here...

                           

                           

                          I need to save pdf (with data key-in by user) after user click submit button [which located on pdf form].(How to save pdf file in Server folder)

                           

                          I had signature field on the form, so when save as pdf can we save form including signature field.(is this can be achieved)

                          [After i sign the form using signature field why received save form dialog? do we can control this?] - i figure out this, we can't control this if we open form in adobe reader. But this won't(save dialog) appear if we open pdf form using broswer like IE.

                          • 90. Re: Using Adobe LiveCycle Designer with ASP.NET to populate PDF Forms from Server Database.
                            tarekahf Community Member

                            Hi $Aravind.K$,

                             

                            I have collected for you the following lines of code to help you save the PDF along with all signtures and all data as is in binary format.

                             

                            Simply, the code will retreive the submitted XDP and PDF from the imput stream in String Format, get the "chunk" element, and convert it from string back to binary and write it as PDF File using a stream writer.

                             

                            The code below must be placed in ASPX Page Load Event which is the submit URL:

                             

                            Dim fso As New Scripting.FileSystemObject

                            Dim fs As System.IO.FileStream = Nothing
                            Dim bw As System.IO.BinaryWriter = Nothing

                            Dim sreader As New System.IO.StreamReader(Page.Request.InputStream)
                            Dim xmlData As String = sreader.ReadToEnd()
                            Dim xmldoc As New System.Xml.XmlDataDocument
                            Dim chunk As String
                            Dim buffer() As Byte

                            Dim PDFFileName as string = "thefilename.pdf"

                            xmldoc.LoadXml(xmlData)

                            chunk = xmldoc.GetElementsByTagName("chunk")(0).InnerXml

                            '

                            ' Here you can validate if chunk is empty, and stop or report unexpected error.

                            '
                            buffer = Convert.FromBase64String(chunk)
                            If fso.FileExists(PDFFileName) Then
                               fso.DeleteFile(PDFFileName, True)
                            End If
                            fs = New System.IO.FileStream(PDFFileName, IO.FileMode.Create)
                            bw = New System.IO.BinaryWriter(fs)
                            bw.Write(buffer)
                            bw.Close()
                            bw = Nothing
                            fs.Close()
                            fs = Nothing

                             


                            On the client side PDF Form, the JavaScript Submit Button, must have the following code or similar:

                             

                            event.target.submitForm(
                            {cURL: "http://blablabla/submiturl.aspx", 
                            aPackets:["datasets","pdf"], cSubmitAs: "XDP"});

                             

                             

                            For Validation, you can use JavaScrip to Validate the answers of the questions, and you can always push the answers and the questions from the server to the client same like any other data fields using repeating format. This will make your form more dynamic, but this is very advanced and requires lots of programming effort.

                             

                            I hope this will be of help to you.

                             

                            Tarek.

                            • 91. Re: Using Adobe LiveCycle Designer with ASP.NET to populate PDF Forms from Server Database.
                              $Aravind.K$ Community Member

                              Dear Tarek,

                               

                              Thank you very much for your response.

                               

                              with your help i manage to complete the preocess(requirement). Now every thing looks fine.

                               

                              can i ask you what are the steps you follow to minimize the pdf size. because my pdf file is about 400K + (which contain 3 pages - no images only static objects - but i use font calibri which is not default font in adobe). Becuase i am posting this pdf form on web, if the file size is more it may mitigate the performance.(i save the pdf also as static pdf)

                               

                              Thanks.

                               

                              Regards,

                              Aravind.K

                              • 92. Re: Using Adobe LiveCycle Designer with ASP.NET to populate PDF Forms from Server Database.
                                tarekahf Community Member

                                Hi Aravind.K,

                                 

                                Try the following:

                                 

                                Goto Form Properties, Save Options, and deselect the option "Generate Accessibility Info...". Save the form, and see if this will be of help.

                                 

                                Also note that every time you sign the form, a complete full version of the PDF is save as a snapshot in the signature itself. Later, you can view the signed version by right-click the signature and select view signed version. This will also increase the PDF size, but, it will protect the document authenticity and integrity.

                                 

                                Tarek.

                                • 93. Re: Using Adobe LiveCycle Designer with ASP.NET to populate PDF Forms from Server Database.
                                  $Aravind.K$ Community Member

                                  Dear Tarek,

                                   

                                  Many thanks for your prompt response.

                                   

                                  i did save the form by uncheck "Generate Accessibility Info" [in save options], but there is not file size change. is any other options will help to minize the document size.

                                   

                                  Thank you very much.

                                  • 94. Re: Using Adobe LiveCycle Designer with ASP.NET to populate PDF Forms from Server Database.
                                    gurlnpink Community Member

                                    Hi tarekahf,

                                     

                                    Could you help me with an issue?  I was able to successfully load and store interactive PDF through ASP.NET C# using the script you provided.  My issue is that I am unable to prepopulate the PDF at initial load.  I followed your code by creating XML but it doesn't seem to work.  Please help.  It is all I'm missing.

                                    • 95. Re: Using Adobe LiveCycle Designer with ASP.NET to populate PDF Forms from Server Database.
                                      $Aravind.K$ Community Member

                                      Response.ContentType = "application/vnd.adobe.xdp+xml"

                                       

                                                  Dim Responsestring As New StringBuilder()

                                       

                                                  Responsestring.Append("<?xml version='1.0' encoding='UTF-8'?>")

                                       

                                                  Responsestring.Append("<?xfa generator='AdobeDesigner_V8.2'?>")

                                       

                                                  Responsestring.Append("<xdp:xdp xmlns:xdp='http://ns.adobe.com/xdp/'>")

                                       

                                                  Responsestring.Append("<xfa:datasets xmlns:xfa='http://www.xfa.org/schema/xfa-data/1.0/'>")

                                       

                                                  Responsestring.Append("<xfa:data>")

                                       

                                                  Responsestring.Append("<form1>")


                                                  Responsestring.Append("<FieldID>" & --Value-- & "</FieldID>")


                                                  Responsestring.Append("</form1>")     

                                               

                                                   Responsestring.Append("</xfa:datasets>")


                                                  Responsestring.Append("<pdf href='http://" + Page.Request.ServerVariables("HTTP_HOST").ToString & Page.Request.ApplicationPath +  "Test.pdf' xmlns='http://ns.adobe.com/xdp/pdf/' />")


                                                  Responsestring.Append("</xdp:xdp>")


                                                  Response.Write(Responsestring)


                                                  Response.Flush()


                                                  Response.End()   

                                      • 96. Re: Using Adobe LiveCycle Designer with ASP.NET to populate PDF Forms from Server Database.
                                        Tarek AHF Community Member

                                         

                                         

                                        • 97. Re: Using Adobe LiveCycle Designer with ASP.NET to populate PDF Forms from Server Database.
                                          gurlnpink Community Member

                                          Hi Tarek AHF & $Aravind.K$,

                                           

                                          Thank you both for your input.  I tried both of your suggestions but I still couldn't get the form to populate.  I was able to extract the XML data of the form with a manually entered value just as Tarek has suggested but I still wouldn't prepopulate the field at load.  Here's my code and the generated XML from manual input.

                                           

                                          <?xml version="1.0" encoding="UTF-8" ?>

                                          -<topmostSubform>
                                          <TextField1>Test</TextField1>
                                          <TextField2 />
                                          <TextField3 />
                                          <TextField3 />
                                          <TextField4 />
                                          <TextField4 />
                                          <TextField3 />
                                          </topmostSubform>

                                          Response.ContentType =

                                          "application/vnd.adobe.xdp+xml";

                                           

                                          StringBuilder XDFdataset = new StringBuilder();

                                          XDFdataset.Append(

                                          "<?xml version='1.0' encoding='UTF-8'?>");

                                          XDFdataset.Append(

                                          "<?xfa generator='AdobeDesigner_V8.2'?>");//("<?xfa generator='XFA2_4' APIVersion='2.6.7120.0'?>");

                                          XDFdataset.Append(

                                          "<xdp:xdp xmlns:xdp='http://ns.adobe.com/xdp/'>");

                                          XDFdataset.Append(

                                          "<xfa:datasets xmlns:xfa='http://www.xfa.org/schema/xfa-data/1.0/'>");

                                          XDFdataset.Append(

                                          "<xfa:data>");

                                           

                                          //XDFdataset.Append(@"<form1>");

                                          XDFdataset.Append(

                                          "<topmostSubForm>");

                                          XDFdataset.Append(

                                          "<TextField1>" + "Test" + "</TextField1>");

                                           

                                          //XDFdataset.Append(@"<Tester>");

                                           

                                          //XDFdataset.Append("Test");

                                           

                                          //XDFdataset.Append(@"</Tester>");

                                           

                                          //XDFdataset.Append("</TextField1>");

                                          XDFdataset.Append(

                                          "</topmostSubForm>");

                                           

                                          //XDFdataset.Append(@"</form1>");

                                          XDFdataset.Append(

                                          "</xfa:data>");

                                          XDFdataset.Append(

                                          "</xfa:datasets>");

                                          XDFdataset.Append(

                                          "<pdf href='" + HttpContext.Current.Server.MapPath("~/Permits/FRM19.pdf") + "' xmlns='http://ns.adobe.com/xdp/pdf/'/>");

                                           

                                          //XDFdataset.Append("<xfdf xmlns='http://ns.adobe.com/xfdf/' xml:space='preserve'>");

                                           

                                          //XDFdataset.Append("<annots/>");

                                           

                                          //XDFdataset.Append("</xfdf>");

                                          XDFdataset.Append(

                                          "</xdp:xdp>");

                                          Response.Write(XDFdataset);

                                          Response.Flush();

                                          Response.End();

                                           

                                          The above code snippet displays the PDF form but without the value specified.  Please help!

                                           

                                           

                                          • 98. Re: Using Adobe LiveCycle Designer with ASP.NET to populate PDF Forms from Server Database.
                                            tarekahf Community Member

                                            There may be something wrong with your adove reader/acrobat installation.

                                             

                                            Just to start clean, remove all adobe reader/acrobat, and re-install the latest version of reader/acrobat.

                                             

                                            Open the empty pdf in reader, and use import to import the same generated xml into the form using the import menu option.

                                             

                                            Also, remove the "Response.flush()". It used to cause problems for my case.

                                            Tell me what happens.

                                             

                                            Tarek.

                                            • 99. Re: Using Adobe LiveCycle Designer with ASP.NET to populate PDF Forms from Server Database.
                                              gurlnpink Community Member

                                              Hi tarekahf,

                                               

                                              Thanks for your suggestions! You've been a great help!

                                               

                                              I decided to use iTextSharp instead to manipulate my PDF forms.  It is more flexible.

                                               

                                              Thank you!

                                              • 100. Re: Using Adobe LiveCycle Designer with ASP.NET to populate PDF Forms from Server Database.
                                                tarekahf Community Member

                                                Hi gurlnpink ,

                                                 

                                                Appreciate your update. I might use iTextSharp in my next project.

                                                 

                                                As per my research about 2 years ago, I figured out that iTextSharp was desinged to handle Acrobat PDF not XFA Forms. I thought at that time that it will not be easy for example to populate a XFA form with repeating subform in a Dynamic PDF. I am not 100% sure though.

                                                 

                                                I appreciate it if you let me know if you can use iTextSharp to populate and read from a repeating Subform in a Dynamic XFA PDF.

                                                 

                                                Tarek.

                                                • 101. Re: Using Adobe LiveCycle Designer with ASP.NET to populate PDF Forms from Server Database.
                                                  gurlnpink Community Member

                                                  Hi Tarek,

                                                   

                                                       I have only used iTextSharp to populate textfields and manipulate the visibility of buttons inside a PDF.  You can populate any objects inside a PDF as long as you assign a definite name per object.  This is as far as I have used the dll.  It actually took me awhile to understand how to use it as there aren't a lot of help on the web

                                                   

                                                  Goodluck on your new challenge

                                                  • 102. Re: Using Adobe LiveCycle Designer with ASP.NET to populate PDF Forms from Server Database.
                                                    Questionspleasehelp

                                                    Hello can you send me

                                                    a working copy of a PDF with asp or PDF

                                                    that will take the users Name and when the user Clicks the SAVE AS button the pdf file will go to a folder on the server with the users name form the PDF file so we know what file each user saves. You can email me at fredssmith@mail.com 

                                                     

                                                    Help needed please

                                                    • 103. Re: Using Adobe LiveCycle Designer with ASP.NET to populate PDF Forms from Server Database.
                                                      tarekahf Community Member

                                                      fredssmith,

                                                       

                                                      What you are asking for can be done, but is a client side type of solution.

                                                       

                                                      I mean, each user who wants to use your form, must do some configuration work to so that he can use the form functions.

                                                       

                                                      So, if the number of the users is small, that is fine. Otherwise, it will be hell of a job. Not to mention the maintenance overhead.




                                                      Why not implement a server-side solution ? It will take a bit more time to get started, but this is the right direction.

                                                       

                                                      Could you please specify your requirements, I need more details to be able to help you. Do not mention how to impelement the solution, just talk about your requirements.

                                                       

                                                      Tarek.

                                                      • 104. Re: Using Adobe LiveCycle Designer with ASP.NET to populate PDF Forms from Server Database.
                                                        tarekahf Community Member

                                                        AjoJoseph wrote:

                                                         

                                                        Hi Tarek


                                                        Firstly let me say thank you for the great help you are doing through the forum.

                                                         

                                                        With Google, I did a very long search to find out how to fill a PDF form from a database. I achieved this using the iTextSharp dll. But this dll not supporting adobe extended features. thatsy once i filled forms using this class, result form will be flat form and we cant fill it manually again. even this will disable adobe extended features when i open it in adobe reader.

                                                         

                                                        I am working with a project to simplify immigration process (CANADA). I already have all immigration forms created using LiveCycle. That means when i open these form in free Adobe Reader I can fill the form manually and can save locally (offline).

                                                         

                                                        My Workflow as follows

                                                         

                                                        1. I am working with .Net Frame Work 2, Visual Studio 2005, Windows Applications (not Web/ASP)

                                                         

                                                        2. I have fillable forms designed using Adobe LiveCycle (I can fill the form manually and can save locally (offline) using Adobe Reader).

                                                         

                                                        3. I have to dynamically fill these forms with data from a database (data is already available and its almost achieved using iTextSharp Dll)

                                                        4. Once its dynamically filled, I will send these forms to client through email, because some of the data should be filled by client.

                                                         

                                                        5. client can open these forms in free Adobe Reader and they can fill and save these forms(because Adobe extended feature enabled in this form, so they can fill and save in Adobe Reader)

                                                         

                                                        6. Once they fill and save the form, they will send back final form to us through emal (no Online Submit required).

                                                         

                                                        7. We will check it and finalize, take printout and attach to our document management system.

                                                         

                                                        8. I can't use any great technologies bcz I dont need any online Submision/Rejection thing and our budjet is low.

                                                         

                                                        9. I am looking some technologies same as itextShar, simply fill data to form and save it as a new PDF, but it should support Adobe Extended Featers( what is currently not available in iTextSharp), so that customer can fill and save it again using simple  and free ADOBE READER.

                                                         

                                                        That's it !!

                                                         

                                                        could u please verify my workflow is correct or not, bcz am new to PDF things and can u please suggest me solution to achieve this.

                                                         

                                                        Thanks in advance

                                                        Ajo Joseph

                                                         

                                                         

                                                        This is a reply to the original thread posted here:

                                                         

                                                        http://forums.adobe.com/thread/564995?tstart=0

                                                         

                                                        I will come back with an answer soon.

                                                         

                                                        Tarek.

                                                        • 105. Re: Using Adobe LiveCycle Designer with ASP.NET to populate PDF Forms from Server Database.
                                                          tarekahf Community Member

                                                          Hi AjoJoseph,

                                                           

                                                          Looks like your application does not need to be web-enabled, right ?

                                                           

                                                          In that case, you will have to develop some kind of client-side application using VB.NET. There is no need to develop web-application using ASP.NET since this will add some confusion to the user, but in my opinion, it will be easier to develop web application than a client-side application. Keep in mind that you need at least one license from Adobe Acrobat if you go for client-side application.

                                                           

                                                          However, if you decide to make it client-side, then check this thread:

                                                           

                                                          http://www.acrobatusers.com/forums/aucbb/viewtopic.php?id=15695

                                                           

                                                          I never used iTextSharp. I used Acrobat SDK, XDP (xfa) and XML to handle data communication from/to the Database and the PDF Form.

                                                           

                                                          I tried to work with iTextSharp about 2 years ago, and I got lost, so I decided to use the available tools from Adobe and .NET to achieve my requirements.

                                                           

                                                          The workflow you suggested is correct. If you do not want to do fancy job (on-line submission), then this is the way to go. We implemented similar workflow process last year to deal with about 200 PDF Forms, and it worked 100% correct.

                                                           

                                                          I will add the following to make it work properly from the technical side:

                                                           

                                                          1. Write a .NET Program using Acrobat IAC (OLE) to generate and populate the PDF. First, Generate the XML Data, use Empty PDF as a template, then attach the XML Data to the PDF, then save the PDF using a Key Value as the File Name. You can use .NET XML Object to generate the XML String. Make sure to assign the Key Value to a field inside the PDF as Read-Only. Also, put some control fields inside the PDF like: Status, DateTime Stamp, PDf Version ...etc to help you make correct decisions while processing the PDF.

                                                           

                                                          2. Decide if you want to send the generated PDF also from a .NET Program. It can be done.

                                                           

                                                          3. Once you receive the PDF as a reply by email, save them all to a folder in the local drive (we have done this manually).

                                                           

                                                          4. Write a .NET Program to iterate over the saved PDF Files, extract the XML Data, and write the result back to a Database, if needed. You can then here send confirmation by email to the applicant.

                                                           

                                                          I hope this will be of help to you.

                                                           

                                                          Tarek.

                                                          • 106. Re: Using Adobe LiveCycle Designer with ASP.NET to populate PDF Forms from Server Database.
                                                            AjoJoseph

                                                            Hi Tarek,

                                                             

                                                            Thank you very much for the reply.

                                                             

                                                            I have one  doubt. You mentioned "need at least one license from Adobe Acrobat if you go for client-side application", that means we have to buy licence in each client mechine in which we install the application or only in my developemt mechine ?  If I install free Adobe Acrobat reader in end user mechine, this will work or not. I can include Adobe dll in my setup if required. Bcz I can't tell all end users  to buy Adobe license.

                                                             

                                                            Thanks & Regards

                                                            Ajo Joseph

                                                            • 107. Re: Using Adobe LiveCycle Designer with ASP.NET to populate PDF Forms from Server Database.
                                                              tarekahf Community Member

                                                              Hi Ajo Joseph,

                                                               

                                                              You only need Acrobat Pro License on the PC where you will run the program that uses Acrobat SDK/IAC/OLE. If you enable Reader Rights, to the best of my knowldge, it will be maintained and the end-user do not neet to have Acrobat License. You need Acrobat in any case to Enable Reader Rights from the source.

                                                               

                                                              Tarek.

                                                              • 108. Re: Using Adobe LiveCycle Designer with ASP.NET to populate PDF Forms from Server Database.
                                                                AjoJoseph Community Member

                                                                Hi Tarek,

                                                                 

                                                                Thank you very much for the information.

                                                                In my case, reading data from a filled form and updating data back to database is not that much important. I need to dynamically fill the form using the data from my database before I email the forms to end users. For this purpose can you give any sample code/Docuementation ? I am going through VBJavaScript.Pdf. I am planning to continue with VB.Net, not ASP/WEB, bcz I am familiar with VB.NET and C#.NET.

                                                                 

                                                                Thanks & Regards

                                                                Ajo Joseph

                                                                • 109. Re: Using Adobe LiveCycle Designer with ASP.NET to populate PDF Forms from Server Database.
                                                                  tarekahf Community Member

                                                                  Just go through the sample code you I gave you. What you are asking for is just the reverse operation. As a matter of fact, the sample code I provided is generating a Unique Serial Number and saving the result in "Form_Id" field, then it will save the form back. It has everything you need to get started.

                                                                   

                                                                  Tarek.

                                                                  • 110. Re: Using Adobe LiveCycle Designer with ASP.NET to populate PDF Forms from Server Database.
                                                                    AjoJoseph Community Member

                                                                    Hi Tarek,

                                                                     

                                                                    Sorry to disturb you.

                                                                    I got some sample codes from Acrobat 9 SDK c# samples, and that code is enough for my purpose. I have attached that code below. but the issues is I am getting one error while running this code "No document is currently open in the Acrobat Viewer" when it reach on red color line. could u please check this. In this code  Object formApp      ( IAFormApp formApp = new AFormAppClass() ) is not associated to any other objects like AcroAppClass, theny how its getting form details ? its taking form from currently opened Acrobat window ? I spent lot of time in google to get a good documentation of these classes, but not available, any idea about these documentations ?

                                                                     

                                                                    Thanks in advance

                                                                     

                                                                    Ajo Joseph

                                                                     

                                                                     

                                                                     

                                                                     

                                                                    using System;
                                                                    using System.Collections;
                                                                    using System.Windows.Forms;
                                                                    using System.ComponentModel;
                                                                    using Acrobat;
                                                                    using AFORMAUTLib;

                                                                    namespace FillFormCS
                                                                    {
                                                                    /// <summary>
                                                                    /// Summary description for FillFormCS.
                                                                    /// </summary>
                                                                    class FillFormCS
                                                                    {
                                                                      // Hard-coded file name, it can be changed when needed.
                                                                      /// <summary>
                                                                      /// The main entry point for the application.
                                                                      /// </summary>
                                                                      [STAThread]
                                                                      static void Main(string[] args)
                                                                      {
                                                                                String FORM_NAME = Application.StartupPath + "\\..\\..\\..\\..\\..\\TestFiles\\SampleForm.pdf";
                                                                       // Initialize Acrobat by cretaing App object.
                                                                       CAcroApp acroApp = new AcroAppClass();
                                                                      
                                                                       // Show Acrobat Viewer
                                                                       acroApp.Show();

                                                                       // Create an AVDoc object
                                                                       CAcroAVDoc avDoc = new AcroAVDocClass();

                                                                       // Open the pdf
                                                                       if(!avDoc.Open (FORM_NAME, ""))
                                                                       {
                                                                        string szMsg = "Cannot open" + FORM_NAME + ".\n";
                                                                        Console.WriteLine(szMsg);
                                                                        return;
                                                                       }

                                                                       // Create a IAFormApp object, so that we can access the form fields in
                                                                       // the open document
                                                                       IAFormApp formApp = new AFormAppClass();

                                                                       // Get the IFields object associated with the form
                                                                       IFields myFields = (IFields)formApp.Fields;

                                                                       // Get the IEnumerator object for myFields
                                                                       IEnumerator myEnumerator = myFields.GetEnumerator();

                                                                       bool bFound = false;

                                                                       // Fill the "Name" field with value "John Doe"
                                                                       while(myEnumerator.MoveNext())
                                                                       {
                                                                        // Get the IField object
                                                                        IField myField = (IField)myEnumerator.Current;

                                                                        // If the field is "Name", set it's value to "John Doe"
                                                                        if(myField.Name == "Name")
                                                                        {
                                                                         bFound = true;
                                                                         myField.Value = "John Doe";
                                                                         break;
                                                                        }
                                                                       }

                                                                       if(bFound)
                                                                        Console.WriteLine("Sucessfully changed the \"Name\" field value to \"John Doe\".");
                                                                       else
                                                                        Console.WriteLine("Failed to locate the \"Name\" field in the form.");
                                                                      }
                                                                    }
                                                                    }

                                                                     

                                                                     

                                                                    • 111. Re: Using Adobe LiveCycle Designer with ASP.NET to populate PDF Forms from Server Database.
                                                                      tarekahf Community Member

                                                                      If you are running the FillFormCS sample code without any changes to the logic, then make sure of the following:

                                                                       

                                                                      1. The path to the file is correct with proper escaping, like this "c:\\folder\\filename.pdf"

                                                                       

                                                                      2. The file exists,

                                                                       

                                                                      3. Ensure the file is opened and give it enough time to load completely,

                                                                       

                                                                      4. Debug step by step, and wait for a few sconds before executing the line where it fails,

                                                                       

                                                                      5. Before you starting the application using "F5", kill all the tasks named "Acrobat.exe" from Windows task manager.

                                                                       

                                                                      6. Call Show() after the Open(), not before.

                                                                       

                                                                      If you have done all the steps above and still there is error, then there is a problem with Acorbat 9 Prof. Try Acrobat Prof 7.0.5.

                                                                       

                                                                      Also, try following the sample I provided you. I used Acorbat Prof. 7.0.5 SDK to get this code and tested successfully under Adobe Acorbat 7.0.5. If it does not work with you, then this is an issue in Acrobat 9.

                                                                       

                                                                      Also, you can get Acrobat SDK Paid Support by contacting europartners@adobe.com

                                                                       

                                                                      Good luck.

                                                                       

                                                                      Tarek.

                                                                      • 112. Re: ASP.NET Class to render LiveCycle Form.
                                                                        tarekahf Community Member

                                                                         

                                                                         

                                                                         

                                                                        I have developed a Simple Class to defined and render a PDF Form. It will simplify your job to a great extent:

                                                                         

                                                                         

                                                                         

                                                                        Imports System.IO
                                                                        <Serializable()> _
                                                                        Public Class AdobeLiveCycleForm
                                                                        
                                                                        #Region "  Business Methods  "
                                                                            Private Shared mXDPHeader As String
                                                                            'Private mXDPData As String
                                                                            Private mXDPFooter
                                                                            Private mXDPData As Text.StringBuilder
                                                                            Private mDoWriteToFile As Boolean
                                                                            Private mFileName As String
                                                                            Private mOutputFile As StreamWriter
                                                                        
                                                                            Public ReadOnly Property XDPHeader() As String
                                                                                Get
                                                                                    Return mXDPHeader
                                                                                End Get
                                                                            End Property
                                                                        
                                                                            Public Property XDPData() As String
                                                                                Get
                                                                                    Return mXDPData.ToString
                                                                                End Get
                                                                                Set(ByVal value As String)
                                                                                    mXDPData.Length = 0
                                                                                    mXDPData.Append(value)
                                                                                    If mDoWriteToFile Then
                                                                                        mOutputFile.Close()
                                                                                        IO.File.Delete(mFileName)
                                                                                        mOutputFile = New System.IO.StreamWriter(mFileName, False, Text.UTF8Encoding.UTF8)
                                                                                        mOutputFile.Write(mXDPHeader & mXDPData.ToString)
                                                                                    End If
                                                                                End Set
                                                                            End Property
                                                                        
                                                                            Public ReadOnly Property XDPFooter() As String
                                                                                Get
                                                                                    Return mXDPFooter
                                                                                End Get
                                                                            End Property
                                                                        
                                                                            Public ReadOnly Property FileName() As String
                                                                                Get
                                                                                    Return mFileName
                                                                                End Get
                                                                            End Property
                                                                        
                                                                            Public ReadOnly Property GetXDP() As String
                                                                                Get
                                                                                    Return mXDPHeader & mXDPData.ToString & mXDPFooter
                                                                                End Get
                                                                            End Property
                                                                        
                                                                            Public Sub CloseXDP()
                                                                                If mDoWriteToFile Then
                                                                                    mOutputFile.Write(mXDPFooter)
                                                                                    mOutputFile.Flush()
                                                                                    mOutputFile.Close()
                                                                                    mOutputFile.Dispose()
                                                                                    mOutputFile = Nothing
                                                                                End If
                                                                            End Sub
                                                                        
                                                                            Public Sub CloseFile()
                                                                                If mDoWriteToFile Then
                                                                                    Try
                                                                                        mOutputFile.Flush()
                                                                                        mOutputFile.Close()
                                                                                        mOutputFile.Dispose()
                                                                                        mOutputFile = Nothing
                                                                                    Catch ex As Exception
                                                                        
                                                                                    End Try
                                                                                End If
                                                                            End Sub
                                                                        
                                                                            Private Sub InitStringBuilder()
                                                                                If mXDPData Is Nothing Then
                                                                                    mXDPData = New Text.StringBuilder
                                                                                End If
                                                                            End Sub
                                                                        
                                                                            Public Sub AppendXDPData(ByVal NewXDPData As String)
                                                                                mXDPData.Append(NewXDPData)
                                                                                If mDoWriteToFile Then
                                                                                    mOutputFile.Write(mXDPData.ToString)
                                                                                    mXDPData.Length = 0
                                                                                End If
                                                                            End Sub
                                                                        
                                                                            Public Sub Render(ByVal WebResponse As System.Web.HttpResponse)
                                                                                WebResponse.ContentType = "application/vnd.adobe.xdp+xml"
                                                                                If mDoWriteToFile Then
                                                                                    WebResponse.WriteFile(mFileName)
                                                                                    'WebResponse.TransmitFile(mFileName)
                                                                                Else
                                                                                    WebResponse.Write(GetXDP)
                                                                                End If
                                                                                'WebResponse.End()
                                                                            End Sub
                                                                        
                                                                        #End Region
                                                                        
                                                                        #Region " Constructors "
                                                                            Public Sub New(ByVal XDPFormLink As String)
                                                                                Dim strXMLBuilder As Text.StringBuilder = New Text.StringBuilder
                                                                        
                                                                                If String.IsNullOrEmpty(mXDPHeader) Then
                                                                                    '
                                                                                    ' Build the Constant XDP Header which is common for all forms
                                                                                    '
                                                                                    strXMLBuilder.Length = 0
                                                                                    strXMLBuilder.Append("<?xml version='1.0' encoding='UTF-8'?>")
                                                                                    strXMLBuilder.Append("<?xfa generator='AdobeDesigner_V7.0' APIVersion='2.2.4333.0'?>")
                                                                                    strXMLBuilder.Append("<xdp:xdp xmlns:xdp='http://ns.adobe.com/xdp/'>")
                                                                                    strXMLBuilder.Append("<xfa:datasets xmlns:xfa='http://www.xfa.org/schema/xfa-data/1.0/'>")
                                                                                    strXMLBuilder.Append("<xfa:data>")
                                                                                    mXDPHeader = strXMLBuilder.ToString
                                                                                End If
                                                                        
                                                                                InitStringBuilder()
                                                                        
                                                                                '
                                                                                ' Build the XDP Footer part
                                                                                '
                                                                                strXMLBuilder.Length = 0
                                                                                strXMLBuilder.Append("</xfa:data>")
                                                                                strXMLBuilder.Append("</xfa:datasets>")
                                                                                '
                                                                                ' Point the XPD to the PDF Form created under Adobe LiveCycle Desinger
                                                                                '
                                                                                strXMLBuilder.Append("<pdf href='" & XDPFormLink & "' xmlns='http://ns.adobe.com/xdp/pdf/' />")
                                                                                '
                                                                                ' Close the XPD File
                                                                                '
                                                                                strXMLBuilder.Append("</xdp:xdp>")
                                                                                mDoWriteToFile = False
                                                                                mXDPFooter = strXMLBuilder.ToString
                                                                            End Sub
                                                                        
                                                                            Public Sub New(ByVal XDPFormLink As String, ByVal OutputFilePath As String)
                                                                                Me.New(XDPFormLink)
                                                                                mFileName = OutputFilePath
                                                                                mOutputFile = New System.IO.StreamWriter(mFileName, False, Text.UTF8Encoding.UTF8)
                                                                                mDoWriteToFile = True
                                                                                mOutputFile.Write(mXDPHeader)
                                                                            End Sub
                                                                        
                                                                            Private Sub New()
                                                                        
                                                                            End Sub
                                                                        #End Region
                                                                        
                                                                            Protected Overrides Sub Finalize()
                                                                                MyBase.Finalize()
                                                                                Try
                                                                                    If Not mOutputFile Is Nothing Then
                                                                                        mOutputFile.Flush()
                                                                                        mOutputFile.Close()
                                                                                        mOutputFile.Dispose()
                                                                                    End If
                                                                                Catch ex As Exception
                                                                                Finally
                                                                                    mOutputFile = Nothing
                                                                                End Try
                                                                            End Sub
                                                                        End Class
                                                                        

                                                                         

                                                                        Also, I developed this "LabRequestReport" class, which uses the above class, also, it uses "XmlDocument" object to generate the XML, much more simplere than before:

                                                                         

                                                                        Imports System.Xml
                                                                        Namespace Clinic
                                                                        
                                                                            Public Class LabReport01PDF
                                                                                Inherits AdobeLiveCycleForm
                                                                        
                                                                                Public Sub New(ByVal theLabRequestID As String)
                                                                                    MyBase.New(Configuration.ConfigurationManager.AppSettings("LabReport01URLRoot").ToString)
                                                                                    Dim theLabRequest As LabRequest
                                                                                    Dim theLabItem As LabRequestItem
                                                                                    Dim theLabItems As Csla.SortedBindingList(Of LabRequestItem) = Nothing
                                                                                    Dim theStaffBasicInfo As StaffBasicInfo
                                                                                    Dim theLastCatg As String
                                                                                    Dim CurrCatg As String
                                                                                    Dim theXML As XmlDocument
                                                                                    Dim xmlDecl As XmlDeclaration
                                                                                    Dim theLabInfo As XmlElement
                                                                                    Dim theLabGroup As XmlElement
                                                                                    Dim theNode As XmlElement
                                                                                    Dim theLabReport01 As XmlElement
                                                                                    Dim theTableData As XmlElement = Nothing
                                                                                    Dim theTableDataRow As XmlElement = Nothing
                                                                        
                                                                                    '
                                                                                    ' Generate XML String which will be used as a DataSource for the 
                                                                                    ' LabReport01.PDF LiveCycle Form.
                                                                                    '
                                                                                    ' The output XML must match the Sample XML File "LabReportTestData.xml".
                                                                                    '
                                                                                    theLabRequest = LabRequest.GetLabRequest(theLabRequestID)
                                                                                    theStaffBasicInfo = StaffBasicInfo.GetStaffBasicInfo2(theLabRequest.PatientID)
                                                                                    theXML = New Xml.XmlDocument()
                                                                                    'initialize the report master data
                                                                                    theLabReport01 = theXML.CreateElement("LabReport01")
                                                                                    theLabInfo = theXML.CreateElement("LabInfo")
                                                                        
                                                                                    theNode = theXML.CreateElement("StaffID")
                                                                                    theNode.InnerText = theLabRequest.PatientID
                                                                                    theLabInfo.AppendChild(theNode)
                                                                        
                                                                                    theNode = theXML.CreateElement("Name")
                                                                                    theNode.InnerText = theLabRequest.PatientName
                                                                                    theLabInfo.AppendChild(theNode)
                                                                        
                                                                                    theNode = theXML.CreateElement("Dept")
                                                                                    theNode.InnerText = theStaffBasicInfo.StaffDept
                                                                                    theLabInfo.AppendChild(theNode)
                                                                        
                                                                                    theNode = theXML.CreateElement("Sex")
                                                                                    theNode.InnerText = theStaffBasicInfo.StaffSex
                                                                                    theLabInfo.AppendChild(theNode)
                                                                        
                                                                                    theNode = theXML.CreateElement("DoB")
                                                                                    theNode.InnerText = theStaffBasicInfo.DOB
                                                                                    theLabInfo.AppendChild(theNode)
                                                                        
                                                                                    theNode = theXML.CreateElement("Nationality")
                                                                                    theNode.InnerText = theStaffBasicInfo.Nationality
                                                                                    theLabInfo.AppendChild(theNode)
                                                                        
                                                                                    theNode = theXML.CreateElement("Doctor")
                                                                                    theNode.InnerText = theLabRequest.DoctorName
                                                                                    theLabInfo.AppendChild(theNode)
                                                                        
                                                                                    theNode = theXML.CreateElement("LabDate")
                                                                                    theNode.InnerText = theLabRequest.LabRequestDateDMYStr
                                                                                    theLabInfo.AppendChild(theNode)
                                                                        
                                                                                    theNode = theXML.CreateElement("LabNo")
                                                                                    theNode.InnerText = theLabRequest.LabRequestID
                                                                                    theLabInfo.AppendChild(theNode)
                                                                        
                                                                                    theNode = theXML.CreateElement("ReportDate")
                                                                                    theNode.InnerText = Now.ToString("dd/MM/yyyy hh:mm:ss tt").ToLower
                                                                                    theLabInfo.AppendChild(theNode)
                                                                        
                                                                                    theNode = theXML.CreateElement("Comment")
                                                                                    theNode.InnerText = theLabRequest.LabComments
                                                                                    theLabInfo.AppendChild(theNode)
                                                                        
                                                                                    theNode = theXML.CreateElement("Tech")
                                                                                    theNode.InnerText = theLabRequest.TechnicianName
                                                                                    theLabInfo.AppendChild(theNode)
                                                                        
                                                                                    theLabReport01.AppendChild(theLabInfo)
                                                                                    'populate the report with the item details
                                                                                    'create a sorted list of lab result items
                                                                                    If Not theLabRequest.RequestItems Is Nothing Then
                                                                                        theLabItems = New Csla.SortedBindingList(Of LabRequestItem)(theLabRequest.RequestItems)
                                                                                        theLabItems.ApplySort("LabReport01Sort", ComponentModel.ListSortDirection.Ascending)
                                                                                    End If
                                                                                    theLastCatg = "*"
                                                                                    theLabGroup = Nothing
                                                                                    For Each theLabItem In theLabItems
                                                                                        CurrCatg = theLabItem.LabTestCatg
                                                                        
                                                                                        If theLastCatg = "*" Or theLastCatg <> CurrCatg Then
                                                                                            'create Group if first time or there is a break
                                                                                            If Not theLabGroup Is Nothing Then
                                                                                                'if this is not the first time, append the last group
                                                                                                'to the Lab Report
                                                                                                theLabGroup.AppendChild(theTableData)
                                                                                                theLabReport01.AppendChild(theLabGroup)
                                                                                            End If
                                                                                            'initialize group header and Table Data
                                                                                            theLabGroup = theXML.CreateElement("LabGroup")
                                                                                            theNode = theXML.CreateElement("Lab")
                                                                                            theNode.InnerText = theLabItem.LabTestCatg
                                                                                            theLabGroup.AppendChild(theNode)
                                                                                            theTableData = theXML.CreateElement("TableData")
                                                                                        End If
                                                                        
                                                                                        'populate the table data with Lab Results.
                                                                                        theTableDataRow = theXML.CreateElement("TableDataRow")
                                                                                        theNode = theXML.CreateElement("TestCode")
                                                                                        theNode.InnerText = theLabItem.LabTestName
                                                                                        theTableDataRow.AppendChild(theNode)
                                                                        
                                                                                        theNode = theXML.CreateElement("Result")
                                                                                        theNode.InnerText = theLabItem.LabTestResult
                                                                                        theTableDataRow.AppendChild(theNode)
                                                                        
                                                                                        theNode = theXML.CreateElement("RefRange")
                                                                                        theNode.InnerText = theLabItem.RefRange
                                                                                        theTableDataRow.AppendChild(theNode)
                                                                        
                                                                                        theTableData.AppendChild(theTableDataRow)
                                                                        
                                                                                        theLastCatg = CurrCatg
                                                                                    Next
                                                                                    If Not theLabGroup Is Nothing Then
                                                                                        'this is the last group, append it to the Lab Report
                                                                                        theLabGroup.AppendChild(theTableData)
                                                                                        theLabReport01.AppendChild(theLabGroup)
                                                                                    End If
                                                                                    theXML.AppendChild(theLabReport01)
                                                                                    xmlDecl = theXML.CreateXmlDeclaration("1.0", "utf-8", Nothing)
                                                                                    'theXML.InsertBefore(xmlDecl, theLabReport01)
                                                                                    Me.XDPData = theXML.InnerXml
                                                                                End Sub
                                                                        
                                                                        
                                                                            End Class
                                                                        End Namespace

                                                                         

                                                                        Finally, to generate the LabReport, the following code is used :

                                                                         

                                                                         

                                                                         

                                                                                Protected Sub btnTestLabReport_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTestLabReport.Click
                                                                                    Dim theLabRequest As LabRequest
                                                                                    Dim theLabReport As LabReport01PDF
                                                                                    theLabRequest = GetLabRequest()
                                                                                    theLabReport = New LabReport01PDF(theLabRequest.LabRequestID)
                                                                                    Response.Clear()
                                                                                    theLabReport.Render(Response)
                                                                                    Response.End()
                                                                                End Sub
                                                                        

                                                                         

                                                                        I hope this will be of help to all of you.

                                                                         

                                                                        Tarek.

                                                                        • 113. Re: Using Adobe LiveCycle Designer with ASP.NET to populate PDF Forms from Server Database.
                                                                          Vidya_radkrish Community Member

                                                                          thanks this is really good...

                                                                           

                                                                           

                                                                           

                                                                           

                                                                           

                                                                           

                                                                           

                                                                           

                                                                           

                                                                          Date: Tue, 27 Apr 2010 08:46:12 -0600

                                                                          From: forums@adobe.com

                                                                          To: vidya_radkrish@hotmail.com

                                                                          Subject: Using Adobe LiveCycle Designer with ASP.NET to populate PDF Forms from Server Database.

                                                                           

                                                                           

                                                                           

                                                                          I have developed a Simple Class to defined and render a PDF Form. It will simplify your job to a great extent:

                                                                           

                                                                           

                                                                           

                                                                          Imports System.IO

                                                                          <Serializable()> _

                                                                          Public Class AdobeLiveCycleForm

                                                                           

                                                                          #Region "  Business Methods  "

                                                                              Private Shared mXDPHeader As String

                                                                              'Private mXDPData As String

                                                                              Private mXDPFooter

                                                                              Private mXDPData As Text.StringBuilder

                                                                              Private mDoWriteToFile As Boolean

                                                                              Private mFileName As String

                                                                              Private mOutputFile As StreamWriter

                                                                           

                                                                              Public ReadOnly Property XDPHeader() As String

                                                                                  Get

                                                                                      Return mXDPHeader

                                                                                  End Get

                                                                              End Property

                                                                           

                                                                              Public Property XDPData() As String

                                                                                  Get

                                                                                      Return mXDPData.ToString

                                                                                  End Get

                                                                                  Set(ByVal value As String)

                                                                                      mXDPData.Length = 0

                                                                                      mXDPData.Append(value)

                                                                                      If mDoWriteToFile Then

                                                                                          mOutputFile.Close()

                                                                                          IO.File.Delete(mFileName)

                                                                                          mOutputFile = New System.IO.StreamWriter(mFileName, False, Text.UTF8Encoding.UTF8)

                                                                                          mOutputFile.Write(mXDPHeader & mXDPData.ToString)

                                                                                      End If

                                                                                  End Set

                                                                              End Property

                                                                           

                                                                              Public ReadOnly Property XDPFooter() As String

                                                                                  Get

                                                                                      Return mXDPFooter

                                                                                  End Get

                                                                              End Property

                                                                           

                                                                              Public ReadOnly Property FileName() As String

                                                                                  Get

                                                                                      Return mFileName

                                                                                  End Get

                                                                              End Property

                                                                           

                                                                              Public ReadOnly Property GetXDP() As String

                                                                                  Get

                                                                                      Return mXDPHeader & mXDPData.ToString & mXDPFooter

                                                                                  End Get

                                                                              End Property

                                                                           

                                                                              Public Sub CloseXDP()

                                                                                  If mDoWriteToFile Then

                                                                                      mOutputFile.Write(mXDPFooter)

                                                                                      mOutputFile.Flush()

                                                                                      mOutputFile.Close()

                                                                                      mOutputFile.Dispose()

                                                                                      mOutputFile = Nothing

                                                                                  End If

                                                                              End Sub

                                                                           

                                                                              Public Sub CloseFile()

                                                                                  If mDoWriteToFile Then

                                                                                      Try

                                                                                          mOutputFile.Flush()

                                                                                          mOutputFile.Close()

                                                                                          mOutputFile.Dispose()

                                                                                          mOutputFile = Nothing

                                                                                      Catch ex As Exception

                                                                           

                                                                                      End Try

                                                                                  End If

                                                                              End Sub

                                                                           

                                                                              Private Sub InitStringBuilder()

                                                                                  If mXDPData Is Nothing Then

                                                                                      mXDPData = New Text.StringBuilder

                                                                                  End If

                                                                              End Sub

                                                                           

                                                                              Public Sub AppendXDPData(ByVal NewXDPData As String)

                                                                                  mXDPData.Append(NewXDPData)

                                                                                  If mDoWriteToFile Then

                                                                                      mOutputFile.Write(mXDPData.ToString)

                                                                                      mXDPData.Length = 0

                                                                                  End If

                                                                              End Sub

                                                                           

                                                                              Public Sub Render(ByVal WebResponse As System.Web.HttpResponse)

                                                                                  WebResponse.ContentType = "application/vnd.adobe.xdp+xml"

                                                                                  If mDoWriteToFile Then

                                                                                      WebResponse.WriteFile(mFileName)

                                                                                      'WebResponse.TransmitFile(mFileName)

                                                                                  Else

                                                                                      WebResponse.Write(GetXDP)

                                                                                  End If

                                                                                  'WebResponse.End()

                                                                              End Sub

                                                                           

                                                                          #End Region

                                                                           

                                                                          #Region " Constructors "

                                                                              Public Sub New(ByVal XDPFormLink As String)

                                                                                  Dim strXMLBuilder As Text.StringBuilder = New Text.StringBuilder

                                                                           

                                                                                  If String.IsNullOrEmpty(mXDPHeader) Then

                                                                                      '

                                                                                      ' Build the Constant XDP Header which is common for all forms

                                                                                      '

                                                                                      strXMLBuilder.Length = 0

                                                                                      strXMLBuilder.Append("<?xml version='1.0' encoding='UTF-8'?>")

                                                                                      strXMLBuilder.Append("<?xfa generator='AdobeDesigner_V7.0' APIVersion='2.2.4333.0'?>")

                                                                                      strXMLBuilder.Append("<xdp:xdp xmlns:xdp='http://ns.adobe.com/xdp/'>")

                                                                                      strXMLBuilder.Append("<xfa:datasets xmlns:xfa='http://www.xfa.org/schema/xfa-data/1.0/'>")

                                                                                      strXMLBuilder.Append("<xfa:data>")

                                                                                      mXDPHeader = strXMLBuilder.ToString

                                                                                  End If

                                                                           

                                                                                  InitStringBuilder()

                                                                           

                                                                                  '

                                                                                  ' Build the XDP Footer part

                                                                                  '

                                                                                  strXMLBuilder.Length = 0

                                                                                  strXMLBuilder.Append("</xfa:data>")

                                                                                  strXMLBuilder.Append("</xfa:datasets>")

                                                                                  '

                                                                                  ' Point the XPD to the PDF Form created under Adobe LiveCycle Desinger

                                                                                  '

                                                                                  strXMLBuilder.Append("<pdf href='" & XDPFormLink & "' xmlns='http://ns.adobe.com/xdp/pdf/' />")

                                                                                  '

                                                                                  ' Close the XPD File

                                                                                  '

                                                                                  strXMLBuilder.Append("</xdp:xdp>")

                                                                                  mDoWriteToFile = False

                                                                                  mXDPFooter = strXMLBuilder.ToString

                                                                              End Sub

                                                                           

                                                                              Public Sub New(ByVal XDPFormLink As String, ByVal OutputFilePath As String)

                                                                                  Me.New(XDPFormLink)

                                                                                  mFileName = OutputFilePath

                                                                                  mOutputFile = New System.IO.StreamWriter(mFileName, False, Text.UTF8Encoding.UTF8)

                                                                                  mDoWriteToFile = True

                                                                                  mOutputFile.Write(mXDPHeader)

                                                                              End Sub

                                                                           

                                                                              Private Sub New()

                                                                           

                                                                              End Sub

                                                                          #End Region

                                                                           

                                                                              Protected Overrides Sub Finalize()

                                                                                  MyBase.Finalize()

                                                                                  Try

                                                                                      If Not mOutputFile Is Nothing Then

                                                                                          mOutputFile.Flush()

                                                                                          mOutputFile.Close()

                                                                                          mOutputFile.Dispose()

                                                                                      End If

                                                                                  Catch ex As Exception

                                                                                  Finally

                                                                                      mOutputFile = Nothing

                                                                                  End Try

                                                                              End Sub

                                                                          End Class

                                                                           

                                                                           

                                                                          Also, I developed this "LabRequestReport" class, which uses the above class, also, it uses "XmlDocument" object to generate the XML, much more simplere than before:

                                                                           

                                                                          Imports System.Xml

                                                                          Namespace Clinic

                                                                           

                                                                              Public Class LabReport01PDF

                                                                                  Inherits AdobeLiveCycleForm

                                                                           

                                                                                  Public Sub New(ByVal theLabRequestID As String)

                                                                                      MyBase.New(Configuration.ConfigurationManager.AppSettings("LabReport01URLRoot").ToString)

                                                                                      Dim theLabRequest As LabRequest

                                                                                      Dim theLabItem As LabRequestItem

                                                                                      Dim theLabItems As Csla.SortedBindingList(Of LabRequestItem) = Nothing

                                                                                      Dim theStaffBasicInfo As StaffBasicInfo

                                                                                      Dim theLastCatg As String

                                                                                      Dim CurrCatg As String

                                                                                      Dim theXML As XmlDocument

                                                                                      Dim xmlDecl As XmlDeclaration

                                                                                      Dim theLabInfo As XmlElement

                                                                                      Dim theLabGroup As XmlElement

                                                                                      Dim theNode As XmlElement

                                                                                      Dim theLabReport01 As XmlElement

                                                                                      Dim theTableData As XmlElement = Nothing

                                                                                      Dim theTableDataRow As XmlElement = Nothing

                                                                           

                                                                                      '

                                                                                      ' Generate XML String which will be used as a DataSource for the

                                                                                      ' LabReport01.PDF LiveCycle Form.

                                                                                      '

                                                                                      ' The output XML must match the Sample XML File "LabReportTestData.xml".

                                                                                      '

                                                                                      theLabRequest = LabRequest.GetLabRequest(theLabRequestID)

                                                                                      theStaffBasicInfo = StaffBasicInfo.GetStaffBasicInfo2(theLabRequest.PatientID)

                                                                                      theXML = New Xml.XmlDocument()

                                                                                      'initialize the report master data

                                                                                      theLabReport01 = theXML.CreateElement("LabReport01")

                                                                                      theLabInfo = theXML.CreateElement("LabInfo")

                                                                           

                                                                                      theNode = theXML.CreateElement("StaffID")

                                                                                      theNode.InnerText = theLabRequest.PatientID

                                                                                      theLabInfo.AppendChild(theNode)

                                                                           

                                                                                      theNode = theXML.CreateElement("Name")

                                                                                      theNode.InnerText = theLabRequest.PatientName

                                                                                      theLabInfo.AppendChild(theNode)

                                                                           

                                                                                      theNode = theXML.CreateElement("Dept")

                                                                                      theNode.InnerText = theStaffBasicInfo.StaffDept

                                                                                      theLabInfo.AppendChild(theNode)

                                                                           

                                                                                      theNode = theXML.CreateElement("Sex")

                                                                                      theNode.InnerText = theStaffBasicInfo.StaffSex

                                                                                      theLabInfo.AppendChild(theNode)

                                                                           

                                                                                      theNode = theXML.CreateElement("DoB")

                                                                                      theNode.InnerText = theStaffBasicInfo.DOB

                                                                                      theLabInfo.AppendChild(theNode)

                                                                           

                                                                                      theNode = theXML.CreateElement("Nationality")

                                                                                      theNode.InnerText = theStaffBasicInfo.Nationality

                                                                                      theLabInfo.AppendChild(theNode)

                                                                           

                                                                                      theNode = theXML.CreateElement("Doctor")

                                                                                      theNode.InnerText = theLabRequest.DoctorName

                                                                                      theLabInfo.AppendChild(theNode)

                                                                           

                                                                                      theNode = theXML.CreateElement("LabDate")

                                                                                      theNode.InnerText = theLabRequest.LabRequestDateDMYStr

                                                                                      theLabInfo.AppendChild(theNode)

                                                                           

                                                                                      theNode = theXML.CreateElement("LabNo")

                                                                                      theNode.InnerText = theLabRequest.LabRequestID

                                                                                      theLabInfo.AppendChild(theNode)

                                                                           

                                                                                      theNode = theXML.CreateElement("ReportDate")

                                                                                      theNode.InnerText = Now.ToString("dd/MM/yyyy hh:mm:ss tt").ToLower

                                                                                      theLabInfo.AppendChild(theNode)

                                                                           

                                                                                      theNode = theXML.CreateElement("Comment")

                                                                                      theNode.InnerText = theLabRequest.LabComments

                                                                                      theLabInfo.AppendChild(theNode)

                                                                           

                                                                                      theNode = theXML.CreateElement("Tech")

                                                                                      theNode.InnerText = theLabRequest.TechnicianName

                                                                                      theLabInfo.AppendChild(theNode)

                                                                           

                                                                                      theLabReport01.AppendChild(theLabInfo)

                                                                                      'populate the report with the item details

                                                                                      'create a sorted list of lab result items

                                                                                      If Not theLabRequest.RequestItems Is Nothing Then

                                                                                          theLabItems = New Csla.SortedBindingList(Of LabRequestItem)(theLabRequest.RequestItems)

                                                                                          theLabItems.ApplySort("LabReport01Sort", ComponentModel.ListSortDirection.Ascending)

                                                                                      End If

                                                                                      theLastCatg = "*"

                                                                                      theLabGroup = Nothing

                                                                                      For Each theLabItem In theLabItems

                                                                                          CurrCatg = theLabItem.LabTestCatg

                                                                           

                                                                                          If theLastCatg = "*" Or theLastCatg <> CurrCatg Then

                                                                                              'create Group if first time or there is a break

                                                                                              If Not theLabGroup Is Nothing Then

                                                                                                  'if this is not the first time, append the last group

                                                                                                  'to the Lab Report

                                                                                                  theLabGroup.AppendChild(theTableData)

                                                                                                  theLabReport01.AppendChild(theLabGroup)

                                                                                              End If

                                                                                              'initialize group header and Table Data

                                                                                              theLabGroup = theXML.CreateElement("LabGroup")

                                                                                              theNode = theXML.CreateElement("Lab")

                                                                                              theNode.InnerText = theLabItem.LabTestCatg

                                                                                              theLabGroup.AppendChild(theNode)

                                                                                              theTableData = theXML.CreateElement("TableData")

                                                                                          End If

                                                                           

                                                                                          'populate the table data with Lab Results.

                                                                                          theTableDataRow = theXML.CreateElement("TableDataRow")

                                                                                          theNode = theXML.CreateElement("TestCode")

                                                                                          theNode.InnerText = theLabItem.LabTestName

                                                                                          theTableDataRow.AppendChild(theNode)

                                                                           

                                                                                          theNode = theXML.CreateElement("Result")

                                                                                          theNode.InnerText = theLabItem.LabTestResult

                                                                                          theTableDataRow.AppendChild(theNode)

                                                                           

                                                                                          theNode = theXML.CreateElement("RefRange")

                                                                                          theNode.InnerText = theLabItem.RefRange

                                                                                          theTableDataRow.AppendChild(theNode)

                                                                           

                                                                                          theTableData.AppendChild(theTableDataRow)

                                                                           

                                                                                          theLastCatg = CurrCatg

                                                                                      Next

                                                                                      If Not theLabGroup Is Nothing Then

                                                                                          'this is the last group, append it to the Lab Report

                                                                                          theLabGroup.AppendChild(theTableData)

                                                                                          theLabReport01.AppendChild(theLabGroup)

                                                                                      End If

                                                                                      theXML.AppendChild(theLabReport01)

                                                                                      xmlDecl = theXML.CreateXmlDeclaration("1.0", "utf-8", Nothing)

                                                                                      'theXML.InsertBefore(xmlDecl, theLabReport01)

                                                                                      Me.XDPData = theXML.InnerXml

                                                                                  End Sub

                                                                           

                                                                           

                                                                              End Class

                                                                          End Namespace

                                                                           

                                                                          I hope this will be of help to all of you.

                                                                          >

                                                                          • 114. Re: Using Adobe LiveCycle Designer with ASP.NET to populate PDF Forms from Server Database.
                                                                            mclarenriderA

                                                                            Hi Tarek,

                                                                             

                                                                               Thanks for this wonderful forum as it helped me achieving 1st part of prepopulating the values in pdf form from ASP.NET.

                                                                             

                                                                            Currently when I call pdf form from ASP .Net , it launches Acrobat reader and displays the PDF with pre-populated value. However when I try to submit the form again using following code :

                                                                             

                                                                            event.target.submitForm( {cURL: "http:/localhost:4147:/website3/default.aspx", aPackets:

                                                                            ["datasets","pdf"], cSubmitAs: "XDP"});

                                                                             

                                                                            Acrobat reader gives the error "Nothing done" and it's not going ahead.

                                                                             

                                                                            Do we need any server component for this ? We are only using Adobe Live Cycle designer ( Acrobat Pro ) but not using Reader externsion.

                                                                             

                                                                            Your reply would be greatly appreciated.

                                                                             

                                                                            Thanks & Regards,

                                                                            Anup.

                                                                            • 115. Re: Using Adobe LiveCycle Designer with ASP.NET to populate PDF Forms from Server Database.
                                                                              tarekahf Community Member

                                                                              Anup,

                                                                               

                                                                              I am glad you found it useful.

                                                                               

                                                                              There is error in the URL, just in case, it must read as follows:

                                                                               

                                                                              event.target.submitForm( );

                                                                               

                                                                              Also, if you are submitting to a local website running under Visual

                                                                              Studio webserver (F5), then this is not a good idea.

                                                                               

                                                                              Deploy the website to a local virtual directory under IIS (it works on

                                                                              XP) and try again.

                                                                               

                                                                              Also, try this, it may work:

                                                                               

                                                                              event.target.submitForm( );

                                                                               

                                                                              I mean use relative path which is relative to the current page.

                                                                               

                                                                              Finally, I think you should use a reader-enabled PDF to allow submit a

                                                                              PDF under Adobe Reader. You must have Acrobat Prof. Client or LiveCycle

                                                                              Reader Extension Server (LRES) to reader enable the PDF form. The LCRES

                                                                              will give you more options for "Reader Enable" a PDF, when compared with

                                                                              Acrobat.

                                                                               

                                                                              I hope this helps.

                                                                               

                                                                              Tarek.

                                                                              On Thu, 22 Jul 2010 10:12 -0600, "mclarenriderA" <forums@adobe.com

                                                                              • 116. Re: Using Adobe LiveCycle Designer with ASP.NET to populate PDF Forms from Server Database.
                                                                                tarekahf Community Member

                                                                                Sorry Anup, I just found out that there were errors in my last postings probably becuase I replied from my email directly. It should read as follows:

                                                                                 

                                                                                 

                                                                                I am glad you found it useful.

                                                                                 

                                                                                There is error in the URL, just in case, it must read as follows:

                                                                                 

                                                                                     event.target.submitForm( {cURL: "http:/localhost:4147/website3/default.aspx", aPackets:

                                                                                 

                                                                                Also, if you are submitting to a local website running under Visual Studio webserver (F5), then this is not a good idea.

                                                                                 

                                                                                It will be better Deploy the website to a local virtual directory under IIS (it works on XP) and try again.

                                                                                 

                                                                                Also, try this, it may work:

                                                                                 

                                                                                event.target.submitForm({cURL: "website3/default.aspx", aPackets: ["datasets","pdf"], cSubmitAs: "XDP"}); );

                                                                                 

                                                                                I mean use relative path which is relative to the current page.

                                                                                 

                                                                                Finally, I think you should use a reader-enabled PDF to allow submit a

                                                                                PDF under Adobe Reader. You must have Acrobat Prof. Client or LiveCycle

                                                                                Reader Extension Server (LRES) to reader enable the PDF form. The LCRES

                                                                                will give you more options for "Reader Enable" a PDF, when compared with

                                                                                Acrobat.

                                                                                 

                                                                                I hope this helps.

                                                                                 

                                                                                Tarek.

                                                                                ["datasets","pdf"], cSubmitAs: "XDP"});

                                                                                • 117. Re: Using Adobe LiveCycle Designer with ASP.NET to populate PDF Forms from Server Database.
                                                                                  JimboWx Community Member

                                                                                  Hi Tarek,

                                                                                   

                                                                                  We have an ASP.NET 3.5 application that is serving PDFs and works perfectly in IE 6 but has some bad behavior in IE 7.

                                                                                   

                                                                                  We are using Forms Authentication, cookies, session variables, and Master pages. Our application is running in IIS on Server 2003. The application is used in our intranet only so we control all the workstations. All are XP SP2. Some have IE 6, some have IE 7.  Reader is version 9.3.3 on all PCs.

                                                                                   

                                                                                  Our PDFs were created using LiveCycle Designer 8.2 and we are using LiveCycle Reader Extension Server to enable the docs. All our docs have signatures using Topaz signature pads and a button that saves the document to a network server then submits data back to the ASP.NET app using JavaScript: submitForm. Enabled PDFs are stored in subdirectory of the application on the web server.

                                                                                   

                                                                                  The user can select documents and navigate through the set of documents, signing and saving. Each document is loaded in an iframe on our navigation page. The iframe src is set to an aspx page that creates XDP containing data to fill in the PDF and uses

                                                                                  Response.Clear()

                                                                                  Response.ContentType = "application/vnd.adobe.xdp+xml"

                                                                                  Response.Write(string containing valid XDP)

                                                                                     Response.End()

                                                                                   

                                                                                  As I said, IE 6 is fine, but in IE 7: some time after the first document but not on any particular document, a PDF will “bust out” of the iFrame and take over the application window, losing the ability to navigate through the remaining documents.

                                                                                   

                                                                                  Here are some ideas we had about what might be causing it but did not find any resolution

                                                                                  • some setting in IE 7 or Reader or IIS
                                                                                  • file associations
                                                                                  • having acrobat and reader and/or multiple version of reader on a PC: we tried on a PC that only had Reader 9.3.3, same bad behavior
                                                                                  • PDF files are in the same domain so the “cross-domain” security issue should not be a factor

                                                                                  These are some settings were tried:

                                                                                  -          Internet Options -> Security -> Custom Level -> Check the Enable(not secure) radio button for "Launching programs and files in an IFRAME"

                                                                                  -          Internet Options -> Security -> Custom Level -> Check the Enable(not secure) radio button for "Navigate sub-frames across different domains"

                                                                                  -          Internet Options -> Advanced -> Check the option "Empty Temporary Internet Files folder when browser is closed"

                                                                                  -          Tools -> Manage Add-ons -> Disabled and Enabled the Adobe PDF Link Helper.

                                                                                  -          In Adobe - Edit -> Preferences -> Internet -> Unchecked "Allow Fast Web View"

                                                                                  -          In Adobe - Edit -> Preferences -> Internet -> Unchecked "Allow speculative downloading in the background"

                                                                                   

                                                                                  Any ideas would be greatly appreciated!

                                                                                   

                                                                                  Thanks…

                                                                                  • 118. Re: Using Adobe LiveCycle Designer with ASP.NET to populate PDF Forms from Server Database.
                                                                                    tarekahf Community Member

                                                                                    Hi JimboWx,

                                                                                     

                                                                                    Actually, it is not easy to predict the cause of the prolem you are

                                                                                    facing, but I will try to help. I never tried using IFRAME for rendering

                                                                                    PDF (XDP) using response.write(), beucase I know this is not a

                                                                                    recommended way, besides, I understand that IFRAME is also not a

                                                                                    recommended approach in general. I used IFRAME, OBJECT or EMBED tags (if

                                                                                    I remember correctly) to render a PDF using a direct link to the PDF,

                                                                                    and they all worked successfully.

                                                                                     

                                                                                    Try any combination of the following:

                                                                                     

                                                                                    1. In the ASPX Page which is rendering the XDP, make sure it does not

                                                                                    have any HTML Markup in the BODY section. Comment out all markups. Then,

                                                                                    remove the command "response.clear()" from the code-behined. Make sure

                                                                                    nothing is rendered before the command "response.ContentType=...",

                                                                                     

                                                                                    2. Try using a direct link to a PDF not to ASPX Page. If this works,

                                                                                    then the problem is most likely from "response.clear()".

                                                                                     

                                                                                    3. Check the complete documentation of IFRAME and try to find a way to

                                                                                    tweak its behaviour.

                                                                                     

                                                                                    4. Try using OBJECT or EMBED tags instead of IFRAME. Try using a Direct

                                                                                    Link to PDF and also a link to the same ASPX page.

                                                                                     

                                                                                    5. Try with FireFox and IE8. This could be a nasty IE7 bug.

                                                                                     

                                                                                    I hope my suggestions will be of help to you.

                                                                                     

                                                                                    Tarek.

                                                                                    • 119. Re: Using Adobe LiveCycle Designer with ASP.NET to populate PDF Forms from Server Database.
                                                                                      JimboWx Community Member

                                                                                      Hi Tarek,

                                                                                      Thank you for your quick response. 

                                                                                       

                                                                                      We tried your suggestions:

                                                                                      1. In the ASPX Page which is rendering the XDP, make sure it does not have any HTML Markup in the BODY section. Comment out all markups. Then, remove the command "response.clear()" from the code-behind. Make sure nothing is rendered before the command "response.ContentType=...",

                                                                                                  ~ No change in behavior

                                                                                                 

                                                                                      2. Try using a direct link to a PDF not to ASPX Page. If this works, then the problem is most likely from "response.clear()".

                                                                                         ~Direct to PDF: Fixes bad behavior SEE ADDITIONAL COMMENTS BELOW

                                                                                       

                                                                                      3. Check the complete documentation of IFRAME and try to find a way to tweak its behaviour.

                                                                                            ~ Tried various things to no avail.

                                                                                       

                                                                                      4. Try using OBJECT or EMBED tags instead of IFRAME. Try using a Direct Link to PDF and also a link to the same ASPX page.

                                                                                            ~ Tried EMBED tag, caused an ERROR in html source:

                                                                                                        Validation (XHTML 1.0 Transitional): Element ‘embed’ is not supported.

                                                                                         ~ Tried OBJECT tag.

                                                                                        1. Aspx – always takes over parent window in both IE6 and IE7
                                                                                        2. Direct to PDF – PDF loads in object, page that submitForm submits to takes over parent window.

                                                                                       

                                                                                      5. Try with FireFox and IE8. This could be a nasty IE7 bug.

                                                                                            ~ Not an option at this time:

                                                                                      a.       Firefox:  we only use IE

                                                                                      b.       IE8: One of our third party apps isn’t compatible

                                                                                       

                                                                                      Here are my new questions:

                                                                                       

                                                                                      1. Can we push data into PDF without XDP and server up the PDF instead of the XDP? I know it can be done with LC Form Server, but that is not in our budget.

                                                                                       

                                                                                      2. In your response you said:

                                                                                      “I never tried using IFRAME for rendering PDF (XDP) using response.write(), beucase I know this is not a recommended way, besides, I understand that IFRAME is also not a recommended approach in general.”

                                                                                      Other than IFRAME, OBJECT, and EMBED, is there another way to embed a PDF in a page? We don’t want to pop a window or replace our navigation window as the user will have multiple PDFs to sign and save.

                                                                                       

                                                                                      3. How can we be 100% sure that there is no additional markup in our page?

                                                                                      Here is the html side of the page. This was the barest .Net would let us make the html without causing an error.

                                                                                       

                                                                                      <%@ Page Language="vb" AutoEventWireup="false" CodeBehind="OurPage.aspx.vb" Inherits="OurDocApp.OurPage" %>

                                                                                       

                                                                                      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

                                                                                       

                                                                                      <html>

                                                                                      <head runat="server">

                                                                                          <title></title>

                                                                                      </head>

                                                                                      <body>

                                                                                      </body>

                                                                                      </html>

                                                                                       

                                                                                      Thanks again for your help.

                                                                                      1 2 3 4 5 Previous Next