473,608 Members | 2,410 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Trouble fetching checkbox and radio fields with PyPDF2

1 New Member
My project involves reading text from a bunch of PDF form files for which I'm using PyPDF2 open source library. There is no issue in getting the text data as follows:

Expand|Select|Wrap|Line Numbers
  1.  
  2. reader = PdfReader("data/test.pdf")
  3. cnt = len(reader.pages)
  4. print("reading pdf (%d pages)" % cnt)
  5. page = reader.pages[cnt-1]
  6. lines = page.extract_text().splitlines()
  7. print("%d lines extracted..." % len(lines))
  8.  
However, this text doesn't contain the checked statuses of the radio and checkboxes. I just get normal text (like "Yes No" for example) instead of these values.

I also tried the reader.get_fiel ds() and reader.get_form _text_fields() methods as described in their documentation but they return empty values. I also tried reading it through annotations but no "/Annots" found on the page. When I open the PDF in a notepad++ to see its meta data, this is what I get:

Expand|Select|Wrap|Line Numbers
  1. %PDF-1.4
  2. %˛ł´µ
  3. %Generated by ExpertPdf v9.2.2
  4.  
It appears to me that these checkboxes aren't usual form fields used in PDF but appear similar to HTML elements. Is there any way to extract these fields using python?
Aug 23 '22 #1
0 4799

Sign in to post your reply or Sign up for a free account.

Similar topics

2
1491
by: RH | last post by:
I have a form with home address & business address fields. When a user goes to this form, the fields pull the information that is stored in the database, then they can update their information. What I would like to do is have a checkbox/radio button/button that allows the user to specify that the business address is the same as the home address and replace all the business addy fields to the same value as the home addy.
3
3587
by: bitsyboffin | last post by:
Hi all, does anybody know of a bug in MacIE which prevents style.display = 'none' and style.visibility = 'hidden' from "sticking" in MacIE? I'm making some graphical checkboxes & radios (I know, bad idea, don't tell me, I just implement what I'm told), seeking to do it in a backwards compatable mode by using javascript to hide the real checkboxes and radios and link dynamically inserted images to them instead. But in Mac IE I have a...
0
1443
by: Leo | last post by:
I need to be able to send an attachment for each checkbox the user checks. like this: <input type="checkbox" name="file" value="bob.amr"> I need to have multiple checkboxes! and if they are checked the user gets an attachment for each? I am using the popular PHPMailer! thanks in advance!
0
1161
by: Krish | last post by:
Hello Gurus, I have GridView control on web page which has couple of radio button controls as one group. On editing a particular row in grid, i have to validate based on user selection on radio button i have to validate another column data in the grid. Pl. help me with code snippets. Thank you. <asp:TemplateField HeaderText="Code Translate"> <ItemTemplate>
5
1736
by: TomB | last post by:
Please take a look at this page: http://deimos.curious.be/~dusk/contact.php?action=show_booking As you can see the radio/check buttons do not line up with their label. It works with the input fields (like name/email), but only because I gave those a width so that the label + input field fill the formset. Obviously I don't want to specify a width for radio/check buttons, because it looks silly on browsers applying that with. Any other...
0
2747
by: ballamber | last post by:
This is a solution to the problem. Works with .NET 2.0. So the problem is displaying a data bound read-only checkbox or radio button in a GridView without actually disabling those controls. I assume you know what templates are in a GridView. Examples are in VB.NET. Sorry... So as a first step create a function in the page's underlying class that returns the string "checked" based on the bound data. Here's what I did. The underlying data...
7
3620
by: help4me | last post by:
Hope someone can help me out with this. I'm having trouble getting my radio button values into a MySQL database. And after I do get them inserted I'm going to want to be able to show them back in the form again (if the respondent didn't finish the whole form the first time). My text and textarea fields are inserting just fine and I'm able to bring those back up too. It's just the radio buttons that aren't working. When I created the table I...
2
1585
by: yogeshtiwarijbp | last post by:
Hi All, Iam new in asp.net 2003 and sql server. I have to create an application having following criteria. Proposed Steps 1. Create a table containing fields as Name of Report, View Name or Query in the database. 2. In the User Interface Label box, Combo box, Command Button, Table and web grid 5.2 controls are used. 3. First in the Combo Box user selects a report and click on the Command button. Inside Command button click event...
6
4809
by: Ang | last post by:
Is it possible to get the checkbox and radio button values from excel by c#? Thanks. *** Sent via Developersdex http://www.developersdex.com ***
17
25172
by: tomaz | last post by:
hi I've been searching the net for a solution, but did not find it. I use following css code: checkbox: input.largerElement { width: 25px;
0
8501
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8483
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8157
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8349
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6015
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
3967
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4030
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2477
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1607
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.