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

Added support to print multiple labels at once #2

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Zontex
Copy link

@Zontex Zontex commented Mar 2, 2022

The PDF file will be broken into multiple files and printed one by one, with no effect on the printing speed when testing, stable.

@Zontex
Copy link
Author

Zontex commented Mar 2, 2022

@abrasive let me know if you can accept my pull request :)

@alpharesearch
Copy link

I added Zontex changes to the appsocket_print_server.py file and printing multiple pages works with CUPS now too.
https://github.com/alpharesearch/pdf2tspl/blob/main/appsocket_print_server.py
I had to change the temp folder to the system /tmp directory. I guess the hard-coded temp stuff needs some reworking. But my python knowledge is very basic and I couldn't figure out how to use tempfile and PdfFileWriter together.

@Zontex
Copy link
Author

Zontex commented Mar 4, 2022

I had to change the temp folder to the system /tmp directory. I guess the hard-coded temp stuff needs some reworking. But my python knowledge is very basic and I couldn't figure out how to use tempfile and PdfFileWriter together.

probably once the printing is finished we should delete the temp files, that should be a good practice.
@AlphaSearch could you please open pull request on my fork with the changes you made so I could merge it?

@alpharesearch
Copy link

alpharesearch commented Mar 6, 2022

I had to change the temp folder to the system /tmp directory. I guess the hard-coded temp stuff needs some reworking. But my python knowledge is very basic and I couldn't figure out how to use tempfile and PdfFileWriter together.

probably once the printing is finished we should delete the temp files, that should be a good practice. @AlphaSearch could you please open pull request on my fork with the changes you made so I could merge it?

I have no idea how to do this. But I just added your additions and tweak it slightly. The tempfile class looks like it would manage all the temporary files by it self. The original author did use it in his code too.

@tripp396
Copy link

When I added @Zontex code, it complained that many functions were deprecated because I think PyPDF2 is at a newer version. I went through and updated everything it complained about and now I have this working. Unsure how to properly contribute. When I tried to add the code block in this comment the other apostrophes in the code caused issues. Attaching a txt file of the code. Let me know if there is a better way

new code.txt

@tripp396
Copy link

To add I haven't gone through @alpharesearch app socket code to confirm this also works there...

deprecation update
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.

3 participants