I'm a bit biased (committer), but I suggest iText.
generating pdf documents based on predefined template (I can use either pdf forms or xsl-fo)
PDF forms: Check
being able to fill textual data
PDF Forms, check. You can also perform programmatic layout.
being able to fill graphical data (generated bar codes)
Check. Given a known location (which could be "the location of this particular annotation"), iText will draw a barcode for you given a symbology and value. You can deduce a list of supported symbologies from the constants listed here.
For this sort of thing, I use Button fields with an "Icon Only" appearance. The "icon" is some arbitrary PDF drawing instructions, or an image. iText's barcode stuff will create a PdfTemplate
you can stuff into the button without too much trouble.
being able to alter pdf template in production environment without patching (recompiling)
If all your layout is baked into the PDF template, and your "barcode goes here" info isn't hard coded into the source, then you're golden.
generating pdf file to be saved in the database (as blob) and/or printed
A PDF is a PDF is a PDF. Heck, with some extra work on your part, you can use iText to build PDF/A files. "A" is for Archive.
open source/free
Open Source: Yes. v2.1.7 was the last version to use the MPL. Since 5.x, all iText releases have been under the AGPL. Yes, iText skipped from 2.1.7 to 5.0, in order to synchronize the version numbering between iText and iTextSharp.
Not exactly "little f" free, but the 2.1.7 version isn't that hard to come by. OTOH, it's orphan-ware, unmaintained. Be an informed consumer.