Link to home
Start Free TrialLog in
Avatar of Crystal Rouse
Crystal RouseFlag for United States of America

asked on

Tool suggestion to import/export PDF Files

In need suggestions on a tool or a way to import PDF Files into our database thru the UI.  I need to be able to show this data in a View and report on it, export to PDF or Excel.
The problem we have is the creator of the PDF Form does not have the form fields named in any consistent way for me to map them to our database fields.  

Any suggestions welcome!
Avatar of Chinmay Patel
Chinmay Patel
Flag of India image

Hi Crystal,

If form fields in PDF are random then only way out is to create a mapping, for example, the form field names for First Name are:
firstname
fname
first name
fn
and assuming your database field name is firstname

then you could have a mapping table as shown below:
Source Field Target Field
firstname firstname
fname firstname
first name firstname
fname firstname

After that using itextsharp you can read pdf fields

var pdfReader = new PdfReader("yourpdffilename");

// loop through your sourcefieldnames
//Pseudo code 
foreach(var sourcefieldname in pdfReader.AcroFields.Fields
if(pdfReader.AcroFields.Fields.contains(sourcefieldname))
{
targetFieldName =pdfReader.AcroFields.Fields.GetField(sourcefieldname) 
}

Open in new window


I wrote this code without IDE so you might want to tweak datatypes and some string conversation, but I hope you are getting the idea.

You can make it as dynamics as you want and then finally present the mapping to the user to verify it.

Regards,
Chinmay.
Avatar of Crystal Rouse

ASKER

Thank you for your comment.  We now use iTextSharp.  My problem is for this particular form, we can't control the field names and they will change when their is a new version.

Not only do I need to create a PDF once the data is in the database, I also need to know if there is a tool to import PDF's?
You mean a tool that can read PDF Form fields? and then import them in the database?
Yes, exactly!  I have looked at SyncFusion for an easy way to create PDF's.  But have not found a good way to import the PDF and read the form fields.
ASKER CERTIFIED SOLUTION
Avatar of Chinmay Patel
Chinmay Patel
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks!  I appreciate the response.  I don't think there is such a tool either.
Wew.. I totally forgot about this question... Thank you :)