Comments (7)
Sorry for silence. I am on vacation
пятница, 3 июля 2015 г. пользователь michaelweghorn написал:
Currently, Boomaga does not support sending multiple files in one print
job. Only the first file of the print job is taken into account by Boomaga.Example command for printing multiple files in one print job on the
command line:
lp -d Boomaga first.pdf second.pdfOnly "first.pdf" is taken into account by Boomaga (is added to the
"Jobs"), not "second.pdf".It would be great if Boomaga could support sending several files in one
print job.I have tested this with Debian Jessie and a current build of Boomaga's
master branch (commit a3e0347
a3e0347
).In the real use case, the files are not sent to the printer on the command
line but created by LibreOffice's mail merge (form letter) feature and sent
to the printer by LibreOffice as one print job.—
Reply to this email directly or view it on GitHub
#29.
Best regards,
Alexander.
from boomaga.
I use a (http://www.cups.org/documentation.php/doc-2.1/api-filter.html)[file backend] for CUPS (only this backend does not require a daemon). Unfortunately, the file backend does not support multiple files in a single job. So I can't do it just now.
I opened a bug, I hope they will add this feature https://www.cups.org/str.php?L4710
from boomaga.
I further examined this.
It seems like the backend actually does get all of the files, but as multiple PDF files simply concatenated each after the other (not as a real PDF file with two pages).
You can see that when directly using the "file" backend to save to a file that which would otherwise be passed to the backend.
To do so:
- Create two input files:
echo first > /tmp/first; echo second > /tmp/second
- Set
FileDevice Yes
in /etc/cups/cups-files.conf - Set up a print queue that simply writes everything it gets into a file:
sudo lpadmin -p tofile-printer -v file:/var/spool/cups/tofile-printer -E -P boomaga.ppd
- Print both files in a single print job:
lp -d tofile-printer /tmp/first /tmp/second
The file /var/spool/cups/tofile-printer
is created. When opening it with a text editor (e.g. vim), one can see that it consists of two single PDF file, whose content is simply concatenated:
%PDF-1.3
[further content of first PDF file]
%%EOF
%PDF-1.3
[further content of second PDF file]
%%EOF
If the backend handles this appropriately, it should be possible to extract the single PDF files again.
I wrote small test CUPS backend in Python to demonstrate what I mean s. attachment). This backend first extracts the single PDF files and then uses pdftk
to create a single PDF file out of them.
In order to run it, the tool pdftk
needs to be installed. (On Debian jessie, it is contained in the package pdftk
).
To use it:
- replace the value of
BASEPATH
at the top of the script with a path to a directory that CUPS may write to; possibly create it beforehand
(the value currently given should probably work; depending on the system, something in $HOME or /tmp may also work) - run the following commands:
sudo cp multipdf.py /usr/lib/cups/backend/multipdf # creates the CUPS backend
sudo chmod 700 /usr/lib/cups/backend/multipdf
echo first > /tmp/first; echo second > /tmp/second
sudo lpadmin -p test-multi-input -v multipdf:/ -E -P boomaga.ppd # set up print queue
lp -d test-multi-input /tmp/first /tmp/second # print files
This creates the file /var/spool/cups/result.pdf
. When opening the file, one can see that it is a PDF file with two pages, namely the content of the two input files.
I think that by doing a more or less similar thing in boomaga, it might also be possible to handle multiple input files there (extract the single files, add them).
from boomaga.
Here is the test backend. I renamed the file to "multipdf.txt" because uploading Python scripts with the correct file suffix ".py" does not seem to be allowed/supported by GitHub.
multipdf.txt
from boomaga.
You are right. I've long wanted to rewrite the backend to C++, it looks lake a good occasion.
from boomaga.
I wrote new CPP backend. Now command
for i in {1..9}; do echo "Document # $i" > $i.txt; done lp *.txt
works fine
You can test it from cpp_backend branch (git clone https://github.com/Boomaga/boomaga.git --branch cpp_backend)
But pay attention that lp first.pdf second.pdf
does not work, CUPS transfer only the first document. It seems that concatenating is a hack or bug, and it may stop working in the future.
Maybe will be better for you to write wrapper for lp command ?
from boomaga.
Thank you so much for the implementation!
I can reproduce the behaviour you described on Debian jessie.
The problem with the PDF files seems to be a bug in CUPS.
Further details are described in the following bug reports (which refer to each other):
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=793989
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=771259
https://www.cups.org/str.php?L4430
My comment in the first mentioned bug (Debian #793989) is also true for the problem with the PDF files you described:
"I just rebuilt the CUPS packages
currently in Jessie (version 1.7.5-11+deb8u1) with the patch attached to
#771259 and the problem does not occur with this modified version."
The upstream bug for CUPS (last hyperlink) has not yet been resolved.
Therefore, this needs to be resolved in CUPS and nothing is to be done on the side of Boomaga.
from boomaga.
Related Issues (20)
- Failure to duplex under Linux MInt 20
- Error when printing from Okular HOT 3
- Print A5 format for diary with ring bond HOT 1
- Print from Only Office HOT 1
- Can not start gs Converter: GPL Ghostscript 9.55.0 HOT 1
- Printing on DIN A3
- [Boomaga backend] ERROR: Can\'t change mode on directory /var/cache/boomaga: Permission denied HOT 14
- Sheet layout for stapling HOT 1
- State of the project? HOT 2
- "Print in reverse order" has no effect
- Cant get UID for user...
- ownership of dirs in /var/cache/boomaga
- 2 Mistakes that make my life unnecessarily difficult.
- remove the white borders of the pages
- Printer drivers are deprecated HOT 2
- suggestion to add crop options
- boomaga is not working when I use flatpak application (wps-office)
- "Sub-Booklet" option only breaks the end of the booklet.
- File .cboo can't read
- ERROR: Can't start boomaga gui.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from boomaga.