Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to write a script in OSX that takes my input text files and automatically combines them into a PDF file that has flowing columns - that is to say, where I give it a long chunk of text and that text is automatically broken into two columns where the text flows down column 1 and when it hits the bottom of the page it starts filling up column 2. I've been playing with enscript and pstopdf and they can do that, the problem is that I also need some sections of the PDF that aren't in 2 columns.

I can probably explain this better with an example - assume my long chunk of text is the alphabet, I need my PDF to look like this:

[Page 1]
Header 1
Header 2
Header 3
A   E 
B   F
C   G
D   H

[Page 2]
I   K
J   L
Header 4
Header 5
M   N

[Page 3]
O   R
P   S
Q   T

I tried generating an HTML file and converting the HTML to PDF inside Safari, but while the HTML looks good, WebKit drops the ball and forgets about the columns when converting to PDF.

Is there a way to create the document in sections and then somehow combine them into one final document?

The target machine doesn't have Word installed, but if backed into a corner I could probably convince the powers-that-be to let me install Open Office on it. However, I would much rather find a solution that only uses command-line utilities.

share|improve this question
How often do you need to do this for what amount of data? You could also first build an XML and then use XSL to transform it to HTML, PDF and others. – ott-- May 3 '15 at 6:45
I ended up writing a Perl script for this ... gave me complete control over exactly what text got written where on the page. – Betty Crokker May 4 '15 at 17:50

You must log in to answer this question.

Browse other questions tagged .