I am trying to create pdf by passing buffer instead of filename but have certain issues.PDF size is only limited to two pages and can include only two pictures.Following is the full scenario.


I have managed to complete step 1 and 2 and to render I have to save data in temporary tex file before giving to lualatex file.


  1. On passing tex Buffer (which is very large) I get too long argument in lualatex system call.It works with less data.
  2. Is step 4 possible ? Are there any alternatives.

Basically I am trying to minimize unencrypted files created in this process due to security reasons.

Update From the comments I am able to generate PDF by passing data using pipe in linux shell. I dont think step 4 is possible Generating PDF without any intermediary files (stdin/stdout)

  • 3
    it isn't very clear how you are passing the data, but tex can always read standard in instead of a file so for example echo "\relax hello world \bye" | pdftex makes a hello world pdf without the input ever being in a file. – David Carlisle May 24 at 12:12
  • I am trying to pass data without echo. Like lualatex "pdf tex data" . It generates pdf when tex data is less but it fails on large data.It shows too long argument. – Freedom911 May 25 at 7:30
  • @Freedom911 lualatex "pdf tex data" will generally not work for large files. You do not write which operating system you use, but e.g. on Linux a single argument to any program can not be larger than 32 times the page size minus 1, so no program can accept arguments of length 128KiB or longer. Even if you split your buffer into multiple arguments, it can not be bigger than 2MiB, so for "very large" input there is nothing tex can do. Instead, I would reconsider David Carlisle's idea to pass the buffer through a pipe. – Marcel Krüger May 26 at 12:02
  • 1
    @Freedom911 At least on Linux a pipe is also more secure than regular arguments because every user on your system can see the arguments of all other running programs. – Marcel Krüger May 26 at 12:03
  • 2
    It depends on what you are actually trying to do. Are you using this from an external program or from the shell? Generally you can pass arbitrary amounts of data through pipes, they are similar to files by the system. So you have to figure out how to pipe data into a external process in your favorite programming language. As David wrote above, in the shell you could use e.g. echo "\relax hello world \bye" | pdftex. Here the argument limit normally doesn't apply to echo, because echo is a shell built-in and not an external program. The function you need is called popen in many languages. – Marcel Krüger May 26 at 18:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.