We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Populating pdf form fields and saving this pdf page appended to a larger pdf document

Thread ID:

Created:

Updated:

Platform:

Replies:

112368 Sep 19,2013 12:12 AM UTC Sep 23,2013 03:45 AM UTC ASP.NET Web Forms (Classic) 1
loading
Tags: PDF
Peter Murphy
Asked On September 19, 2013 12:12 AM UTC

I have a pdf form with 4 fields to be populated with data. This file is saved into a memory stream and appended to a larger pdf document. It is deployed into IIS7 environment using .NET 4.0. This works in my development environment. The problem is that the form field data disappears when I deploy it to the server. 

My code that works in development environments is at follows:

            If IO.File.Exists(templateFile) Then
                Dim appendDocStream As IO.Stream = New IO.MemoryStream
                Dim appendDoc As PdfLoadedDocument = New PdfLoadedDocument(templateFile)
                Try
                    ' Load the form from the loaded document.
                    Dim form As PdfLoadedForm = appendDoc.Form
                    ' Load the form field collections from the form.
                    Dim field As New PdfLoadedFormFieldCollection(form)
                    Dim thisField As PdfLoadedField = Nothing
                    Dim fieldValue As String = String.Empty
                    ' TryGetField Method.
                    If field.TryGetField("Date", thisField) Then
                        TryCast(thisField, PdfLoadedTextBoxField).Text = "20 Sep 2013"
                    End If
                    If field.TryGetField("Client", thisField) Then
                        TryCast(thisField, PdfLoadedTextBoxField).Text = "Test Name"
                    End If
                    If field.TryGetField("Project", thisField) Then
                        TryCast(thisField, PdfLoadedTextBoxField).Text = "Test AddressText"
                    End If
                    If field.TryGetField("DrawingNo", thisField) Then
                        TryCast(thisField, PdfLoadedTextBoxField).Text = "TestDrawing 001"
                    End If
                    'form.Flatten = True ' ' NOTE this line deletes the populated field data
                    appendDoc.Save(appendDocStream)
                    appendDoc.Dispose()
                    appendDoc = New PdfLoadedDocument(appendDocStream)
                Catch ex As Exception
                    ErrorHandler.LogMsg(templateFile & " is not a pdf form")
                End Try
                pdfDoc.Append(appendDoc)
                appendDoc.Dispose()
            End If

Does anyone have any ideas on how to improve the above to solve problem on server?

KarthikeyanC [Syncfusion]
Replied On September 23, 2013 03:45 AM UTC

HI Peter,

Thank you for using Syncfusion Products.

 

Could you please create a Direct Trac incident for this issue, reporting with the subject “Forum: 112368-Populating pdf form fields and saving this pdf page appended to a larger pdf document”. Please let us know if you have any queries.

 

Thanks,

Karthikeyan.C


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;