FORUMS PROFESSIONNELS
WINDEV
,
WEBDEV
et
WINDEV Mobile
Accueil
|
Messages récents
|
Connexion
|
Déconnexion
|
Français
Accueil
→
WINDEV 2024
→
How to use iTextSharp control
How to use iTextSharp control
Débuté par Gianni Spano, 23 nov. 2015 10:38 - 4 réponses
Connectez-vous…
Gianni Spano
#1
Posté le 23 novembre 2015 - 10:38
Hello to all
Follow my previous post on how to retrieve form fields values from a pdf file, after few attempts and researches on the web, i found a little example written in vb that is using an iTextSharp.dll library.
I have been able to load the "iTextSharp.dll" library as a .Net assembly into Windev and it shows me all the properties and methods, but i have some troubles on its use.
This is the original Vb portion of code that i would convert in Windev.
Imports iTextSharp.text.pdf Public Function GetFormData(ByVal sourcePdf as string) as Dictionary(Of String, String) Dim frmData As New Dictionary(Of String, String) Try 'Open the pdf using pdfreader Dim reader As New PdfReader(sourcePdf) 'Get the form from pdf Dim frm as AcroFields = reader.AcroFields 'get the fields from the form Dim fields As System.Collections.Hashtable = frm.Fields 'Extract the data from the fields Dim data As String = String.Empty For Each key As String In fields.Keys data = frm.GetField(key) frmData.Add(key, data) Next reader.Close () Catch ex As Exception Debug.Write(ex.Message) End Try Return frmData End Function
Thanks in advance.
Gianni
Signaler
0
0
Gianni Spano
#2
Posté le 26 novembre 2015 - 16:13
Hello to all
After few days of researches and testing, i have been able to read form fields data from a fillable Pdf file.
Here is a portion of code on how to use the "iTextSharp.dll" .net library to retrieve all the fields name and their value from a pdf.
myPDF is PdfReader(EDT_File_PDF) myAcrofields is AcroFields dynamic myAcrofields = myPDF.get_AcroFields() FOR EACH MONFieldElement OF myAcrofields.Fields Trace(MONFieldElement.Key,myAcrofields.GetFieldType(MONFieldElement.Key),myAcrofields.GetField(MONFieldElement.Key)) END
With these few lines of code now i can read each pdf attached in an e-mail sent by a web user and register their personal informations.
Hope this little solution will help other developers.
Regards
Gianni
Signaler
0
0
DarrenF
#3
Posté le 26 novembre 2015 - 17:45
Gianni,
That's great - maybe this would benefit from being added to the "solutions" area of the forum? :cheers:
Signaler
0
0
Gianni Spano
#4
Posté le 26 novembre 2015 - 22:29
Hello Darren
Thank you. Yes, it could be a good idea to post the solution on the specific area of the forum.
The idea come from a problem we had in our local health authority.
In Italy the people with problems with their driver license revoked, can book a new medical visit to see if they are able to drive a car after an infrigement of the law during the driving of a car.
In our web site we put a fillable pdf file that a user can download on his pc and then fill out all the informations required for the medical visit.
Then he will send the pdf to a specific e-mail address and where it will arrive on the office, each e-mail is verified and the pdf attached is examined to retrieve all the informations that will be saved in our database to book the medical visit.
I had, initially, some troubles on how to read the form fields from the pdf.
This is the little solution i have tested, hoping to help other developers with the same problems.
Gianni
Signaler
0
0
DarrenF
#5
Posté le 26 novembre 2015 - 23:21
Hi,
I'm not saying give your hard work away, just outline the technique, but it's good that you outlined your requirements - sounds like a great customer focused solution. Your customer is very lucky.
Signaler
0
0
→ Revenir à WINDEV 2024
WINDEV 2024
WEBDEV 2024
WINDEV Mobile 2024
WINDEV (précédentes versions)
Français
English
Español
Portuguesa
Fermer cette fenêtre
Type de recherche
Uniquement les sujets
Tous les messages
Période de recherche
Date indifférente
Moins d'une heure
Moins de 24 heures
Moins d'une semaine
Moins d'un mois
Moins d'un an
Annuler
Aperçu de votre message
Ajouter une image
Importer une image depuis une URL
Envoyer une image depuis un fichier de votre disque
Déposez ici un fichier ou cliquez sur "Parcourir..."
ou
Annuler
0%
WLangage
SQL
XML, HTML
JAVA, Javascript
Texte