1

Spreadsheet applications offer to export tables as pdf. Often, the table is to wide to fit on a single page (without scaling), so several pdf pages need to cover the full width of the table.

Let us assume, our table is 3 pages wide and 3 pages tall:

+-------+
| o o o |
| o o o |
| o o o |
+-------+

During export, the pdf pages can be ordered in either of the two following ways:

+-------+
| 1 4 7 |
| 2 5 8 |
| 3 6 9 |
+-------+

or

+-------+
| 1 2 3 |
| 4 5 6 |
| 7 8 9 |
+-------+

Of course, in the pdf file one only sees:

1
2
3
4
5
etc.

Given the exported pdf file, how can I merge / glue the pages together in such a way that I have the complete table in one pdf page? Presumably, this page would be 3 times bigger in each dimension than a single standard page.

Edit: Linux solution preferred.

1

To "glue" e.g. an A4 PDF file to fit multiple pages on a single, huge page, you could use David Firsth's great PDFjam tool. It's usually included in most Linux distributions. With Linux Mint, e.g., install the texlive-extra-utils package to have PDFjam available.

With PDFjam installed, you can transform a PDF containing 9 A4 PDF pages (A4: 21x29.7 cm) using a command like this:

pdfjam --nup 3x3 --papersize '{63cm,89cm}' --noautoscale true \ <Inputfile> --outfile <outputfile>

The --nup 3x3 tells PDFjam to arrange the input PDF pages in three columns and three rows on each output page. The --papersize option defines the -as it should - a custom paper size. You may set --noautoscale to false to let PDFjam scale the pages automatically.

The PDFjam ReadMe has a nice example for clipping the input pages first, before combining them, so to remove any page margins:

pdfjam myfile.pdf --trim '1cm 2cm 1cm 2cm' --clip true --outfile /dev/stdout | \
  pdfnup --frame true --outfile myoutput.pdf

Of course, you'll have to adapt the pdfnup call according to your needs, or replace it by the pdfjam command as proposed.

Additionally, the pdfpages manual may be useful for other PDFjam options.

EDIT:

By default, PDFjam arranges the input pages in rows, e.g.

+-------+
| 1 2 3 |
| 4 5 6 |
| 7 8 9 |
+-------+

To arrange the input pages in columns instead (see above: first output format mentioned in the question):

+-------+
| 1 4 7 |
| 2 5 8 |
| 3 6 9 |
+-------+

the option --column true will be required.

From the pdfpages documentation:

Pdfpages normally uses 'row-major' layout, where successive pages are placed in rows along the paper. The column option changes the output into a 'column-major' layout, where successive pages are arranged in columns down the paper. Either 'true' or 'false' (or no value, which is equivalent to 'true'). (Default: column=false)

Thus, for column-based input, just use

pdfjam --nup 3x3 --column true --papersize '{63cm,89cm}' --noautoscale true \ <Inputfile> --outfile <outputfile>

  • Terrific, that did it! This works straight away for the second output format. For the first format, one needs to reorder the pages before. This can be done by 1) extracting the first, the middle and the last third 3 pages to extra files via pdftk cat and then 2) reshuffling the pages via pdftk shuffle. – jpmath May 12 '16 at 15:44
  • @jpmath: for the second output format, you can get the desired output directly by using the --column true option. I've emended my answer accordingly. – tohuwawohu May 12 '16 at 16:02
1

If you still have the raw data (spreadsheet) available, using LibreOffice, you could just modify the page properties, and tell LO Calc to print the sheet on one huge, custom-sized page. You'll have to switch between the page properties and the "Page Break" view to check if the page size is big enough for your sheet's data area.

To adjust the appropriate settings, select Menu Format -> Page.... On the Page tab, at the Format ComboBox, select User, and set the page dimensions manually:

enter image description here

On the Sheet tab, you may additionally set the output scaling, to fit the content on one page:

enter image description here

You may use this if there's a maximum size resulting PDF shouldn't exceed.

Now, just use the PDF export option to create a huuuuuuge PDF with your complete sheet data, without need for glueing or combining afterwards:

enter image description here

Tested with LO Calc 5.1.2.2 - in older versions of LO, Menu structure and dialogues may differ.

  • Thanks, this looks great! Do you have an idea what I could do if I do not have access to the spreadsheet file and need to deal with the already ill-exported pdf? – jpmath May 12 '16 at 7:51
  • I've added another answer (since this is a different approach), covering how to handle such a PDF file. – tohuwawohu May 12 '16 at 13:57

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.