pdf generation - FPDF produces empty pages in Python -


i wrote python script produce pdfs based on folders jpegs. nothing fancy:

import os fpdf import fpdf  folders = [ ... here numbers - folders numbered ... ]  folder in folders:     pdf = fpdf()             fil in os.scandir("parent folder" + str(folder) + "/"):         pdf.add_page()         pdf.image(fil.path, w=210, h=297)     pdf.output("target location/" + str(folder) + ".pdf", "f") 

this code results in pdf having every other page blank. interestingly enough code:

import os fpdf import fpdf  folders = [ ... here numbers - folders numbered ... ]  folder in folders:     pdf = fpdf()             pdf.add_page()     fil in os.scandir("parent folder" + str(folder) + "/"):         pdf.image(fil.path, w=210, h=297)     pdf.output("target location/" + str(folder) + ".pdf", "f") 

produces file empty first page , rest correct.

i don't see obvious fix - looks bit fpdf library. or not?


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -