Depending on your needs, Scribus might help with it's scripting API[1], see ScribusGenerator[2] for example.
Scribus and inkscape can import pdfs but it would be preferable to use a clean "source" format, pdf is AFAIK meant for output, like lossy compressed images.