README.md 5.64 KB
Newer Older
Mara Karagianni's avatar
Mara Karagianni committed
1
# Introduction
Mara Karagianni's avatar
Mara Karagianni committed
2

Mara Karagianni's avatar
Mara Karagianni committed
3
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.   
Mara Karagianni's avatar
Mara Karagianni committed
4

Mara Karagianni's avatar
Mara Karagianni committed
5
# Get the code
Mara Karagianni's avatar
Mara Karagianni committed
6

Mara Karagianni's avatar
Mara Karagianni committed
7
## Download the source code
Mara Karagianni's avatar
Mara Karagianni committed
8
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. 
Mara Karagianni's avatar
Mara Karagianni committed
9
10
11
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:
```
Mara Karagianni's avatar
Mara Karagianni committed
12
13
tar -xvf zine_maker.tar -C /home/user/destination  
unzip zinme_maker.zip -d /home/user/destination 
Mara Karagianni's avatar
Mara Karagianni committed
14
```
Mara Karagianni's avatar
Mara Karagianni committed
15

Mara Karagianni's avatar
Mara Karagianni committed
16
## OR use git clone:
Mara Karagianni's avatar
Mara Karagianni committed
17
```
Mara Karagianni's avatar
Mara Karagianni committed
18
git clone https://maker:glpat-zHtx4dd5xgmdMHRGA-t6@git.systerserver.net/mara/zine_maker.git
Mara Karagianni's avatar
Mara Karagianni committed
19
cd zine_maker
Mara Karagianni's avatar
Mara Karagianni committed
20
21
```

Mara Karagianni's avatar
Mara Karagianni committed
22
# Requirements
Mara Karagianni's avatar
Mara Karagianni committed
23
24
25

Basic requirements are listed here. 
Python3 should be installed on the computer
Mara Karagianni's avatar
Mara Karagianni committed
26
https://www.python.org/downloads/
Mara Karagianni's avatar
Mara Karagianni committed
27

Mara Karagianni's avatar
Mara Karagianni committed
28
And also the pip command if it didn't get installed with Python
Mara Karagianni's avatar
Mara Karagianni committed
29
https://pip.pypa.io/en/stable/installation/ 
Mara Karagianni's avatar
Mara Karagianni committed
30

Mara Karagianni's avatar
Mara Karagianni committed
31
Once these are installed, from within zine_maker folder run:
Mara Karagianni's avatar
Mara Karagianni committed
32

Mara Karagianni's avatar
Mara Karagianni committed
33
`pip install -r requirements.txt`
Mara Karagianni's avatar
Mara Karagianni committed
34

Mara Karagianni's avatar
Mara Karagianni committed
35
# Miscellaneous
Mara Karagianni's avatar
Mara Karagianni committed
36

Mara Karagianni's avatar
Mara Karagianni committed
37
## Fonts
Mara Karagianni's avatar
Mara Karagianni committed
38
39
40
41
42
43
44
45
46
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.

## Text
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
with:
Mara Karagianni's avatar
Mara Karagianni committed
47
48
`cat --show-nonprinting input.txt`

Mara Karagianni's avatar
Mara Karagianni committed
49
50
51
Symbols 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:
Mara Karagianni's avatar
Mara Karagianni committed
52
53
`dos2unix filename`

Mara Karagianni's avatar
Mara Karagianni committed
54
Or with the sed command:
Mara Karagianni's avatar
Mara Karagianni committed
55
`sed -e "s/\r//g" file > newfile`
Mara Karagianni's avatar
Mara Karagianni committed
56
57
58
59

Extensive info can be find at:
https://www.cyberciti.biz/faq/sed-remove-m-and-line-feeds-under-unix-linux-bsd-appleosx/

Mara Karagianni's avatar
Mara Karagianni committed
60
## Layout
Mara Karagianni's avatar
Mara Karagianni committed
61
All the font styling happens in the zine_maker function create_pages(). The
Mara Karagianni's avatar
Mara Karagianni committed
62
63
64
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.
Mara Karagianni's avatar
Mara Karagianni committed
65

Mara Karagianni's avatar
Mara Karagianni committed
66
67
68
69
70
## 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/

## 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
Mara Karagianni's avatar
Mara Karagianni committed
71
http://linux-commands-examples.com/pdfunite
Mara Karagianni's avatar
Mara Karagianni committed
72

Mara Karagianni's avatar
Mara Karagianni committed
73
## Print
Mara Karagianni's avatar
Mara Karagianni committed
74
For shuffling the final pdf and prepare it for printing you need the pdfseparate command 
Mara Karagianni's avatar
Mara Karagianni committed
75
http://www.linux-commands-examples.com/pdfseparate
Mara Karagianni's avatar
Mara Karagianni committed
76
it is used inside the shuffle_pdf.py file (see details at the end of this README).
Mara Karagianni's avatar
Mara Karagianni committed
77

Mara Karagianni's avatar
Mara Karagianni committed
78
79
## Images 
For making use of images in the script 
Mara Karagianni's avatar
Mara Karagianni committed
80
image magick needs to be installed
Mara Karagianni's avatar
Mara Karagianni committed
81
82
http://www.imagemagick.org/

Mara Karagianni's avatar
Mara Karagianni committed
83
# Run the code!
Mara Karagianni's avatar
Mara Karagianni committed
84

Mara Karagianni's avatar
Mara Karagianni committed
85
86
87
## Make the content of the pdf 
The default parameters included in the script would create a zine from this
readme:
Mara Karagianni's avatar
Mara Karagianni committed
88
`python doc_pdf.py `
Mara Karagianni's avatar
Mara Karagianni committed
89

Mara Karagianni's avatar
Mara Karagianni committed
90
OR you can experiment with the other sample text found in this repository. 
Mara Karagianni's avatar
Mara Karagianni committed
91

Mara Karagianni's avatar
Mara Karagianni committed
92
`python doc_pdf.py text/images.txt body/images.pdf`
Mara Karagianni's avatar
Mara Karagianni committed
93

Mara Karagianni's avatar
Mara Karagianni committed
94
95
OR get real and add your own text file and replace respectively the input and
output filenames.
Mara Karagianni's avatar
Mara Karagianni committed
96

Mara Karagianni's avatar
Mara Karagianni committed
97
`python doc_pdf.py text/<your_file>.txt body/<output-name>.pdf`
Mara Karagianni's avatar
Mara Karagianni committed
98

Mara Karagianni's avatar
Mara Karagianni committed
99
100
## Make the cover of the pdf 
Same, the default parameters included in the script would create the cover for the zine_maker:
Mara Karagianni's avatar
Mara Karagianni committed
101
`python cover.py`
Mara Karagianni's avatar
Mara Karagianni committed
102

Mara Karagianni's avatar
Mara Karagianni committed
103
OR try-out the other cover samples: 
Mara Karagianni's avatar
Mara Karagianni committed
104

Mara Karagianni's avatar
Mara Karagianni committed
105
`python cover.py text/cover.txt covers/cover.pdf`
Mara Karagianni's avatar
Mara Karagianni committed
106

Mara Karagianni's avatar
Mara Karagianni committed
107
OR add your cover text file and replace respectively:
Mara Karagianni's avatar
Mara Karagianni committed
108

Mara Karagianni's avatar
Mara Karagianni committed
109
`python cover.py text/<your-cover>.txt covers/<cover-name>.pdf`
Mara Karagianni's avatar
Mara Karagianni committed
110

Mara Karagianni's avatar
Mara Karagianni committed
111
112
113
## Make the colophon of the pdf 
Same, the default parameters included in the script would create the colophon for the zine_maker:
`python colophon.py `
Mara Karagianni's avatar
Mara Karagianni committed
114

Mara Karagianni's avatar
Mara Karagianni committed
115
OR try-out the other colophon samples: 
Mara Karagianni's avatar
Mara Karagianni committed
116

Mara Karagianni's avatar
Mara Karagianni committed
117
`python colophon.py text/colophon.txt colophons/colophon.pdf`
Mara Karagianni's avatar
Mara Karagianni committed
118

Mara Karagianni's avatar
Mara Karagianni committed
119
OR add your own colophon text file and replace respectively:
Mara Karagianni's avatar
Mara Karagianni committed
120

Mara Karagianni's avatar
Mara Karagianni committed
121
`python colophon.py text/<your-colophon>.txt colophons/<output-colophon>.pdf`
Mara Karagianni's avatar
Mara Karagianni committed
122

Mara Karagianni's avatar
Mara Karagianni committed
123
# Make a screen PDF
Mara Karagianni's avatar
Mara Karagianni committed
124

Mara Karagianni's avatar
Mara Karagianni committed
125
## For the final screen version
126
127
from the terminal run:

Mara Karagianni's avatar
Mara Karagianni committed
128
`pdfunite covers/cover.pdf body/body.pdf colophons/colophon.pdf zines/final.pdf`
129

130
You shall substitute the file paths to your own corresponding /path/filenames 
Mara Karagianni's avatar
Mara Karagianni committed
131

Mara Karagianni's avatar
Mara Karagianni committed
132
133
134
135
## See this readme as the generated screen version zine:
open the file zines/zinemaker.pdf

# Make a zine
Mara Karagianni's avatar
Mara Karagianni committed
136

Mara Karagianni's avatar
Mara Karagianni committed
137
## Prepare signatures for printing
Mara Karagianni's avatar
Mara Karagianni committed
138

Mara Karagianni's avatar
Mara Karagianni committed
139
140
141
<img>./thumbs/printer_settings.png<img>

Default parameters: as input "zines/zinemaker_screen.pdf" and as output "zinemaker{random_number}.pdf" 
Mara Karagianni's avatar
Mara Karagianni committed
142
Run it for your own pdf files as following:
143
`python shuffle_pdf.py` <input_file>.pdf <output_file>.pdf`
Mara Karagianni's avatar
Mara Karagianni committed
144
145
146
147
148

In the printer settings opt-in for the following settings:
- A4 Landscape
- Two pages per side
- Double side - short edge