Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: added tile command to cli #35

Closed

Conversation

stanislavulrych
Copy link

Added tile command, which can be used for tiling multiple stickers for printing in sticker papers.

pdfly/tiles.py Outdated

"""

# Stanislav Ulrych <[email protected]>.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't add such comments

pdfly/tiles.py Outdated
ysize = PaperSize.A4.height

writer = PdfWriter()
destPage = writer.add_blank_page(width=xsize, height=ysize)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please follow PEP-8:

Suggested change
destPage = writer.add_blank_page(width=xsize, height=ysize)
dest_page = writer.add_blank_page(width=xsize, height=ysize)

pdfly/tiles.py Outdated
sys.exit(1)
finally:
output_fh.close()
# In 3.0, input files must stay open until output is written.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't that true for Python 2.x as well ... and any programming language for that matter?

Suggested change
# In 3.0, input files must stay open until output is written.

pdfly/tiles.py Outdated
"tx": (i % xcount)*(xsize/xcount),
"ty": -(i // xcount)*(ysize/ycount)
}
print(t)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
print(t)

@MartinThoma
Copy link
Member

Especially useful when layouting on A4 printable sticker paper.

Can you share an example input / output here in the comments?

@stanislavulrych
Copy link
Author

Comments addressed.

pdfly tiles -o ./out.pdf ./in.pdf - ./in.pdf ./in.pdf

out.pdf
in.pdf

@stanislavulrych stanislavulrych deleted the feat/added-tile-command branch November 14, 2023 12:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants