-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PyPDF some fields not showing in generated PDF #2724
Comments
One thing I found about it is there is data on the field. It display data when I click on the field , it disappear just show the blue editable field when I move the cursor. For me I am generating the PDF as readonly in above examples, there I cannot see the data at all |
Your form is in readonly. Can you remove this restriction for analysis |
Sure. Please see the comment also
…On Tue, Jun 25, 2024 at 3:51 PM pubpub-zz ***@***.***> wrote:
Your form is in readonly. Can you remove this restriction for analysis
—
Reply to this email directly, view it on GitHub
<#2724 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ALGT37H26QQOLJGEUOUQELLZJHC4HAVCNFSM6AAAAABJ4OPTZGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOBZHA2TCMJUG4>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
I've seen it but I would like to see how acrobat modifies the fields. In pdf.js the fields are visibles |
With pdf.js the values of the fields are correct because we use their |
Below is the editable pdf generated Looking forward for a solution asap. It is a blocker for my project deployment Thanks |
I've understood : the boxes ("/Rect") are upside down Rect[1] is greater than Rect[3]. Just checking but a fix/patch should be available soon |
Thank you |
can you try to modify _writer.py line 879:
|
what need to be modified? I am new to python, just trying understand |
start the python idle,
save file, rerun your script. check result |
Thank you. |
at line 839, you can find:
|
Tried it. Still no luck Thanks |
can you provide some test code please |
import json
import getdata
from ReadConfig import read_config
from pypdf import PdfReader,PdfWriter
import argparse
import os
from datetime import datetime
from pypdf.constants import UserAccessPermissions as UAP
todayDate = datetime.today().strftime("%Y-%m-%d_%H-%M-%S")
config = read_config()
input_pdf = f""+config['FilePaths']['input_pdf']+"FRA F 6180.55.pdf"
def fill_pdf():
try:
merger = PdfWriter()
merger.encrypt(user_password="",owner_password="",permissions_flag=UAP.PRINT)
reader = PdfReader(input_pdf)
writer = PdfWriter(clone_from=reader)
writer.set_need_appearances_writer(True)
writer.encrypt(user_password="",owner_password="",permissions_flag=UAP.PRINT)
for page in writer.pages:
writer.update_page_form_field_values(
page,
{
"RailroadName": "A" ,
"RailroadCode": "B" ,
"ReportMonthYear": "06/2024" ,
"County": "MX" ,
"ReportingOfficerName": "C" ,
"ReportingOfficerTitle": "D" ,
"ReportingOfficerAddress": "E" ,
"ReportingOfficerTelephoneNumber": "F" ,
"Date1": "" ,
"Date2": "" ,
"FreightTrainMiles": "2323" ,
"PassengerMilesOperated": "34324" ,
"YARDMILE": "23324" ,
"OtherTrainMiles": "45435" ,
"WORKERHR": "5346" ,
"PassengerTrainMiles": "65746",
"PassengersTransported": "4653" ,
"FatalEmployee": "3" ,
"FatalEmployeeNotOnDuty": "1" ,
"FatalPassengers": "4" ,
"FatalNontrespassers": "5" ,
"FatalTrespassers": "6" ,
"FatalContractor": "8" ,
"FatalContractorOher": "34" ,
"FatalVolunteer": "64" ,
"FatalVolunteerOther": "3" ,
"FatalNonTrespassersOffRailroad": "34" ,
"FatalGrandTotal": "35" ,
"NonFatalEmployee": "3" ,
"NonFatalEmployeeNotOnDuty": "5" ,
"NonFatalPassenger": "5" ,
"NonFatalNontrespassers": "34" ,
"NonFatalTrespassers": "3" ,
"NonFatalVolunteerOther": "43" ,
"NonFatalContractor": "2" ,
"NonFatalContractorOther": "64" ,
"NonFatalVolunteer": "2" ,
"NonFatalNonTrespassersOffRailroad": "23" ,
"NonFatalGrandTotal": "23" ,
"F618054": "2" ,
"F618055A": "3",
"F618056": "3",
"F618057": "4" ,
"F618081": "5" ,
"Description1": "D" ,
"Description2": "E" ,
"Description3": "F" ,
"Description4": "G" ,
"Description5": "H",
"State": "NJ"
},
auto_regenerate = False
)
merger.append(writer)
output_pdf= f""+config['FilePaths']['output_pdf']+"FRA F 6180.55_1.pdf"
with open(output_pdf , "wb") as output_stream:
merger.write(output_stream)
except Exception as e:
print(e)
fill_pdf() Below is the input file |
Any update? |
let me have dinner!😫 |
Sorry for pushing . It is a blocker for my project. |
We are only volunteers spending spare time for the benefit of the community....
line 776:
|
any update ? |
No luck. Still same |
working for me 🤔 |
I think it should be good now : I missed the /BBox field
|
Wow! Perfect. That worked. Thank you so much |
This should be part of next release |
Hi,
Can someone please help with this
I am generating few PDF using py PDF pypdf==4.2.0
This is the input PDF
FRA F 6180.55.pdf
The marked fields on the image are not filling , but when I get the getfields() of writer and check, there is value(\V) for the fields
Few example getfields data:
Below is the generated PDF
FRA F 6180.55_2018-05-01_2018-05-31_2024-06-25_14-31-00.pdf
TIA
The text was updated successfully, but these errors were encountered: