Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!

Debenu Quick PDF Library - PDF SDK Community Forum Homepage
Forum Home Forum Home > For Users of the Library > I need help - I can help
  New Posts New Posts RSS Feed - New User, VB6 with QuickPDF
  FAQ FAQ  Forum Search   Register Register  Login Login

New User, VB6 with QuickPDF

 Post Reply Post Reply
Author
Message
SnoopyUK View Drop Down
Beginner
Beginner
Avatar

Joined: 04 Apr 11
Location: UK
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote SnoopyUK Quote  Post ReplyReply Direct Link To This Post Topic: New User, VB6 with QuickPDF
    Posted: 04 Apr 11 at 1:30PM
Hi, I have installed the trial version and am currently trying to get this to work for me. I have a test PDF with 2 pages each with 3 fields on. When I step through my code it finds and populates all the fields but when I view the saved PDF the Qty field is blank and still editable.

Can anyone point out any obvious mistakes?

This is the relevant code:


qp.LoadFromFile ("C:\Users\Andy\Desktop\testfields.pdf")
FFCount = qp.FormFieldCount

       If FFCount > 0 Then

       For i = 1 To FFCount

            fftitle = qp.GetFormFieldTitle(i)
                
        If Right(fftitle, 10) = "Project[0]" Then
            qp.SetNeedAppearances (i)
            qp.SetFormFieldValue i, "New Project"
            qp.UpdateAppearanceStream (i)
        End If
        
        If Right(fftitle, 6) = "Qty[0]" Then
            qp.SetNeedAppearances (i)
            qp.SetFormFieldValue i, "632"
            qp.UpdateAppearanceStream (i)
        End If

        If Right(fftitle, 7) = "Date[0]" Then
            qp.SetNeedAppearances (i)
            qp.SetFormFieldValue i, "04/04/11"
            qp.UpdateAppearanceStream (i)
        End If
        
        Next i
    
            For i = 1 To FFCount
                qp.FlattenFormField (i)
            Next i
End If

qp.SaveToFile "C:\Users\Andy\Desktop\testfields2.pdf"

Any help would be greatly appreciated.

Thank you
Back to Top
AndrewC View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 08 Dec 10
Location: Geelong, Aust
Status: Offline
Points: 841
Post Options Post Options   Thanks (0) Thanks(0)   Quote AndrewC Quote  Post ReplyReply Direct Link To This Post Posted: 04 Apr 11 at 2:14PM

When you flatten a form field it reduces the total Form Field count by 1 so the last loop in your code needs to be reversed in order to work properly to allow for the shrinking form field list.  

For i = FFCount to 1 step -1      '  I haven't programmed Basic in years....
                qp.FlattenFormField (i)
            Next i

Andrew.
Back to Top
jpbro View Drop Down
Senior Member
Senior Member


Joined: 29 Mar 11
Status: Offline
Points: 77
Post Options Post Options   Thanks (0) Thanks(0)   Quote jpbro Quote  Post ReplyReply Direct Link To This Post Posted: 04 Apr 11 at 2:14PM
Can you post a link to the test PDF?
Back to Top
Rowan View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 10 Jan 09
Status: Offline
Points: 398
Post Options Post Options   Thanks (0) Thanks(0)   Quote Rowan Quote  Post ReplyReply Direct Link To This Post Posted: 04 Apr 11 at 2:20PM
Two possibly issues, one minor, one big:

1. If you're calling SetNeedAppearances then you don't need to call UpdateAppearanceStream.
2. SetNeedAppearances takes 0 (false) or 1 (true), you can't update it with the index.
Back to Top
SnoopyUK View Drop Down
Beginner
Beginner
Avatar

Joined: 04 Apr 11
Location: UK
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote SnoopyUK Quote  Post ReplyReply Direct Link To This Post Posted: 04 Apr 11 at 2:34PM

Thanks for all the quick replies. Didn't really know what the appearances were for, just included them after looking at various snippets of code Smile
But...   AndrewC, excellent thank you. works fine now. Very helpful.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.01
Copyright ©2001-2014 Web Wiz Ltd.

Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. AboutContactBlogSupportOnline Store