NK-Inc.com
PDF Programming Tutorials

PDF Programming Tutorials

Programming Dynamic PDF forms using FDFToolkit.net

Tags: , , , , | Categories: SEO - SEARCH ENGINE OPTIMIZATION Posted by NicK on 7/11/2011 4:20 PM | Comments (0)

SEO OPTIMIZATION AND ANALYSIS TOOLS

Google Page Speed: http://pagespeed.googlelabs.com/

When using google page speed, there are important factors which may help your site's rank. Included with the results, are the notifications for SERVER-SIDE CACHE (Private/Public/No-Cache), and Image Size (<20kb each), Consolidate and MINIFY Javascript & CSS, Compression (GZip/Deflate), and Browser round trips. All of these recommendations will reduce the load on the search engines when they crawl your site, and also reduce the bandwith and increase the speed for every page/image/script/stylesheet request. Google has announced page speed affects the natural search rank results.

Webpage Speed Test

Similar to google's webpage speed test, this speed test will display warning, errors, and ways to improve performance. This could be used in conjunction with Google webpage speed tester.

Ranks Webmaster Tools: Keyword Density Analyzer: http://www.ranks.nl/tools/spider.html

When using the keyword density analyzer, there are important factors which may help your site's rank. Keywords listed in GREEN should be displayed in your META Keywords within your HEAD tag. Keywords should only be less than or equal to 8 key phrases separated by commas. The results may also be displayed in orange, yellow, and red, which means they are over-used within your page. Try to stay within the limits by reducing or using variations of the same keyword, Ex: fencing 5%, fences 5%, fence 5%.

Keyword density analyzer is also great to see competitors keyword densities. This will help you guage how many keywords are needed to rank higher.

W3SCHOOLS.COM: XHTML/XML/CSS Validators

Just as important as spelling and grammer, the HTML, XHTML, CSS, and Javascript need to be accurate and validate. Using standardized code will help visitors using variations of browsers and operating systems appear consistant. Standardized code also improve search engine visibility within natural searches with Google, Bing, and Yahoo.

Google: Webmaster Guidelines

Read all of Google's webmaster guidelines front to back, and see where you can improve your site's rankings by avoiding or removing penalties.

Google Webmaster Tools

Similar to Bing, Google webmaster tools can help you save time by submitting a sitemap XML for a new or existing site. There are many features in Google webmaster tools which will help you create and maintain a website.

Categories: PDF Programming Posted by NicK on 9/17/2010 4:32 AM | Comments (0)
Private Sub ImageFieldManipulations()
		' INSERTS IMAGE IN IMAGE FIELD ON LIVECYCLE FORMS
		Dim cFDFApp As New FDFApp.FDFApp_Class()
		Dim cFDFDoc As New FDFApp.FDFDoc_Class()
		cFDFDoc = cFDFApp.FDFCreate
		' ADD XDP FORM
		cFDFDoc.XDPAddForm("subform1", Server.MapPath("test_livecycle-image1.pdf"))
		' ADD DUMMY FIELD
		cFDFDoc.XDPAddField("FullName", "Test Image Field", "subform1", Global.FDFApp.FDFDoc_Class.FieldType.FldTextual)
		' ADD IMAGE FIELD
		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(Global.FDFApp.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
Tags: , , | Categories: PDF Programming Posted by NicK on 4/27/2010 3:47 PM | Comments (0)
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

Tags: , | Categories: PDF Programming Posted by NicK on 4/26/2010 3:36 AM | Comments (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
Tags: | Categories: PDF Programming Posted by NicK on 1/28/2010 8:54 AM | Comments (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
Categories: PDF Programming Posted by NicK on 10/21/2009 9:30 AM | Comments (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()
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
Categories: PDF Programming Posted by NicK on 3/27/2009 4:43 PM | Comments (0)

LiveCycle Setup Part I

Here are the setting in order to parse LiveCycle Form data (XDP) with FDF Toolkit .net.

  1. Select "Button"
  2. Select "Submit"
  3. Click "Button" Tab
  4. Provide URL to script
  5. Select XDP Data Package
  6. Uncheck Annotations
  7. Uncheck PDF
  8. Select UTF-8
LiveCycle Setup

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.

  1. Select Acrobat 6,7,8 "Static"
LiveCycle Setup: SaveAs - Static Only
 
Tags: , | Categories: Web Presence Posted by NicK on 8/17/2008 3:57 AM | Comments (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

Tags: , | Categories: Web Presence Posted by NicK on 7/28/2008 3:07 AM | Comments (0)
Search Engine Web Master Tools
Other Web Master Tools

 

The most useful tools would be Google Analytics and Google Webmaster Tools. Google web master tools allow you to submit XML sitemaps, and can easily help determine submission problems. Google Analytics can help you refine your keywords to attract more visitors.

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 Search Engine penalizations and lowered SERP 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. It's best to use a variety of the same keywords, but try to keep your META keyword phrases limit to eight key phrases or less for maximum weight.