Two-a4-on-one-a3.sh: Difference between revisions

From creative crowd wiki
Jump to navigation Jump to search
Line 33: Line 33:
This script was written to generate the print files for the publication ''ongoing circulations'' to document a series of five collective learning sessions organised by Varia in 2022. Each session departed from a technological practice and made space for exploring, questioning and (re)turning (to) [https://varia.zone/en/hold-and-release.html digital library software], [https://varia.zone/en/plaintext-protocols-partyline.html plain text publishing protocols], [https://varia.zone/en/publishing-partyline.html web-to-print tools], [https://varia.zone/en/push-to-talk-partyline.html high frequency radio communication], and [https://varia.zone/en/colonial-infrastructures.html colonial infrastructures]. The publication is based on the format of the letter, a mode of address that was chosen to reach out to the participants of the sessions specifically, but could meanwhile also speak to a larger body of readers and invite them into the questions that were formulated and materials that were produced.  
This script was written to generate the print files for the publication ''ongoing circulations'' to document a series of five collective learning sessions organised by Varia in 2022. Each session departed from a technological practice and made space for exploring, questioning and (re)turning (to) [https://varia.zone/en/hold-and-release.html digital library software], [https://varia.zone/en/plaintext-protocols-partyline.html plain text publishing protocols], [https://varia.zone/en/publishing-partyline.html web-to-print tools], [https://varia.zone/en/push-to-talk-partyline.html high frequency radio communication], and [https://varia.zone/en/colonial-infrastructures.html colonial infrastructures]. The publication is based on the format of the letter, a mode of address that was chosen to reach out to the participants of the sessions specifically, but could meanwhile also speak to a larger body of readers and invite them into the questions that were formulated and materials that were produced.  


The letters were RISO printed by Printroom, which is a space in Rotterdam dedicated to artist publications, small press and self-publishing. They run a RISO workshop in the city, where they have two A3 RISO machines plus four A4 ones, lots of different colors, and a range of machines for the post production, such as folding machines. Printroom asked us to prepare the print files on A3, because these RISO machines are the most reliable ones they have. At first i wasn't really sure how to do it... How can each A4 page of the PDF be duplicated and placed side-by-side on one A3 page without loosing any quality? Using raster editor software, like Gimp, would not make sense, as i was not sure if this would keep the quality of the PDF intact. Using vector editor software, like Inkscape, would also not make a lot of sense, because the fonts would not be rendered correctly. So i started to look for a tool that could be used from the command line.
The letters were RISO printed by Printroom, which is a space in Rotterdam dedicated to artist publications, small press and self-publishing. They also run a RISO workshop, where they have two A3 RISO machines plus four A4 ones, lots of different colors, and a range of machines for the post production, such as folding machines. Printroom asked us to prepare the print files on A3, because these RISO machines are the most reliable ones they have. At first i wasn't really sure how to do it... How can each A4 page of the PDF be duplicated and placed side-by-side on one A3 page without loosing any quality? Using raster editor software, like Gimp, would not make sense, as i was not sure if this would keep the quality of the PDF intact. Using vector editor software, like Inkscape, would also not make a lot of sense, because the fonts would not be rendered correctly. So i started to look for a tool that could be used from the command line.


The script does two things: it multiplies each page of a PDF by two, and it places two A4 pages on an A3 side-by-side. It took me a while to figure out how you could do this, but eventually [https://superuser.com/a/1549057 this answer on superuser.com] revealed a very nice trick using <code>pdftk</code>. I have used <code>pdftk</code> in the past to work with PDFs to extract certain pages, so i was aware of the <code>cat</code> option and that you can use it to point to specific pages of your document. I had never seen <code>cat</code> being used though, to duplicate pages! It was a great discovery, specially because other ways of reaching the same outcome involved for loops written in bash, which would mean probably mean that i would write a small bash script to write this all out, and now i needed just one line of code.
The script does two things: it multiplies each page of a PDF by two, and it places two A4 pages on an A3 side-by-side. It took me a while to figure out how you could do this, but eventually [https://superuser.com/a/1549057 this answer on superuser.com] revealed a very nice trick using <code>pdftk</code>. I have used <code>pdftk</code> in the past to work with PDFs to extract certain pages, so i was aware of the <code>cat</code> option and that you can use it to point to specific pages of your document. I had never seen <code>cat</code> being used though, to duplicate pages! It was a great discovery, specially because other ways of reaching the same outcome involved for loops written in bash, which would mean probably mean that i would write a small bash script to write this all out, and now i needed just one line of code.

Revision as of 08:31, 7 April 2023

Script

pdftk duplicates each page
pdfjam places two A4 on one A3
pdftk ongoing-circulations.pdf cat 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 output ongoing-circulations-double-pages.pdf
pdfjam --nup 2x1 --paper a3paper --landscape partylines-publication-double-pages.pdf

How to work with it?

What does this script do?
It multiplies each page of a PDF by two + place two A4 pages on one A3 side-by-side.

In which context was it made?
The script is written to generate the print files for a publication called ongoing circulations, made and published by Varia in April 2023.

What software does it use?
pdftk + pdfjam

How to download these pieces of software?
Good question....

On which systems can this script run?
This works on Linux systems, also on Mac OS probably, but surely unfortunately not on Windows, because those systems work with another shell different from bash, which means that the Windows shell speaks a whole different language.

How to run the script?
Save the code above as a bash script with the .sh extention, for example: two-a4-on-one-a3.sh. You can use any kind of code editor for this. Once you did that, you can open your terminal, navigate to the folder where you saved the script, and run the script with: sh two-a4-one-a3.sh. Make sure you have the two PDF transformation tools installed (pdftk and pdfjam)!

Preparing print files for ongoing circulations

This script was written to generate the print files for the publication ongoing circulations to document a series of five collective learning sessions organised by Varia in 2022. Each session departed from a technological practice and made space for exploring, questioning and (re)turning (to) digital library software, plain text publishing protocols, web-to-print tools, high frequency radio communication, and colonial infrastructures. The publication is based on the format of the letter, a mode of address that was chosen to reach out to the participants of the sessions specifically, but could meanwhile also speak to a larger body of readers and invite them into the questions that were formulated and materials that were produced.

The letters were RISO printed by Printroom, which is a space in Rotterdam dedicated to artist publications, small press and self-publishing. They also run a RISO workshop, where they have two A3 RISO machines plus four A4 ones, lots of different colors, and a range of machines for the post production, such as folding machines. Printroom asked us to prepare the print files on A3, because these RISO machines are the most reliable ones they have. At first i wasn't really sure how to do it... How can each A4 page of the PDF be duplicated and placed side-by-side on one A3 page without loosing any quality? Using raster editor software, like Gimp, would not make sense, as i was not sure if this would keep the quality of the PDF intact. Using vector editor software, like Inkscape, would also not make a lot of sense, because the fonts would not be rendered correctly. So i started to look for a tool that could be used from the command line.

The script does two things: it multiplies each page of a PDF by two, and it places two A4 pages on an A3 side-by-side. It took me a while to figure out how you could do this, but eventually this answer on superuser.com revealed a very nice trick using pdftk. I have used pdftk in the past to work with PDFs to extract certain pages, so i was aware of the cat option and that you can use it to point to specific pages of your document. I had never seen cat being used though, to duplicate pages! It was a great discovery, specially because other ways of reaching the same outcome involved for loops written in bash, which would mean probably mean that i would write a small bash script to write this all out, and now i needed just one line of code.

So in the end, the script uses two PDF manipulation tools: pdftk and pdfjam.

The first line of the script calls pdftk, then uses ongoing-circulations.pdf as its input file, then uses cat 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 to select a range of pages of the input file, and writes it the output to ongoing-circulations-double-pages.pdf.