Skip navigation

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

Mar 26, 2007 9:38 PM

  Latest reply: anand.padmanabhan, Feb 23, 2013 12:40 PM
Replies 1 2 3 4 5 ... 7 Previous Next
  • Currently Being Moderated
    Aug 7, 2009 8:17 AM   in reply to tarekahf

    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

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 15, 2009 8:38 AM   in reply to ksADOBE2009

    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

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 16, 2009 3:40 AM   in reply to tarekahf

    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: Re: Using Adobe LiveCycle Designer with ASP.NET to populate PDF Forms from Server Database. 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.

    >

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 23, 2009 3:16 PM   in reply to tarekahf

    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.

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 23, 2009 10:31 PM   in reply to gurlnpink

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

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 27, 2009 6:25 PM   in reply to Vidya_radkrish

    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.

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 29, 2009 9:19 PM   in reply to tarekahf

    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.

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 4, 2009 11:52 PM   in reply to tarekahf

    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

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 5, 2009 1:23 AM   in reply to tarekahf

    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.

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 6, 2010 6:22 AM   in reply to tarekahf

    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.

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 6, 2010 8:05 AM   in reply to gurlnpink

    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()   

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 6, 2010 1:01 PM   in reply to gurlnpink

     

     

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 6, 2010 2:32 PM   in reply to Tarek AHF

    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!

     

     

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 10, 2010 2:46 PM   in reply to tarekahf

    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!

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 18, 2010 4:33 PM   in reply to tarekahf

    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

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 28, 2010 5:19 AM   in reply to tarekahf

    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

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 29, 2010 10:20 PM   in reply to tarekahf

    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

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 29, 2010 10:44 PM   in reply to tarekahf

    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

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 30, 2010 10:17 PM   in reply to tarekahf

    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.");
      }
    }
    }

     

     

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 28, 2010 8:27 PM   in reply to tarekahf

    thanks this is really good...

     

     

     

     

     

     

     

     

     

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

    From: forums@adobe.com

    To: vidya_radkrish@hotmail.com

    Subject: Re: Using Adobe LiveCycle Designer with ASP.NET to populate PDF Forms from Server Database. 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("LabReport0 1URLRoot").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.

    >

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 22, 2010 9:12 AM   in reply to Vidya_radkrish

    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.

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 10, 2010 11:10 AM   in reply to tarekahf

    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…

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 12, 2010 8:35 AM   in reply to tarekahf

    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.

     
    |
    Mark as:
1 2 3 4 5 ... 7 Previous Next
Actions

More Like This

  • Retrieving data ...

Bookmarked By (0)