Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How to read Radio button field using Embed API

Community Beginner ,
Feb 03, 2023 Feb 03, 2023

I'm using the Embed API to display a PDF with several checkboxes and radio buttons in a browser.

I can then fill in the checkboxes and radio buttons and save the file.

After the save, I want to read back the values of the checkboxes and radio buttons.

Is there a way to do this with the Embed API ?

If not, any suggestions?

 

Thanks,

John

1.1K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Feb 03, 2023 Feb 03, 2023

Sorry no, you can't get access to form values via the Embed API.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 05, 2023 Feb 05, 2023

Raymond, thanks for the quick response.  This leads me to another issue though.  In my pdf file, I have several Yes/No questions with checkboxes.  For most questions, I can manually update the checkboxes in a browser (by clicking the checkbox after calling the Adobe Embed View method) and read back the correct status using a JS library called pdf-lib.  However, for some of the questions (ie. questions 1 thru 5 and question 9), it does not read back my updated status.  I always get the true/false value of the original state of that checkbox.   Note that programmatically the check() and uncheck() methods work, its just the manual clicking that does not report updated status.  I've attached my base pdf.  Thanks for any help/thoughts you may provide.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Feb 06, 2023 Feb 06, 2023

I can't speak to pdf-lib, I don't know it. 🙂 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 11, 2023 Feb 11, 2023
LATEST

Hi Raymond,

 

I dug a bit more into my checkbox problem by reading the Adobe Reference Guide (PDF Reference) and it looks to me like there might be a problem with the Adobe Embed s/w.

To review my problem.  I start by opening a pdf in a browser using Adobe Embed’s previewFile method.

This pdf has several checkboxes, but they are are initially unchecked (this original BlankFields.pdf file was sent in an earlier submission).

I then check the box in field ‘3’ and save it.  I then use pdf-lib to check the value of that box and it comes back ‘false’ instead of ‘true’.

This ‘saved’ pdf file is called Submitted_Manual3.pdf

 

Looking at this ‘saved’ pdf file, I can see that Adobe Embed has compressed some of it using ‘flatedecode’.

I found a tool called qpdf on the web to decode this file.  The decoded file is called Submitted_Manual3_after_qpdf_decode.pdf

With this file decoded, I can see that the Acroforms are defined in obj 3 which further defines a fields dict in obj 10 which further defines 40 fields in objs 13 thru 52.

These 40 fields are the 33 checkboxes and 7 text fields in this pdf.

Obj 46 is the one that controls checkbox field ‘3’.  As you can see below, the value of the /V tag of obj 46 is /Off even though I checked the checkbox.  This is why pdf-lib’s isCheck() method is returning ‘false’.

%% Original object ID: 8 0

46 0 obj

<< 

  /F 4

  /FT /Btn

  /Ff 0

  /Kids [

    223 0 R

    224 0 R

  ]

  /T (3)

  /V /Off                          

>> 

endobj

If I manually change this /V value from /Off to /Yes, the isCheck() method correctly returns ‘true’.

Note that objs 223 and 224 control the ‘visual’ checkmark and that seems to be working fine, it’s just the status of the checkmark field that is not correct.

 

Please let me know if you agree this is a bug and if so, why this object is not returning ‘Yes’ when I check the checkbox in Adobe Embed.

I’ve attached both the original saved file from Adobe Embed as well as the qpdf decoded file.

 

Thanks,

John

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources