diff --git a/README.md b/README.md index 57765c6..f5246cf 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # 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 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. # Get the code diff --git a/body/readme.pdf b/body/readme.pdf index 8b72e5c..5996c6b 100644 Binary files a/body/readme.pdf and b/body/readme.pdf differ diff --git a/colophons/colophon_readme.pdf b/colophons/colophon_readme.pdf index cc44dfc..8776851 100644 Binary files a/colophons/colophon_readme.pdf and b/colophons/colophon_readme.pdf differ diff --git a/doc_pdf.py b/doc_pdf.py index 2a101bf..7585730 100644 --- a/doc_pdf.py +++ b/doc_pdf.py @@ -13,7 +13,7 @@ def make(inputfile, output): max_height = 190 cell_width = 110 - cell_header_height = 26 + cell_header_height = 22 cell_height = 8 # set font for all text diff --git a/shuffle_pdf.py b/shuffle_pdf.py index da5c864..21d57e1 100644 --- a/shuffle_pdf.py +++ b/shuffle_pdf.py @@ -28,6 +28,7 @@ def shuffle_zine(finput, foutput): else: print("PDF saved as {}".format(foutput)) os.system("mv ./*_chapter.pdf ./.tmp") + os.system("rm ./.tmp/*_chapter.pdf") if __name__ == '__main__': diff --git a/zine_maker.py b/zine_maker.py index d300f56..6e19871 100644 --- a/zine_maker.py +++ b/zine_maker.py @@ -121,7 +121,9 @@ class Zine(FPDF): # check if we have a title elif line.startswith("

"): line = re.sub('((

)|(

$))', '', line) - self.set_text_color(130, 50, 250) + purple_shades = random.randrange(100, 180, 20) + #self.set_text_color(130, 50, 250) + self.set_text_color(purple_shades, 0, 200) self.set_font(header_font, size=22) if self.get_y() > top_margin: self.set_xy(left_margin, top_margin+9) @@ -130,9 +132,9 @@ class Zine(FPDF): 0, ln=1, align='C') left_x = self.get_x() top_y = self.get_y() - self.dashed_line( - left_x, top_y, left_x+cell_width, top_y, - dash_length=3, space_length=3) + # self.dashed_line( + # left_x, top_y, left_x+cell_width, top_y, + # dash_length=3, space_length=3) self.set_text_color(0, 0, 0) self.set_font(text_font, size=text_font_size) @@ -145,8 +147,10 @@ class Zine(FPDF): elif line.startswith(""): line = re.sub('(()|($))', '', line) - self.set_font('helvetica', 'B', size=13) - self.cell(cell_width, cell_height, line, + font_size = 14 + self.set_font(header_font, '', font_size) + bold_header_height = font_size + self.cell(cell_width, bold_header_height, line, 0, ln=1, align='C') self.set_font(text_font, '', size=text_font_size) @@ -155,9 +159,10 @@ class Zine(FPDF): self.set_xy(left_margin, top_margin+9) self.add_page() self.set_font(header_font, size=25) - self.set_text_color(255, 0, 0) - self.multi_cell(cell_width, cell_height, line, - 0, align='L') + pink_shades = random.randrange(60, 150, 20) + self.set_text_color(255, pink_shades, pink_shades) + self.cell(cell_width, cell_header_height, line, + 0, ln=1, align='L') # go back to text font self.set_text_color(0, 0, 0) self.set_font(text_font, '', size=text_font_size) @@ -165,12 +170,13 @@ class Zine(FPDF): elif line.startswith("##"): line = re.sub('()', '', line) subheader_font = "helvetica" + cell_subheader_height = 10 + #gray_shades = random.randrange(0, 256, 60) self.set_font(subheader_font, size=18) self.set_text_color(0, 0, 0) - self.multi_cell(cell_width, cell_height, line, + self.multi_cell(cell_width, cell_subheader_height, line, 0, align='L') # go back to text font - self.set_text_color(0, 0, 0) self.set_font(text_font, '', size=text_font_size) elif line.startswith("`") or line.startswith("```"): @@ -199,7 +205,7 @@ class Zine(FPDF): elif line.startswith(""): line = re.sub('($)', '', line) self.set_font(text_font, '', size=13) - self.set_text_color(0, 80, 115) + self.set_text_color(150, 0, 205) self.multi_cell(cell_width, cell_height, line, 0, align='C') elif line.startswith(""): @@ -275,7 +281,7 @@ class Zine(FPDF): # close the file title.close() - self.set_text_color(0, 0, 0, 0) + self.set_text_color(0, 0, 0) def colophon(self, text, colophon_font): f = open(text, 'r') @@ -296,7 +302,7 @@ class Zine(FPDF): text_font = 'Helvetica' # Go to 1.5 cm from bottom self.set_y(-12) - # self.set_text_color(0, 0, 0) + self.set_text_color(0, 0, 0) self.set_font(text_font, '', size=7) # Print current page number # self.cell(0, 7, '%s' % self.page_no(), 0, 0, 'C')