[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

How to read PDF file to the database with ASP.net

Posted on 2004-11-08
9
Medium Priority
?
354 Views
Last Modified: 2012-08-14
I have to implement the following solution:

Website user will upload pdf file . i need to read certain fields from file and input them to database.

I use MS SQL, and Asp.net .
Have no idea where to start...

Any help would help.

Thanks...
0
Comment
Question by:maximyshka
  • 4
  • 2
7 Comments
 
LVL 10

Expert Comment

by:lengreen
ID: 12525582
Hi

Upload PDF........
no problems

read certain fields from file and input them to database......

You can't do it, but if you have Adobe Acrobat creator, you can export the pdf file as text OR images, where you can import to your DB.

cheers

Len
0
 
LVL 17

Expert Comment

by:AerosSaga
ID: 12525614
<form runat="server" enctype="multipart/form-data" ID="Form2">
  <P>
    <input type="file" id="file1" runat="server" NAME="file1">
  </P>
  <P>
    <asp:Button id="btn1" runat="server" text="Upload" onclick="upload" />
  </P>
</form>

--------------------------------------------------------------------------------------

Imports System.Data
Imports System.Data.SqlClient

Public Sub Upload(ByVal sender As Object, ByVal e As System.EventArgs)
        Dim b(file1.PostedFile.InputStream.Length - 1) As Byte

        file1.PostedFile.InputStream.Read(b, 0, file1.PostedFile.InputStream.Length)

        Dim con As New SqlConnection(ConfigurationSettings.AppSettings("ConnectionStringSQL"))

        Dim sql As String = "INSERT INTO MY_TABLE(MyID, DATABLOB) VALUES(1,@BlobData) "
        Dim cmd As New SqlCommand(sql, con)

        Dim parmBlob As New SqlParameter("@BlobData", SqlDbType.VarBinary, _
                     b.Length, ParameterDirection.Input, False, 0, _
                     0, Nothing, DataRowVersion.Current, b)
                     
        cmd.Parameters.Add(parmBlob)

        con.Open()
        cmd.ExecuteNonQuery()
        con.Close()
End Sub

Aeros
0
 
LVL 17

Expert Comment

by:AerosSaga
ID: 12525623
no way to do the second part of your question as earlier stated.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:maximyshka
ID: 12525783
thanx..
Is it possible to convert pdf file into xml. and theninsert data from xml file?
0
 
LVL 17

Accepted Solution

by:
AerosSaga earned 2000 total points
ID: 12525833
It is possible, but it will be a lot of hard work to do it.  I haven't found any magic tool to do this for me yet.

https://www.techsource.ala.org/article.pl?sid=04/07/23/224216&mode=flat

This article talks about the process a bit.
0
 

Author Comment

by:maximyshka
ID: 12526434
But, were you able to accomplish it?
0
 
LVL 17

Expert Comment

by:AerosSaga
ID: 12526461
I never attemted it.  Once I saw I was going to hand code such a solution I abandoned that idea.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question