jung-kurt / gofpdf

A PDF document generator with high level support for text, drawing and images
http://godoc.org/github.com/jung-kurt/gofpdf
MIT License
4.32k stars 780 forks source link

Form Filling #99

Open Noofbiz opened 7 years ago

Noofbiz commented 7 years ago

Hello,

I'm wondering if there's functionality for filling out a form. Take a template pdf with empty form spots and use a struct or map[string]string to add data to generate a new pdf filled with the data.

FPDF has a script able to do that here: https://github.com/madnh/FPDM/tree/master/src

If the functionality isn't present, I'd be happy to give it a try.

Thanks

jung-kurt commented 7 years ago

Thanks for your interest, @Noofbiz. This topic was raised in issue 91. There appear to be some subtleties with the FPDM module that may make it a less-than-straightforward port. For example, I am not sure if the reference to the pdftk standalone application is a dependence or if it is used as a fallback.

If you want to tackle it (and I hope you do!), here are some guidelines:

Noofbiz commented 7 years ago

I would like to take this issue on. I'd also like to see if the pdftk is a dependence, because that's what I'm actually doing now as a workaround lol. I'll fork and get started when I have time today.

Thanks!

jung-kurt commented 7 years ago

Thanks, @Noofbiz -- this will be a valuable feature!

Noofbiz commented 7 years ago

Sorry about being so behind on this. So, I'll need to add functionality to read pdf files for this to work natively. I'm thinking about adding a Load function yay will load the pdf at the given file path and then convert the pdf document into an Fpdf structure by the pdf syntax. Another way of doing it, if you believe that would be outside the scope of this project, would be for me to make a separate library to do the pdf reading. A third option would be to just use pdftk, which is what the php script does. It'll mean pdftk will be a dependency on the OS it's run on and will call it through os.exec,so it'll also have to be on the $PATH.

I vote for the first option if you don't object.

Javivi commented 5 years ago

Hello @Noofbiz @jung-kurt !

Did anything come out of this 👍 ?

Noofbiz commented 5 years ago

Pdftk was a dependence and it calls that via the command line. I started looking at the spec for pdf and tried to make a parser myself but that never really went anywhere. I can see if I still have the code for that somewhere but all I don't think I got very far

Noofbiz commented 5 years ago

I just pushed the changes to my branch here https://github.com/Noofbiz/gofpdf there's a lot of work to do still and it's nowhere near updated to the recent gofpdf, so sorry about that :P