Print Page | Close Window

Fill out a form with vba

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: Sample Code
Forum Description: Share Debenu Quick PDF Library sample code with other forum members
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=3675
Printed Date: 22 Nov 24 at 1:59PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Fill out a form with vba
Posted By: eternity
Subject: Fill out a form with vba
Date Posted: 11 Feb 19 at 8:20AM
hello I'm trying to create a code with the DebenuPDFLibrary64Lite1114 in vba to fill out a form and save it.
is it possible with this library?

i have made this code
Private Sub Comando0_Click()
Dim pdf As Object
Dim strmodello As String
Dim file As String

Set pdf = CreateObject("DebenuPDFLibrary64Lite1114.PDFLibrary")

Call pdf.LoadFromFile("C:\pippo\Modello.pdf", "")

pdf.SetNeedAppearances (0)


Call pdf.DeleteFormField(codicefiscale)

Call pdf.SetFormFieldValue(codicefiscale, "dng")


Call pdf.SaveToFile("C:\pippo\stampa.pdf")

Set pdf = Nothing
End Sub
where codicefiscale is the name of the field of the form
then i have the "error 438 propriety or method are not supported form object"




Replies:
Posted By: Ingo
Date Posted: 11 Feb 19 at 9:13AM
Hi eternity,

yes... with QuickPDF it's possible to fill out, read and/or save formfields.
To your system environment:
The old vba is 32 bit i think and you're working with the 64-bit-dll ... i don't think this will work ;-)
The other thing: QuickPDF uses unicode strings - so you have to convert the content from the old vba to unicode before using string functions from the library.
Details: DeleteFormField needs the index of a form field - not the name of a form field.
The other thing: A real deletion of a form field and setting a value as next action doesn't make sense ;-)
You should have a look here in the samples-section regarding form fields.
Here's a sample about how to create form fields:
https://www.debenu.com/kb/create-pdf-form-fields-programmatically/

Cheers and welcome here,
Ingo




-------------
Cheers,
Ingo



Posted By: eternity
Date Posted: 11 Feb 19 at 10:10AM
thanks for the reply,

I'm using access 2013 64 bit what can i do for work QickPDF?
i'm using an existing form.
i have to create form fields? 


Posted By: Ingo
Date Posted: 11 Feb 19 at 8:23PM
if you're using an existing form then i think you want to read the inserted content?
This you can do with QuickPDF.
You can create a new pdf form with QuickPDF, too.
You can create a pdf form...
You can insert and save values into existing pdf form fields...
You can read existing content from pdf form fields...
All this you can do with QuickPDF.
Here are the relevant functionalities:
https://www.debenu.com/docs/pdf_library_reference/FormFields.php



-------------
Cheers,
Ingo



Posted By: Ingo
Date Posted: 11 Feb 19 at 8:39PM
Here there are few first sample steps for your first steps:

How to get a value from a pdf form field:

  try
    QP := TDebenuPDFLibrary1211.Create;
    try
//     QP.UnlockKey('I have inserted my license key here');
       QP.LoadFromFile(FileName, '');
       If QP.EncryptionStatus > 0 Then
          QP.Decrypt;

       ffc := QP.FormFieldCount;
       if ffc > 0 then
          begin
             nresult := QP.FindFormFieldByTitle(FieldName);
             xresult := QP.GetFormFieldValueByTitle(FieldName);
// . . .


How to set values into a pdf form field:

  try
    QP := TDebenuPDFLibrary1211.Create;
    try
//     QP.UnlockKey('I have inserted my license key here');
       QP.LoadFromFile(FileName, '');
       If QP.EncryptionStatus > 0 Then
          QP.Decrypt;

       ffc := QP.FormFieldCount;
       if ffc > 0 then
          begin
            QP.SetNeedAppearances(1);
            QP.SetFormFieldValue( StrToInt(Trim(FieldName)), FieldValue );
            QP.UpdateAppearanceStream( StrToInt(Trim(FieldName)) );
//          QP.FlattenFormField( StrToInt(Trim(FieldName)) );
// . . .


Additionally here you'll find the developer guide.
Inside there's a section 4.10 regarding pdf forms:
http://www.debenu.com/docs/pdf_library_developer_guide/foxit_quick_pdf_library_15_developer_guide.pdf





-------------
Cheers,
Ingo



Posted By: eternity
Date Posted: 12 Feb 19 at 11:50AM
but i'm using lite version and i don't have license key


Posted By: Ingo
Date Posted: 12 Feb 19 at 4:55PM
so there's only less you can do.
Check out which functionalities i've described are in the lite-version and then play a little bit...

Or you do it the other way and download the normal library and asking for an evaluation key limited for 30 days from here:
https://www.debenu.com/products/development/debenu-pdf-library/trial/




-------------
Cheers,
Ingo




Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk