This code example demonstrates how to populate a LiveCycle PDF (XFA) form with XDP data.
Imports FDFApp
Imports FDFApp.FDFApp_Class
Imports FDFApp.FDFDoc_Class
Partial Public Class populate_pdf_xdp_data
Inherits System.Web.UI.Page
Private PDFPath As String = Server.MapPath("/MyData/myPDFFile.pdf")
Private XDPPath As String = Server.MapPath("/MyData/myXDPFile.xdp")
Private cFDFDoc As New FDFApp.FDFDoc_Class
Private cFDFApp As New FDFApp.FDFApp_Class
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Try
' OPEN XDP FROM BUFFER
'cFDFDoc = cFDFApp.FDFOpenFromStream(Request.InputStream, True, True)
' CREATE A BLANK CLASS
'cFDFDoc = cFDFApp.FDFCreate
' OPEN FROM FILE
cFDFDoc = cFDFApp.FDFOpenFromFile(XDPPath, True, True)
' POPULATE A PDF WITH XDP DATA
Populate_PDF_XDP_Data()
Catch Ex As Exception
Response.Write("Error: " & Ex.Message)
Response.End()
End Try
End Sub
Public Sub Populate_PDF_XDP_Data()
Try
cFDFDoc.PDFData = cFDFDoc.PDFMergeXDP2Buf(PDFPath, False, "")
' CLEAR
Response.Clear()
' MIME
Response.ContentType = cFDFApp.MimePDF
' BUFFER
Response.BinaryWrite(cFDFDoc.PDFData)
Catch ex As Exception
Throw ex
End Try
' CALL OUTSIDE OF TRY{}
' END STREAM ENSURES NO HTML DATA IS WRITTEN
Response.End()
End Sub
End Class
04c1f3f9-452a-44fe-a9e6-aeec91f628cb|0|.0
This method demonstrates how to save a MS Access database record from a PDF form submission using FDF Toolkit .net and VB.net.
Imports FDFApp
Imports FDFApp.FDFApp_Class
Imports FDFApp.FDFDoc_Class
Partial Public Class save_pdf_form_submission_to_database
Inherits System.Web.UI.Page
Private URLPath As String = ""
Private cFDFDoc As New FDFApp.FDFDoc_Class
Private cFDFApp As New FDFApp.FDFApp_Class
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
cFDFDoc = cFDFApp.FDFOpenFromStream(Request.InputStream, True, True)
Try
Save_New_Record_AUTOMATIC()
Catch Ex As Exception
Response.Write("Error: " & Ex.Message)
Response.End()
End Try
End Sub
Public Sub Save_New_Record_AUTOMATIC()
' SET TABLE NAME
Dim strTableName As String = "TABLENAME"
Dim myDA As New OleDb.OleDbDataAdapter("SELECT * FROM [" & strTableName & "];", "PROVIDER=MICROSOFT.JET.OLEDB.4.0; DATA SOURCE=" & Server.MapPath("/APP_DATA/myDATABASE.mdb") & ";")
' CREATE COMMAND BUILDER
Dim cmd As New OleDb.OleDbCommandBuilder(myDA)
Dim myDS As New DataSet
' FILL DATASET
myDA.Fill(myDS, strTableName)
' NEW RECORD
Dim myDR As DataRow = myDS.Tables(0).NewRow
Try
' SETS DATAROW VALUES FROM FDF - EXLUDING Autoincremental [ID] Field
myDR = cFDFDoc.FDFSetDataRowFromValues(myDR, "ID")
' ADD NEW RECORD TO DATASET
myDS.Tables(strTableName).Rows.Add(myDR)
' UPDATE DATASET
myDA.Update(myDS, strTableName)
Catch ex As Exception
Throw ex
End Try
Return
End Sub
Public Sub Save_New_Record_MANUAL()
' SET TABLE NAME
Dim strTableName As String = "TABLENAME"
Dim myDA As New OleDb.OleDbDataAdapter("SELECT * FROM [" & strTableName & "];", "PROVIDER=MICROSOFT.JET.OLEDB.4.0; DATA SOURCE=" & Server.MapPath("/APP_DATA/myDATABASE.mdb") & ";")
' CREATE COMMAND BUILDER
Dim cmd As New OleDb.OleDbCommandBuilder(myDA)
Dim myDS As New DataSet
' FILL DATASET
myDA.Fill(myDS, strTableName)
' NEW RECORD
Dim myDR As DataRow = myDS.Tables(0).NewRow
Try
' SETS DATAROW VALUES FROM FDF - EXLUDING Autoincremental [ID] Field
myDR("FIELD_A") = cFDFDoc.FDFGetValue("FIELD_A", False)
myDR("FIELD_B") = cFDFDoc.FDFGetValue("FIELD_A", False) & " " & cFDFDoc.FDFGetValue("FIELD_C", False)
myDR("FIELD_D") = cFDFDoc.FDFGetValue("FIELD_D", False)
' ADD NEW RECORD TO DATASET
myDS.Tables(strTableName).Rows.Add(myDR)
' UPDATE DATASET
myDA.Update(myDS, strTableName)
Catch ex As Exception
Throw ex
End Try
Return
End Sub
End Class
25f11a32-daf5-4009-ad45-abbd0ac7ad39|0|.0
This method demonstrates how to populate an image field in a LiveCycle form using FDF Toolkit .net and VB.net.
Private Sub ImageFieldManipulations()
' INSERTS IMAGE IN IMAGE FIELD ON LIVECYCLE FORMS
Dim cFDFApp As New FDFApp_Class()
Dim cFDFDoc As New FDFDoc_Class()
cFDFDoc = cFDFApp.FDFCreate
cFDFDoc.XDPAddForm("subform1", Server.MapPath("test_livecycle-image1.pdf"))
cFDFDoc.XDPAddField("FullName", "Bo Duke", "subform1", FDFDoc_Class.FieldType.FldTextual)
cFDFDoc.XDP_Add_ImageField("Image1", "subform1", Server.MapPath("Signature_01_Small.jpg"), True)
Response.Clear()
' WRITE XDP DATA TO BUFFER
Response.ContentType = cFDFApp.MimeXDP
Response.BinaryWrite(cFDFDoc.FDFSavetoBuf(FDFDoc_Class.FDFType.XDP, True))
' WRITE MERGED XDP/PDF TO BUFFER
'Response.ContentType = cFDFApp.MimePDF
'Response.BinaryWrite(cFDFDoc.PDFMergeXDP2Buf(Server.MapPath("test_livecycle-image1.pdf"), False, ""))
' WRITE MERGED XDP/PDF TO FILE
'cFDFDoc.PDFMergeXDP2File(Server.MapPath("test_livecycle-image-MERGED.pdf"), Server.MapPath("test_livecycle-image1.pdf"), False, "")
Response.End()
End Sub
a8a85e2a-1d92-4aef-afdf-c26d1d71d05d|0|.0
Dim cFDFApp As New FDFApp.FDFApp_Class
Dim cFDFDoc As New FDFApp.FDFDoc_Class
cFDFDoc = cFDFApp.FDFCreate
'cFDFDoc.XDPAddForm("subform1", Request.Url.AbsoluteUri.Substring(0, Request.Url.AbsoluteUri.LastIndexOf("/") + 1) & "test_livecycle.pdf")
' !IMPORTANT ADD FORM (IF SINGLE PAGE THEN JUST ENTER "subform1"),PATH TO BLANK PDF
cFDFDoc.XDPAddForm("subform1", Server.MapPath("test_livecycle.pdf"))
' ADD FIELDS
'cFDFDoc.XDPSetValue(FieldName, FieldValue)
cFDFDoc.XDPSetValue("FullName", "Nick")
cFDFDoc.XDPSetValue("Email", "no-reply@nk-inc.com")
cFDFDoc.XDPSetValue("StreetAddress", "111 Easy Street")
cFDFDoc.XDPSetValue("City", "Clinton Township")
cFDFDoc.XDPSetValue("State", "MI")
cFDFDoc.XDPSetValue("Country", "United States")
cFDFDoc.XDPSetValue("PhoneNumber", "(586)-555-1111")
cFDFDoc.XDPSetValue("FaxNumber", "(586)-555-1212")
cFDFDoc.XDPSetValue("ZipCode", "48000")
' CLEAR RESPONSE (HTML CODE)
Response.Clear()
' SET MIME BEFORE SENDING TO BUFFER
Response.ContentType = cFDFApp.MimePDF
'sends pdf to buffer (Flattens = False)
'Response.BinaryWrite(cFDFDoc.PDFMergeXDP2Buf(Server.MapPath("test_livecycle.pdf"), False, ""))
'merges to fil
'cFDFDoc.PDFMergeXDP2File(Server.MapPath("test_livecycle_new.pdf"), Server.MapPath("test_livecycle.pdf"), False, "")
'sends pdf to buffer (Flattens = True)
'Response.BinaryWrite(cFDFDoc.PDFMergeXDP2Buf(Server.MapPath("test_livecycle.pdf"), True, ""))
'sends xdp to buffer
'Response.BinaryWrite(cFDFDoc.FDFSavetoBuf(FDFDoc_Class.FDFType.XDP, True))
Response.End()
f4cc0092-a70f-4233-9773-f3947f7771d4|0|.0
Dim cFDFApp As New FDFApp.FDFApp_Class
Dim cFDFDoc As New FDFApp.FDFDoc_Class
cFDFDoc = cFDFApp.FDFCreate
'cFDFDoc.XDPAddForm("subform1", Request.Url.AbsoluteUri.Substring(0, Request.Url.AbsoluteUri.LastIndexOf("/") + 1) & "test_livecycle.pdf")
' !IMPORTANT ADD FORM (IF SINGLE PAGE THEN JUST ENTER "subform1"),PATH TO BLANK PDF
cFDFDoc.XDPAddForm("subform1", Server.MapPath("test_livecycle.pdf"))
' ADD FIELDS
'cFDFDoc.XDPSetValue(FieldName, FieldValue)
cFDFDoc.XDPSetValue("FullName", "Nick")
cFDFDoc.XDPSetValue("Email", "no-reply@nk-inc.com")
cFDFDoc.XDPSetValue("StreetAddress", "111 Easy Street")
cFDFDoc.XDPSetValue("City", "Clinton Township")
cFDFDoc.XDPSetValue("State", "MI")
cFDFDoc.XDPSetValue("Country", "United States")
cFDFDoc.XDPSetValue("PhoneNumber", "(586)-555-1111")
cFDFDoc.XDPSetValue("FaxNumber", "(586)-555-1212")
cFDFDoc.XDPSetValue("ZipCode", "48000")
' CLEAR RESPONSE (HTML CODE)
Response.Clear()
' SET MIME BEFORE SENDING TO BUFFER
Response.ContentType = cFDFApp.MimePDF
'sends pdf to buffer (Flattens = False)
Response.BinaryWrite(cFDFDoc.PDFMergeFDF2Buf(Server.MapPath("test_livecycle.pdf"), False, ""))
'merges to fil
'cFDFDoc.PDFMergeXDP2File(Server.MapPath("test_livecycle_new.pdf"), Server.MapPath("test_livecycle.pdf"), False, "")
'sends pdf to buffer (Flattens = Tru)
'Response.BinaryWrite(cFDFDoc.PDFMergeFDF2Buf(Server.MapPath("test_livecycle.pdf"), True, ""))
'sends xdp to buffer
'Response.BinaryWrite(cFDFDoc.FDFSavetoBuf(FDFDoc_Class.FDFType.XDP, True))
Response.End()
56e74ba3-81d9-49d6-af54-1be3d82d9162|0|.0
Posted by
NicK on
8/27/2009 12:35 PM |
Comments (0)
Imports FDFApp
Imports FDFApp.FDFApp_Class
Imports FDFApp.FDFDoc_Class
Partial Public Class testForm1
Inherits System.Web.UI.Page
Private URLPath As String = ""
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
URLPath = Request.Url.AbsoluteUri.ToString & ""
URLPath = URLPath.Substring(0, URLPath.LastIndexOf("/") + 1) & ""
Try
Load_Data(URLPath & "PDFFormName.pdf", Request("id") + 0, FDFApp.FDFDoc_Class.FDFType.PDF)
Catch Ex As Exception
Response.Write("Error: " & Ex.Message)
Response.End()
End Try
End Sub
Public Sub Load_Data(ByVal PDFFile As String, ByVal ID As Integer, ByVal OutPutMIMEType As FDFApp.FDFDoc_Class.FDFType)
' DECLARE THE COMPONENTS
Dim FDFApp As New FDFApp.FDFApp_Class
Dim FDFDoc As New FDFApp.FDFDoc_Class
' INITIALIZE THE COMPONENTS
FDFDoc = FDFApp.FDFCreate
FDFDoc.FDFSetFile(PDFFile)
Dim myDA As New OleDb.OleDbDataAdapter("SELECT * FROM [TABLENAME] WHERE ID=" & ID & ";", "PROVIDER=MICROSOFT.JET.OLEDB.4.0; DATA SOURCE=" & Server.MapPath("/APP_DATA/myDATABASE.mdb") & ";")
Dim myDS As New DataSet
myDA.Fill(myDS, "TABLENAME")
' SETS VALUES FROM TABLE ROW TO FDF
FDFDoc.FDFSetValuesFromDataRow(myDS.Tables(0).Rows(0))
' WRITE THE FDF TO THE BUFFER
Response.Clear()
Select Case OutPutMIMEType
Case Global.FDFApp.FDFDoc_Class.FDFType.FDF
Response.ContentType = FDFApp.MimeFDF
Response.BinaryWrite(FDFDoc.FDFSavetoBuf(Global.FDFApp.FDFDoc_Class.FDFType.FDF, False))
Case Global.FDFApp.FDFDoc_Class.FDFType.PDF
Response.ContentType = FDFApp.MimePDF
Response.BinaryWrite(FDFDoc.PDFMergeFDF2Buf(PDFFile, False, ""))
Case Global.FDFApp.FDFDoc_Class.FDFType.XDP
Response.ContentType = FDFApp.MimeXDP
Response.BinaryWrite(FDFDoc.FDFSavetoBuf(Global.FDFApp.FDFDoc_Class.FDFType.XDP, True))
End Select
Response.End()
End Sub
End Class
4933b876-7ae6-49eb-83a6-7d989283e190|0|.0
LiveCycle Setup Part I
Here are the setting in order to parse LiveCycle Form data (XDP) with FDF Toolkit .net.
- Select "Button"
- Select "Submit"
- Click "Button" Tab
- Provide URL to script
- Select XDP Data Package
- Uncheck Annotations
- Uncheck PDF
- Select UTF-8
|
|
LiveCycle Setup Part II
Here are the setting to use when saving LiveCycle Forms to in order to merge XDP data with LiveCycle forms using FDF Toolkit .net.
- Select Acrobat 6,7,8 "Static"
|
|
| |
4673c293-e62d-47f6-80d6-dc3361ce1b7d|0|.0
We recently ran into a situation where a client was unable to use the FDFToolkit.net 2.0 component on a remote server. It worked fine on the testing server.
The error was:
System.Security.SecurityException: That assembly does not allow partially trusted callers
I looked up the error, and found out how to allow the server to trust our component.
SOLUTION:
Since we have the source to our component, as well as the iTextSharp component all we had to do is make some minor changes and recompile.
We opened our sources, and inserted the following line into the AssemblyInfo.vb files for both FDFToolkit.net and iTextSharp:
< Assembly: System.Security.AllowPartiallyTrustedCallers() >
And we made sure the component has the full version information hardcoded in the assemblies.
< Assembly: AssemblyVersion("2.0.0.0") >
Recompiled both components, and the error message dissapeared.
Here's a link to iTextSharp & Partially Trusted web hosts solution:
http://www.jwc3.net/2008/07/itextsharp-will-not-run-in-partially.html
038f7658-5d7b-42b4-af41-29f2d24952cb|0|.0
I recently had a project, using ASP.net 2.0, and manually submitted the site to Yahoo!, MSN, Google. The whole domain placed well on Google, and MSN, but, it seemed we were lacking placement on Yahoo!'s search engine results.
We purchased a paid subscription to Yahoo! Submit express, $50 per domain per year, to diagnose the problem, but we were still lacking hits. I ran a search at Yahoo! for the whole site, it came up with the correct titles, but, the descriptions were not our META descriptions, they were just random text from the content of the pages. I looked at our META information from the HTML page, and the server side META tags were creating an extra parameter, "ID", since it was set to runat="server". I was doing this so I can control the TITLE, DESCRIPTION, and KEYWORDS from within the modules.
Anyway, I fixed the problem, by creating each META tag on the page itself, instead of loading it from the code behind.
The site is now ranking very well on Google, MSN, as well as Yahoo!
Useful links:
64d680e7-8488-495f-9134-ebb0398a48b0|0|.0
Search Engine Web master tools
Other Web Master Tools
The most useful tools would be the Meta Anayzer, in conjunction with Google Tools. The Meta Analyzer can ultimately inform you if the web site content and meta information are not relevent. Google's web master tools can easily help determine help submission to Google.
Yahoo's paid submission is good, but I recommend only submitting the home page. Yahoo's paid submission crawls your url every two days, and it costs $50 per url / per year. Yahoo's tools allow you to see your web page's META information as Yahoo sees it. This is useful if your site isn't being crawled correctly. You can submit a maximum of only 5 urls per domain using Yahoo's paid submission.
Live's free submission tool, and Google's submission tool allow you to submit a site map, but Live's site map submission only allows you to submit a sitemap XML url in your home directory of your domain.
Beware, over use of keywords can lead to penalized rankings. Use keywords in normal sentences, and do not bloat your TITLE tag with multiple instances of one keyword. Use only one keyword instance in the TITLE. Overuse of keywords, whether in the body or META data, can cause search engines to lower your rankings. Also, make sure all your keywords are listed in the description, and body content of your web page.
9b9e2d46-7359-4aa0-adce-98cf7ffcbcf9|0|.0