you can try freebarcodegen it's totally open source. You can take a look at his code — hopefully it gives you some inspiration.