diff --git a/latest_trial.pdf b/latest_trial.pdf
index db31693..07b9965 100644
Binary files a/latest_trial.pdf and b/latest_trial.pdf differ
diff --git a/make_zine.py b/make_zine.py
index 2bff410..5a8a995 100644
--- a/make_zine.py
+++ b/make_zine.py
@@ -2,7 +2,7 @@ from fpdf import FPDF
"""
A script for generating A5 size pdf zines
with a text-file input, under development,
-GPL3 Licence, Mara Karagianni 22 March 2021
+GPL3 Licence, Mara Karagianni March 2021
"""
# Variables
diff --git a/make_zine3.py b/make_zine3.py
index 9a7821f..3c3aa0e 100644
--- a/make_zine3.py
+++ b/make_zine3.py
@@ -2,7 +2,7 @@ from fpdf import FPDF
"""
A script for generating A5 size pdf zines
with a text-file input, under development,
-GPL3 Licence, Mara Karagianni 22 March 2021
+GPL3 Licence, Mara Karagianni April 2021
"""
# Variables
@@ -41,19 +41,34 @@ class Zine(FPDF):
self.set_xy(left_margin, top_margin)
print('NEW SIGNATURE')
- def move_to_page_right(self, top_margin, left_max_margin=160, right_margin=20):
+ def move_to_page_right(self, top_margin, left_max_margin, right_margin):
print('*****')
print("BOTTOM OF PAGE, height is {}".format(self.get_y()))
print('*****')
self.set_margins(top_margin, left_max_margin, right_margin)
self.set_xy(left_max_margin, top_margin)
- print("inside move_to_page_righ function, X IS {}".format(self.get_x()))
- def position_img(self, img_filename, img_x, img_y, img_len):
- self.image(img_filename, img_x, img_y, img_len)
+ def position_img(self, img_filename, img_x, img_y):
+ import subprocess
+ img_size = subprocess.run(
+ ["identify", "-format",
+ "%[fx:w/72] by %[fx:h/72] inches",
+ "./%s" % img_filename],
+ stdout=subprocess.PIPE, text=True)
+
+ img_height_inches = img_size.stdout.split(' ')[2]
+ img_width_inches = img_size.stdout.split(' ')[0]
+ img_height_mm = float(img_height_inches) * float(24.5)
+ img_width_mm = float(img_width_inches) * float(24.5)
+
+ previous_y = self.get_y()
+ self.image(img_filename, img_x, img_y, img_width_mm)
+ # use identify to get the image height and move page height
+ # to bottom of the image
+ self.set_xy(self.get_x(), previous_y+img_height_mm)
def create_pages(self, filename, max_height, left_margin,
- left_max_margin, img_len, top_margin, right_margin,
+ left_max_margin, top_margin, right_margin,
cell_width, cell_height):
index = 0
text = open(filename).readlines()
@@ -65,27 +80,7 @@ class Zine(FPDF):
# check if we have an image
if "
" in line:
img_filename = line.split("
")[1]
-
- import subprocess
- img_size = subprocess.run(
- ["identify", "-format",
- "%[fx:w/72] by %[fx:h/72] inches",
- "./%s" % img_filename],
- stdout=subprocess.PIPE, text=True)
-
- img_height_inches = img_size.stdout.split(' ')[2]
- img_width_inches = img_size.stdout.split(' ')[0]
- img_height_mm = float(img_height_inches) * float(24.5)
- img_width_mm = float(img_width_inches) * float(24.5)
-
- previous_y = self.get_y()
- self.position_img(img_filename,
- self.get_x(), self.get_y(), img_width_mm)
- #self.get_x(), self.get_y(), img_width_mm)
-
- # use identify to get the image height and move page height
- # to bottom of the image
- self.set_xy(self.get_x(), previous_y+img_height_mm)
+ self.position_img(img_filename, self.get_x(), self.get_y())
# Ommit the image line from writing it as text input
index += 1
@@ -126,7 +121,7 @@ title = 'Python Mailman Migrations'
zine.set_font(text_font, size=text_font_size)
-zine.create_pages(filename, max_height, left_margin, left_max_margin, img_len,
+zine.create_pages(filename, max_height, left_margin, left_max_margin,
top_margin, right_margin, cell_width, cell_height)
zine.output('latest_trial.pdf')