GoLang PDF Reader/Writer based on Template

Hi Folks,
We a have requirement to Create multiple PDF files based on a PDF Form File , CSV Data File & a config template.

Task aspires to read a PDF File ( having Textfields, CheckBoxs etc ) and we need to Clone the PDF and Fill in CSV Row Data into PDF input Fields.

hypothetically 1000 Rows of CSV file should produce 1000 PDF file with unique set of data prefilled.

I had experimented few top listed libraries not sure i am approaching this correct.

a solid framework or any pointers for this kind of task would be great.


hey folks
any recommendation or pointers on this topic.

I doubt there is any ‘solid framework’ for this kind of stuff. PDF format isn’t meant to be machine-friendly by design, and AFAIK there is no guaranteed way to parse arbitrary PDFs.

Personally, I’ve used yob/pdfreader package (my fork with small fixes: divan/pdfreader) for one task involving parsing specific set of PDFs. This package is quite old, non-idiomatic Go, but it has some nice design solutions, which I was able to use to make PDF-to-text converter on top of that. For me, it was enough, and, with some of heuristics, I was able to finally extract data from PDFs. Try it, may be it’ll work in your case as well.

Regarding making PDFs, I’ve used gofpdf package (mentioned earlier) a lot in production, and it’s quite good.

Thanks a lot @divan appreciate your reply. i will try to fork some of them and come up with a custom solution.

Was your pdf-to-text converter able to grab most PDFs, or just specific versions?

There is also https://github.com/rsc/pdf but it’s kind of unmaintaned and does not work on a bunch of PDFs I tried.

i don’t think that this is the way. pdf are not design to be an editable file and definitely not in this mode. i think that the best practice is to generate the final pdf document from your data set and/or forms.

i play a little with https://godoc.org/github.com/jung-kurt/gofpdf and seems ok for this.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.