Skip to content

Added support to print multiple labels at once#2

Open
Zontex wants to merge 2 commits intoabrasive:mainfrom
OmnIoT:main
Open

Added support to print multiple labels at once#2
Zontex wants to merge 2 commits intoabrasive:mainfrom
OmnIoT:main

Conversation

@Zontex
Copy link
Copy Markdown

@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
Copy Markdown
Author

Zontex commented Mar 2, 2022

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

@alpharesearch
Copy link
Copy Markdown

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
Copy Markdown
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
Copy Markdown

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
Copy Markdown

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
Copy Markdown

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