Add tmp dir, and update readme

This commit is contained in:
Mara Karagianni 2021-12-30 16:56:29 +02:00
parent 026ea64007
commit d4f6ffbfcb
3 changed files with 47 additions and 37 deletions

BIN
.tmp/blank.pdf Normal file

Binary file not shown.

View file

@ -4,6 +4,7 @@ A script for generating A5 size pdf zines
with a text-file input, under development, with a text-file input, under development,
GPL3 Licence, Mara Karagianni May 2021 GPL3 Licence, Mara Karagianni May 2021
""" """
import os
import random import random
import subprocess import subprocess
import sys import sys
@ -26,7 +27,7 @@ def shuffle_zine(finput, foutput):
print("Something went wrong!", err.decode('utf-8'), sep="\n") print("Something went wrong!", err.decode('utf-8'), sep="\n")
else: else:
print("PDF saved as {}".format(foutput)) print("PDF saved as {}".format(foutput))
os.system("mv ./*_chapter.pdf ./tmp") os.system("mv ./*_chapter.pdf ./.tmp")
if __name__ == '__main__': if __name__ == '__main__':

View file

@ -1,24 +1,26 @@
# Introduction # Introduction
This zine helps in navigating the zine_maker code, a small software tool derived from pyPDF library. The code is written in Python, and provides a few scripts for creating covers, colophons, content, and also signatures for preparing a PDF for the printer. The scripts run with python version 3.x.x and we can feed to the scripts inputs and outputs. As an input, we give the path to a text file, which shall create the text and images content of the zine, and as an output we give a the path/filename of our choice. We can also run the scripts with no input nor output, in which case, they take as default parameters the readme text from the text/ folder and produce an output to either of the folders covers, colophons, body, or zines, depending on which script we are running each time. This tutorial helps in navigating the zine_maker code, a small software tool derived from pyFPDF library. The code is written in Python, and provides a few scripts for creating covers, colophons, content, and also signatures for preparing a PDF for the printer. The scripts run with python version 3.x.x and we can feed to the scripts inputs and outputs. As an input, we give the path to a text file, which shall create the text and images content of the zine, and as an output we give a the path/filename of our choice. We can also run the scripts with no input nor output, in which case, they take as default parameters the readme text from the 'text/' folder and produce an output to either of the folders 'covers', 'colophons', 'body', or 'zines', depending on which script we are running each time.
# Get the code # Get the code
## Download the source code ## Download the source code
As of 2021-2022, the code is under active development by the author and can be cloned and/or downloaded from https://git.systerserver.net/mara/zine_maker. The code is under development by the author and can be cloned or downloaded from https://git.systerserver.net/mara/zine_maker.
To download the project, near the top of the gitlab page, click on the download icon next to "Find file".
You can choose which type of archived folder you want, and then open it in your filesystem, by right clicking the archived folder, or from the terminal: To download the project, near the top of the gitlab page, click on the download icon next to "Find file". Once downloaded, right-click to extract the files, or from terminal run:
``` ```
tar -xvf zine_maker.tar -C /home/user/destination tar -xvf zine_maker.tar -C /home/user/destination
unzip zinme_maker.zip -d /home/user/destination unzip zinme_maker.zip -d /home/user/destination
``` ```
## OR use git clone: Or with git clone:
``` ```
git clone https://zine:DskM_8XxtKt-Wym1xHd1@git.systerserver.net/mara/zine_maker.git export username=zine
export token=DskM_8XxtKt-Wym1xHd1
export repo=git.systerserver.net/mara/zine_maker.git
git clone https://$username:$token@$repo
cd zine_maker cd zine_maker
``` ```
# Requirements # Requirements
Basic requirements are listed here. Basic requirements are listed here.
@ -35,20 +37,14 @@ Once these are installed, from within zine_maker folder run:
# Miscellaneous # Miscellaneous
## Fonts ## Fonts
The source code comes with some fonts under the fonts folder. You can use your The source code comes with some fonts under the 'fonts' folder. You can use your fonts of preference by adding them either in the 'fonts' folder and edit the files cover.py, colophon.py and doc_pdf.py to give the new names. Or add your absolute font path directly to the python scripts.
fonts of preference by adding them either in the fonts folder and edit the
files cover.py, colophon.py and doc_pdf.py to give the new names. Or add your
absolute font path directly to the python scripts.
## Text ## Text
The input texts should be clean from characters added by some text editors or The input texts should be clean from characters added by some text editors or Operating Systems. Use the cat command to check your text is ready as input
Operating Systems. Use the cat command to check your text is ready as input
with: with:
`cat --show-nonprinting input.txt` `cat --show-nonprinting input.txt`
Symbols such as M-oM-;M or ^M (carriage Return / line feed) need to be removed. Characters such as M-oM-;M or ^M (carriage Return / line feed) need to be removed. A cool tool for that is dos2unix, which is available as command line, but needs to be installed:
A cool tool for that is dos2unix, which is available as command line, but needs
to be installed:
`dos2unix filename` `dos2unix filename`
Or with the sed command: Or with the sed command:
@ -58,41 +54,32 @@ Extensive info can be find at:
https://www.cyberciti.biz/faq/sed-remove-m-and-line-feeds-under-unix-linux-bsd-appleosx/ https://www.cyberciti.biz/faq/sed-remove-m-and-line-feeds-under-unix-linux-bsd-appleosx/
## Layout ## Layout
All the font styling happens in the zine_maker function create_pages(). The All the font styling happens in the zine_maker function create_pages(). The input text is parsed for specific tags or symbols in the begining of each line and changes to the font color and size happen accordingly. We can add more or edit existing rules, directly in the zine_maker code.
input text is parsed for specific tags or symbols in the begining of each line
and changes to the font color and size happen accordingly. We can add more or edit
existing rules, directly in the zine_maker code.
## Parameters ## Parameters
The python scripts cover.py, colophon.py and doc_pdf.py take a text input and an output filename. If we give no input/output, the default input is the related readme files under covers/body/colophons/ The python scripts cover.py, colophon.py and doc_pdf.py take a text input and an output filename. If we give no input/output, the default input is the related readme files under 'covers/', 'body/', 'colophons/' folders.
## Merge ## Merge
For merging the cover, body and colophon pdf files, there are many pdf merger tools. One that is command line based and is used in this tutorial is pdfunite For merging the cover, body and colophon pdf files, there are many pdf merger tools. One that is command line based and is used in this tutorial is pdfunite (http://linux-commands-examples.com/pdfunite).
http://linux-commands-examples.com/pdfunite
## Print ## Print
For shuffling the final pdf and prepare it for printing you need the pdfseparate command For shuffling the final pdf and prepare it for printing you need the pdfseparate command (http://www.linux-commands-examples.com/pdfseparate).
http://www.linux-commands-examples.com/pdfseparate
it is used inside the shuffle_pdf.py file (see details at the end of this README). it is used inside the shuffle_pdf.py file (see details at the end of this README).
## Images ## Images
For making use of images in the script For making use of images in the script image magick needs to be installed (http://www.imagemagick.org/)
image magick needs to be installed
http://www.imagemagick.org/
# Run the code! # Run the code!
## Make the content of the pdf ## Make the content of the pdf
The default parameters included in the script would create a zine from this The default parameters included in the script would create a zine from this readme:
readme:
`python doc_pdf.py ` `python doc_pdf.py `
OR you can experiment with the other sample text found in this repository. OR you can experiment with the other sample text found in this repository under the 'text' folder.
`python doc_pdf.py text/images.txt body/images.pdf` `python doc_pdf.py text/images.txt body/images.pdf`
OR get real and add your own text file and replace respectively the input and OR get real and add your own text file and replace respectively the input and output filenames.
output filenames.
`python doc_pdf.py text/<your_file>.txt body/<output-name>.pdf` `python doc_pdf.py text/<your_file>.txt body/<output-name>.pdf`
@ -129,7 +116,7 @@ from the terminal run:
You shall substitute the file paths to your own corresponding /path/filenames You shall substitute the file paths to your own corresponding /path/filenames
## See this readme as the generated screen version zine: ## See this readme as a zine:
open the file zines/zinemaker.pdf open the file zines/zinemaker.pdf
# Make a zine # Make a zine
@ -138,11 +125,33 @@ open the file zines/zinemaker.pdf
<img>./thumbs/printer_settings.png<img> <img>./thumbs/printer_settings.png<img>
Default parameters: as input "zines/zinemaker_screen.pdf" and as output "zinemaker{random_number}.pdf" The script shuffle.py creates signatures for printing and folding the A4 in two, to create a zine. Default parameters: as input "zines/zinemaker_screen.pdf" and as output "zinemaker{random_number}.pdf"
Run it for your own pdf files as following: Run it for your own pdf files as following:
`python shuffle_pdf.py` zines/<input_file>.pdf zines/<output_file>.pdf` `python shuffle_pdf.py` zines/<input_file>.pdf zines/<output_file>.pdf`
In the printer settings opt-in for the following settings: Note: your input file needs to have an even number of pages, divisible by 4, which is the number of pages needed for one signature. We can add blank pages in the begining and end of the body pdf file we created before if we need to make the total page number divisible by 4.
In the printer settings opt-in for the following:
- A4 Landscape - A4 Landscape
- Two pages per side - Two pages per side
- Double side - short edge - Double side - short edge
# References
code repository:
https://git.systerserver.net/mara/zine_maker
install python:
https://www.python.org/downloads/
install pip:
https://pip.pypa.io/en/stable/installation/
clean the text file for parsing:
https://www.cyberciti.biz/faq/sed-remove-m-and-line-feeds-under-unix-linux-bsd-appleosx/
merge and split pdf files:
http://linux-commands-examples.com/pdfunite
http://www.linux-commands-examples.com/pdfseparate
process images:
http://www.imagemagick.org/