Skip to content
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

PDF Form filling #42

Closed
braindev opened this issue Sep 20, 2018 · 25 comments
Closed

PDF Form filling #42

braindev opened this issue Sep 20, 2018 · 25 comments
Assignees

Comments

@braindev
Copy link

Any plans for PDF form filling? PDF "flattening" would be a nice feature to go along with that.

Thanks!

@hhrutter
Copy link
Collaborator

Hi!
Form filling is definitely in the pipeline.
What's your definition of "flattening"?

@braindev
Copy link
Author

braindev commented Sep 20, 2018

A flattened PDF wouldn't allow the form fields to be edited.

EDIT:
I'm borrowing the term from pdftk
see: https://www.pdflabs.com/docs/pdftk-man-page/#dest-output-flatten

@hhrutter hhrutter changed the title PDF Form filling? PDF Form filling Nov 14, 2018
@zbruhnke
Copy link

@hhrutter any timeline around this? It's something we're thinking about as well

@StefanSchroeder
Copy link

@hhrutter Any updates on this issue? Not pushing, just asking.

@hhrutter
Copy link
Collaborator

Hello!

I am hard at work and busy providing Unicode/CJKV support.
Please consider backing pdfcpu as a sponsor if you want to keep this project going.
The ❤️ button is right at the top of the ReadMe.

Thank you for using pdfcpu 💚

@kben
Copy link

kben commented Apr 15, 2021

@hhrutter Thanks for this incredible library, I just found it. Can I somehow support you with Code on this feature?

@hhrutter
Copy link
Collaborator

👍 Thanks, that's already being worked on.
Happy to take all your issues once it is released.

@karelbilek
Copy link

karelbilek commented Mar 22, 2022

I tried to do PDF form filling myself, and it almost works but doesn't completely.

The easy part is to go through the PDF form fields and set the correct V field.

The hard part is to set the AP default appearance.

I tried to "delete" it and set NeedAppearances. What happens is AcroReader then regenerates some of them, but about half of them still show up empty! And I need to click inside and re-save (which makes NeedAppearances useless...)

Maybe it's something with this specific form, but some appearances are just not regenerating in Acrobat Reader.

I lack the knowledge to re-create the AP myself on the form :(

@hhrutter
Copy link
Collaborator

This feature will be part of the next release.
Stay tuned 👍

@karelbilek
Copy link

I hope it will include recreating the AP appearances :D and not just relying on NeedAppearances. I see you already do create appearances in a different part of the code (where you create text fields from scratch), so I guess you already have that :)

NeedAppearances seems a bit buggy, at least in Acrobat. I tried to study how AP streams work, and where to get the fonts reference, and my brain got too tired. :) I tried to look how iText does that and 💀 so complex. (And it is buggy too.)

yes looking forward to that. Btw pdfcpu is a great package, it allowed me to look inside PDF and play with it. Thanks a lot

@eduardo-mior
Copy link

I'm looking forward to it.

Any predictions for when this will be released?

@hhrutter I am very grateful for your work.

@dingyaguang117
Copy link

@eduardo-mior @karelbilek @braindev @zbruhnke @StefanSchroeder @kben

Hi guys, I implemented form-filling based on pdfcpu's low-level API. Just for reference.

@hhrutter
Copy link
Collaborator

hhrutter commented May 31, 2022

It is being worked on. See above.

@karelbilek
Copy link

@dingyaguang117 huh interesting. Is "watermark" how it fills the AP appearance streams? Or is it a different thing?

@dingyaguang117
Copy link

@dingyaguang117 huh interesting. Is "watermark" how it fills the AP appearance streams? Or is it a different thing?

Filling-form is based on modifing the value of V key (Text Field) and AS key(Button Field) in annotations.

@0q2
Copy link

0q2 commented Jan 6, 2023

It's been four years, any updates?

@hhrutter
Copy link
Collaborator

hhrutter commented Jan 6, 2023

This is part of the upcoming release which is all about form processing.
Please bear with me 🙏

@hhrutter
Copy link
Collaborator

hhrutter commented Mar 1, 2023

=> https://github.com/pdfcpu/pdfcpu/releases/tag/v0.4.0

@hhrutter hhrutter closed this as completed Mar 1, 2023
@karelbilek
Copy link

Hah good. As I promised to you one time on slack, I will try various PDFs I have to get you bugs for this, if I find them

@kben
Copy link

kben commented Mar 3, 2023

Hi, I just had the change to try the new implementation. But get the following error when trying to fill a textfield:

writing x.pdf...
pdfcpu: dict=<<
<AP, <<
<N, (757 0 R)>
>>>
<DA, (/Helv 12 Tf 0 g)>
<F, 4>
<FT, Tx>
<Ff, 0>
<P, (741 0 R)>
<Rect, [413.50 545.75 565.20 568.80]>
<Subtype, Widget>
<T, (Textfield-5)>
<TU, (857 0 R)>
<Type, Annot>
<V, (��FDSA)>

entry=MK missing.

Any idea what's happening here?

@hhrutter
Copy link
Collaborator

hhrutter commented Mar 4, 2023

Not sufficient for analysis.
I need to see more of what you are doing
an please open a new issue.

@kben
Copy link

kben commented Mar 4, 2023

Using the follwoing PDF:

  • doing a form export
  • modify a textfiled
  • try to fill the pdf

https://www.aok.de/pk/magazin/cms/fileadmin/pk/rheinland-hamburg/pdf/antrag-leistungen-pflegeversicherung.pdf

@hhrutter
Copy link
Collaborator

hhrutter commented Mar 4, 2023

Hi!
Are you trying to modify a PDF form that was not created with pdfcpu?
Then issues are expected and need to be followed up.
Please open a new issue.
Thank you!

@enahs
Copy link

enahs commented Mar 5, 2023

@kben please link the issue here. seeing a similar problem on a 3rd party pdf fill.

@kben
Copy link

kben commented Mar 5, 2023

See bugreport #571

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants