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 - RadioButtons
  FAQ FAQ  Forum Search   Register Register  Login Login

RadioButtons

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

Joined: 05 Sep 07
Location: Ukraine
Status: Offline
Points: 7
Post Options Post Options   Thanks (0) Thanks(0)   Quote ice_bora Quote  Post ReplyReply Direct Link To This Post Topic: RadioButtons
    Posted: 10 Sep 07 at 6:25AM
I've moved it to this more suitable section ;-)    Ingo

Hi all.

I have sample code.
  1.Create output.pdf file with 2 - checkbox and 3 - radiobutton.
  2. Read output.pdf file, select checkboxes and try select radiobutton
      and save new file. But in new outputres.pdf file checkboxes are    
      checked but radiobuttons empty.

I can't select radiobutton !!!! 

1) Create pdf file.

.....
spPDF->UnlockKey("---")
......

spPDF->NewDocument();
spPDF->SetMeasurementUnits(1);
spPDF->SetOrigin(1);
spPDF->SetPageSize(_T("A4"));


long NormalFont = spPDF->AddStandardFont(4);
long BoldFont = spPDF->AddStandardFont(5);
long FieldIndex  = 0;
long SubIndex    = 0;


spPDF->SelectFont(BoldFont);
spPDF->SetTextSize(10);
spPDF->DrawTextBox(20,20,100, 5, "Which of these fruit do you like?", 0);

spPDF->SelectFont(NormalFont);
spPDF->SetTextSize(10);
spPDF->DrawTextBox(27, 30, 55, 5, "Orange", 0);

FieldIndex = spPDF->NewFormField("LikeOrange", 3);
spPDF->SetNeedAppearances(0);
spPDF->SetFormFieldBounds(FieldIndex, 20, 30, 60, 5);
spPDF->SetFormFieldCheckStyle(FieldIndex, 3, 0);

spPDF->DrawTextBox(27, 40, 55, 5, "Peach", 0);
FieldIndex = spPDF->NewFormField("LikePeach", 3);
spPDF->SetFormFieldBounds(FieldIndex, 20, 40, 60, 5);
spPDF->SetFormFieldCheckStyle(FieldIndex, 3, 0);



spPDF->SelectFont(BoldFont);
spPDF->SetTextSize(10);
spPDF->DrawTextBox(20, 60, 100, 5, "Which is your favourite fruit?", 0);

FieldIndex = spPDF->NewFormField("FruitChoice", 4);

SubIndex = spPDF->AddFormFieldSub(FieldIndex, "Banana");
spPDF->DrawTextBox(27, 70, 55, 5,"Banana", 0);
spPDF->SetFormFieldBounds(SubIndex, 20, 70, 60, 5);
spPDF->SetFormFieldCheckStyle(SubIndex, 4, 0);

SubIndex = spPDF->AddFormFieldSub(FieldIndex, "Apple");
spPDF->DrawTextBox(27, 80, 55, 5,"Appleeee", 0);
spPDF->SetFormFieldBounds(SubIndex, 20, 80, 60, 5);
spPDF->SetFormFieldCheckStyle(SubIndex, 4, 0);

SubIndex = spPDF->AddFormFieldSub(FieldIndex, "Grapes");
spPDF->DrawTextBox(27, 90, 55, 5,"Grapes", 0);
spPDF->SetFormFieldBounds(SubIndex, 20, 90, 60, 5);
spPDF->SetFormFieldCheckStyle(SubIndex, 4, 0);

hr= spPDF->SaveToFile("C:\\output.pdf");//save the file to disk



2).  Read file and  mark  checkbox as checked (work)
     and try select radiobutton.

........

spPDF->LoadFromFile("C:\\output.pdf");//load a local file

long s = spPDF->FormFieldCount();
for (int index=1; index<=s; index++)
{
    long type = spPDF->GetFormFieldType(index);

    if (type == 3) // checkbox
    {
        _bstr_t val = spPDF->GetFormFieldValue(index);
        spPDF->SetFormFieldValue(index, "Yes");
    }

    if (type == 4) // radiobutton
    {
        long chd = spPDF->GetFormFieldSubCount(index);
        long chd2 = spPDF->GetFormFieldKidCount(index);

        for (int i=1; i<=chd2; i++)
        {
            _bstr_t sub_name = spPDF->GetFormFieldSubName(index,i);
            long subindex = spPDF->GetFormFieldSubTempIndex(index,i);
            long chd3 = spPDF->GetFormFieldKidCount(subindex);
            long sub_type = spPDF->GetFormFieldType(subindex);
            spPDF->SetFormFieldValue(subindex, "Yes");
        }

    }
}
spPDF->SaveToFile("C:\\output_result.pdf");//save the file to disk



Edited by Ingo - 10 Sep 07 at 4:04PM
Back to Top
ice_bora View Drop Down
Beginner
Beginner
Avatar

Joined: 05 Sep 07
Location: Ukraine
Status: Offline
Points: 7
Post Options Post Options   Thanks (0) Thanks(0)   Quote ice_bora Quote  Post ReplyReply Direct Link To This Post Posted: 12 Sep 07 at 5:54AM
Hi.
I can't select radiobutton.
Search in all forums, read reference guide and can't find !!!!
Help me somebody.

Back to Top
ice_bora View Drop Down
Beginner
Beginner
Avatar

Joined: 05 Sep 07
Location: Ukraine
Status: Offline
Points: 7
Post Options Post Options   Thanks (0) Thanks(0)   Quote ice_bora Quote  Post ReplyReply Direct Link To This Post Posted: 12 Sep 07 at 6:42AM
Hi again.

Maybe it doesn't work and I try do impossible.
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3524
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 12 Sep 07 at 7:24AM
Hi!

Only an idea how to go on ...
You're calling the functions... get the resulting values... and working with these values. Perhaps it's better to check the returning values first - so you know where the first error appears.

Good luck,
Ingo

Back to Top
ice_bora View Drop Down
Beginner
Beginner
Avatar

Joined: 05 Sep 07
Location: Ukraine
Status: Offline
Points: 7
Post Options Post Options   Thanks (0) Thanks(0)   Quote ice_bora Quote  Post ReplyReply Direct Link To This Post Posted: 26 Sep 07 at 5:43AM
Hi.

I had holiday and now return to radiobuttons again.

1. I have field with type radiobutton (type = 4) and 3 subfields in this field.
2. long chld  = spPDF->GetFormFieldKidCount(indexField);
    get child count = 3;
3. for (long i =1; i<=chld; i++)
    {
       long subindex   = spPDF->GetFormFieldSubTempIndex(indexField, i);
       _bstr_t subName = spPDF->GetFormFieldSubName(indexField, i);
       long typeSub    = spPDF->GetFormFieldType(subindex);  
    }
   subindex is like us 1426064130 number.
   typeSub = 4 - radiobutton too.

   First subName is "Off" why ? What is the subField ?
   And next are correct names but needs use chld+1 for get last field ?

I can change  text, style for subFields.
       spPDF->SetFormFieldCheckStyle(subindex, 1, 0);

But I can't do select for one subField !!!!!
    long res = spPDF->SetFormFieldValue(subindex, "Yes");

Who did something like, help me please.

Pasha.
Back to Top
ice_bora View Drop Down
Beginner
Beginner
Avatar

Joined: 05 Sep 07
Location: Ukraine
Status: Offline
Points: 7
Post Options Post Options   Thanks (0) Thanks(0)   Quote ice_bora Quote  Post ReplyReply Direct Link To This Post Posted: 26 Sep 07 at 5:48AM
Hi Ingo.

I check return values.
But subfield doesn't  has value, title and when I setValue return result 0.

May be needs use iSEDQuickPDF.dll but problem with registration dll.
I use iSED.dll for VC++.
It's correct ?


Pasha.


Edited by ice_bora - 26 Sep 07 at 5:55AM
Back to Top
ice_bora View Drop Down
Beginner
Beginner
Avatar

Joined: 05 Sep 07
Location: Ukraine
Status: Offline
Points: 7
Post Options Post Options   Thanks (0) Thanks(0)   Quote ice_bora Quote  Post ReplyReply Direct Link To This Post Posted: 27 Sep 07 at 6:39AM
Hi all.

My monologue continuing ))).

Needs set default value to the field, value is one from subfields.
spPDF->setFormFieldDefaultValue(indexField, "one from subfields)";

Pasha.
Back to Top
marian_pascalau View Drop Down
Debenu Quick PDF Library Expert
Debenu Quick PDF Library Expert


Joined: 28 Mar 06
Location: Germany
Status: Offline
Points: 278
Post Options Post Options   Thanks (0) Thanks(0)   Quote marian_pascalau Quote  Post ReplyReply Direct Link To This Post Posted: 28 Sep 07 at 2:51AM

Hi there, send a small program + PDF to support(at)quickpdf.org and I will take a look on your problem.

And of course that with program I mean source code. C++, Delphi, C#, VB.NET are ok for me.
 
Best regards, Marian


Edited by marian_pascalau - 28 Sep 07 at 2:53AM
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