Two-a4-on-one-a3.sh: Difference between revisions
No edit summary |
No edit summary |
||
(21 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
==Script== | |||
[[File:Two-a4-one-a3-2.png|thumb|right|<code>pdftk</code> duplicates each page]] | |||
[[File:Two-a4-one-a3-1.png|thumb|right|<code>pdfjam</code> places two A4 on one A3]] | |||
<pre> | <pre> | ||
pdftk | 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 | pdfjam --nup 2x1 --paper a3paper --landscape ongoing-circulations-double-pages.pdf | ||
</pre> | </pre> | ||
This small 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. | ==How to work with it?== | ||
'''What does this script do?'''<br> | |||
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?'''<br> | |||
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?'''<br> | |||
[https://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/ <code>pdftk</code>] + [https://github.com/rrthomas/pdfjam <code>pdfjam</code>] | |||
'''How to download these pieces of software?'''<br> | |||
Good question.... | |||
'''On which systems can this script run?'''<br> | |||
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?'''<br> | |||
Save the code above as a bash script with the <code>.sh</code> extention, for example: <code>two-a4-on-one-a3.sh</code>. 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: <code>sh two-a4-one-a3.sh</code>. Make sure you have the two PDF transformation tools installed (<code>pdftk</code> and <code>pdfjam</code>)! | |||
==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) [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 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 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 select specific pages of your document. I had never seen <code>cat</code> being used to duplicate pages though! It was a helpful discovery, specially because other suggestions i found to duplicate pages involved loops written in bash and the making of temporary files, which would probably mean that i would write a small bash script to do it, which is not a bad thing in itself, but now i needed just one command to do it. And i like actually how visible the gesture of duplicating becomes by repeating the page numbers in the command. | |||
So in the end, the script uses two PDF manipulation tools: <code>pdftk</code> and <code>pdfjam</code>. | |||
'''pdftk'''<br> | |||
The first line of the script calls <code>pdftk</code>, provides <code>ongoing-circulations.pdf</code> as its input file, then uses <code>cat 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10</code> to select a range of pages of the input file, and finally writes it the <code>output</code> to <code>ongoing-circulations-double-pages.pdf</code>. | |||
'''pdfjam'''<br> | |||
The second line of the script call <code>pdfjam</code> and specifically the <code>--nup</code> module, which is used to shuffle pages around. By specifying <code>2x1</code> i asked the tool to place 2 pages horizontally and 1 vertically. The <code>--paper a3paper</code> selects the size of the pages and <code>--landscape</code> makes sure that the pages are in landscape orientation. The final step is to provide an input file, such as <code>ongoing-circulations-double-pages.pdf</code>. It then creates a file with the same filename + <code>-pdfjam</code>. | |||
[[Category: | [[Category:Boilerplates]] |
Latest revision as of 09:07, 7 April 2023
Script
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 ongoing-circulations-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 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 select specific pages of your document. I had never seen cat
being used to duplicate pages though! It was a helpful discovery, specially because other suggestions i found to duplicate pages involved loops written in bash and the making of temporary files, which would probably mean that i would write a small bash script to do it, which is not a bad thing in itself, but now i needed just one command to do it. And i like actually how visible the gesture of duplicating becomes by repeating the page numbers in the command.
So in the end, the script uses two PDF manipulation tools: pdftk
and pdfjam
.
pdftk
The first line of the script calls pdftk
, provides 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 finally writes it the output
to ongoing-circulations-double-pages.pdf
.
pdfjam
The second line of the script call pdfjam
and specifically the --nup
module, which is used to shuffle pages around. By specifying 2x1
i asked the tool to place 2 pages horizontally and 1 vertically. The --paper a3paper
selects the size of the pages and --landscape
makes sure that the pages are in landscape orientation. The final step is to provide an input file, such as ongoing-circulations-double-pages.pdf
. It then creates a file with the same filename + -pdfjam
.