Skip to content

Instantly share code, notes, and snippets.

@go4Mor4
Last active June 5, 2020 18:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save go4Mor4/a24f23930454500accf4a95379fe9a83 to your computer and use it in GitHub Desktop.
Save go4Mor4/a24f23930454500accf4a95379fe9a83 to your computer and use it in GitHub Desktop.
def generate_pdf(PATH, nome_pdf):
images, list_images = [name for name in os.listdir(PATH) if name.endswith('.png')], []
for i in images:
image = Image.open(PATH+i)
list_images.append(image)
list_images[0].save(rf'{PATH}{nome_pdf}', save_all=True, append_images=list_images[1:])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment