I've made a C++ program with uses a LaTeX template for creating PDF documents. I open the file, replace some placeholders written inside the .tex document with values of a DB, and then, I compile the filled document with pdflatex to get the corresponding PDF.

My .tex files are pretty simple: some packages (inputenc, fullpage and so on) and then a not specially long body (5 pages at most).

Since every PDF comes from the same .tex template, and they have lot of things in common (format, structure, headers), is there any way to precompile a .tex document in order to compile faster?

  • 1
    No, I'm afraid it doesn't make sense. Five pages should take just a few seconds to be processed. – egreg May 23 '15 at 19:59
  • 3
    I don't think this is possible. You might be able to compile the document with space left for the elements you're inserting, and then use your C++ program to insert the text directly in the pdf code. But this will probably be ugly unless the space required for the elements you're inserting is consistently the same. – dgoodmaniii May 23 '15 at 20:29