NK-Inc.com
PDF, Programming & Design Tutorials

PDF, Programming & Design Tutorials

PDF, Programming & Design Tutorials for Applications

Tags: | Posted by NicK on 7/11/2011 4:20 PM | Comments (0)

WEBPAGE ANALYSIS TOOLS

Reducing webmaster guideline violations may increase the visibility for the intended target audience. A few recommendations to improve user experience include using appropriate server-side cache, reducing image bandwidth through compression, consolidating JavaScript, consolidating external cascading style sheets, using responsive HTML5 and CSS3 layouts, using Base-64 encoding for smaller images, compressing client side scripts and reducing browser request pipelines. Reducing bandwidth and decreasing the response time for every request will help improve the visitor's experience.

W3SCHOOLS.COM: XHTML/XML/CSS Validators

To appear consistent across all viewing devices, the HTML, XHTML, CSS, and Javascript syntax needs to be accurate and valid.

Google: Webmaster Guidelines

Read all of Google's webmaster guidelines front to back, and see where you can improve your visitor experience by avoiding webmaster guideline violations.

Google Webmaster Tools

Google webmaster tools allows site owners to submit a sitemap XML file, informing crawlers what to spider.

Google Analytics

Research any trend or view historic measurements for just about every known visitor statistical trend

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
 
Categories: PDF Programming Posted by NicK on 7/27/2008 12:40 PM | Comments (0)

Principles to Loading an Adobe Acrobat PDF Form with XML Data with FDF Toolkit .net with ASP.net

Rules: Make sure when posting FDF Data to a buffer, write "Response.Clear()" before you post any FDF Data to remove any HTML in your ASPX pages, and then write your "Response.ContentType=" line.

Imports FDFApp
Imports FDFApp.FDFApp_Class
Imports FDFApp.FDFDoc_Class

Public Class loadform
        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
        Import_XML()
    Catch Ex as Exception
        Response.Write("Error: " & Ex.Message)
        Response.End
    End Try
End Sub

Public Sub Import_XML()        
     ' INITIALIZE THE COMPONENTS
     Dim FDFApp As New FDFApp.FDFApp_Class
     Dim FDFDoc As New FDFApp.FDFDoc_Class        
     ' IMPORT XML DATA
     FDFDoc = FDFApp.FDFOpenFromURL(URLPath & "report.xml", True, True)        
     ' SET THE MIME TYPE TO FDF
Response.Clear()
     Response.ContentType = FDFApp.MimeFDF        
     ' SET THE URL TO THE PDF FILE         
     FDFDoc.FDFSetFile(URLPath & "PDFs/sample_report.pdf")        
     ' WRITE CONTENTS TO BUFFER
     Response.BinaryWrite(FDFDoc.FDFSavetoBuf(FDFDoc.FDFType.FDF, False))
End Sub 
End Class 
Tags: | Categories: PDF Programming Posted by NicK on 7/27/2008 12:38 PM | Comments (0)

Basic principles of populating or updating a database with Adobe Acrobat PDF Form data using VB.net, ASP.net, and the FDF Toolkit .net component.

Scenerio: User fills out a PDF form online, and clicks submit. The form is sent to a server side script, see code, and the script parses the field information and stores it into a database.

Rules: Make sure when posting PDF Data to a buffer, do not post any HTML along with PDF Data. Remove any header information by declaring "Response.Clear()" before posting any PDF or PDF data MIME Content.

 

Imports FDFApp
Imports FDFApp.FDFApp_Class
Imports FDFApp.FDFDoc_Class
Public Class loadform
        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.ToString
    Try
        Update_Data(Request.QueryString("id") & "")
    Catch Ex as Exception
        Response.Write("Error: " & Ex.Message)
        Response.End
    End Try
End Sub
Public Function Update_Data(ByVal form_id As Integer) As Boolean
Try
    Dim FDFApp As New FDFApp.FDFApp_Class
    Dim FDFDoc As New FDFApp.FDFDoc_Class
    'FDFDoc = FDFApp.FDFOpenFromBuf(Request.BinaryRead(Request.TotalBytes), True, True)
    FDFDoc = FDFApp.FDFOpenFromStream(Request.InputStream, True, True)
    'Response.ContentType = FDFApp.MimeFDF
    Dim dr As DataRow, ds As New DataSet
    Dim da As New OleDbDataAdapter, sSQL(2) As String
    sSQL(0) = "SELECT * FROM TableName WHERE "
    sSQL(1) = "ID = " & form_id & ";"
    sSQL(2) = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source = " & Server.MapPath("Data/Database_Name.mdb") & ";"
    da = New OleDbDataAdapter(sSQL(0) & sSQL(1), sSQL(2))
    Dim cmd As New OleDbCommandBuilder(da)
    da.Fill(ds, "TableName")
    Try
        If ds.Tables("TableName").Rows.Count = 1 Then
            dr = ds.Tables("TableName").Rows(0)
            dr = FDFDoc.FDFSetDataRowFromValues(dr)
            da.Update(ds, "TableName")
            Response.ContentType = FDFApp.MimeFDF
            FDFDoc.FDFSetStatus("Success! Updated Database", True)
            Response.BinaryWrite(FDFDoc.FDFSavetoBuf(FDFApp.FDFType.FDF, False))
            Return True
        Else
            FDFDoc.FDFSetStatus("ERROR: This form did not update a record!", True)
            Response.ContentType = FDFApp.MimeFDF
            Response.BinaryWrite(FDFDoc.FDFSavetoBuf(FDFApp.FDFType.FDF, True))
            Return False
            Exit Function
        End If
    Catch ex As Exception
        FDFDoc.FDFSetStatus("ERROR: This form did not update a record!", True)
        Response.ContentType = FDFApp.MimeFDF
        Response.BinaryWrite(FDFDoc.FDFSavetoBuf(FDFApp.FDFType.FDF, True))
        Return False
        Exit Function
    End Try
Catch ex As Exception
    FDFDoc.FDFSetStatus("ERROR: This form did not update a record!", True)
        Response.Clear()
        Response.ContentType = FDFApp.MimeFDF
    Response.BinaryWrite(FDFDoc.FDFSavetoBuf(FDFApp.FDFType.FDF, True))
    Return False
    Exit Function
End Try