I have successfully filled in and merged multiple documents. I now want to be able to do away with the textfields and replace them with labels using the createLabel method. Can't seem to get it right. Here is the existing code:
Dim MyDocument2 As New MergeDocument
For x = 0 To ds2.Tables(0).Rows.Count - 1
Dim Mydocument As PdfDocument = New PdfDocument(MapPath("docs/DefaultReporttemplate.pdf"))
MyDocument2.Append(Mydocument, New MergeOptions(True, "f_" & x.ToString))
With MyDocument2.Form
Dim dc As DataColumn = New DataColumn
For Each dc In ds2.Tables(0).Columns
If Not .Fields("f_" & x.ToString & "." & dc.ColumnName.ToString) Is Nothing Then
.Fields("f_" & x.ToString & "." & dc.ColumnName.ToString).Value = ds2.Tables(0).Rows(x).Item(dc.ColumnName.ToString).ToString
End If
Next
End With
MyDocument2.Form.NeedsAppearances = True
MyDocument2.Security = New HighSecurity()
MyDocument2.Security.AllowEdit = False
MyDocument2.Form.IsReadOnly = True
Next
MyDocument2.DrawToWeb("document.pdf")
I know I have to create a page but can't seem to get it to work.
Thanks
Merge and createlabel
Re: Merge and createlabel
Support · Sep 20, 2006Hello,
You have to use CreateLabel method to replace the form fields with text labels, but you are not using that method any where in the above code. You can refer to the form flattening topic in the Help Documentation
on our web site that shows sample code on how to use the CreateLabel method.
Thanks,
ceTe Software Support Team
Re: Merge and createlabel
Forum member · Sep 20, 2006I looked at your code, and tried to get it to work, and could not.
I got it to work by adding another merge document and getting rid of the mergeoptions