Skip to content

Commit

Permalink
Use a cups PDF Filter to directly send PDF to the backend (manual pro…
Browse files Browse the repository at this point in the history
…cess of covnersion from PS to PDF no longer needed).
  • Loading branch information
stuartcaunt committed Jan 4, 2024
1 parent 26c3c7b commit 0c0fc23
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 19 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

The VISA CUPS Driver is used to send print requests to the host computer of a VISA user.

The driver converts the printable document from Postscript to PDF and then requests a local [VISA Print Server](https://github.com/ILLGrenoble/visa-print-server) to send the PDF data via a websocket to the VISA client.
The PPD (Postscript Printer Driver) configuration requests a PDF filter to generate PDF data. The PDF data is then sent to the backend that requests a local [VISA Print Server](https://github.com/ILLGrenoble/visa-print-server) to send the PDF data via a websocket to the VISA client.

The [VISA Print Client](https://github.com/ILLGrenoble/visa-print-client), an angular module integrated into the [VISA front end](https://github.com/ILLGrenoble/visa-web) receives the PDF data and informs the user/opens a print dialog.

Expand Down
2 changes: 1 addition & 1 deletion install.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

apt install cups texlive-font-utils curl
apt install cups curl

cp visa.ppd /usr/share/cups/model/visa.ppd

Expand Down
19 changes: 4 additions & 15 deletions visa
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,11 @@ if [ -z "$CLOUD_INSTANCE_ID" ]; then
fi

if [ $# -eq 6 ]; then
EPSFILE=$6
PDFFILE=$6
else
EPSFILE=$(mktemp </dev/null /tmp/visa-printer.XXXXXX) ||
PDFFILE=$(mktemp </dev/null /tmp/visa-printer.XXXXXX) ||
(echo "ERROR:Failed to create temporary file" 1>&2; exit 1)
cat > $EPSFILE
fi

PDFFILE=$EPSFILE.pdf

EPSTOPDF_STATUS=$(/usr/bin/epstopdf $EPSFILE -o $PDFFILE 2>&1)
EPSTOPDF_RC=$?

if [ $EPSTOPDF_RC -ne 0 ]; then
echo "ERROR:Converting to PDF failed: $EPSTOPDF_STATUS" 1>&2
exit $EPSTOPDF_RC
cat > $PDFFILE
fi

chmod a+r $PDFFILE
Expand All @@ -43,9 +33,8 @@ if [[ $VISA_PRINT_STATUS != "ok" ]]; then
exit $VISA_PRINT_RC
fi

rm -f $PDFFILE
if [ $# -lt 6 ];then
rm -f $EPSFILE
rm -f $PDFFILE
fi

exit 0
3 changes: 1 addition & 2 deletions visa.ppd
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@
*Manufacturer: "ILL"
*Product: "(visa)"
*cupsFax: False
*cupsFilter: "application/vnd.cups-postscript 0 -"
*cupsFilter: "application/vnd.cups-pdf 0 -"
*cupsVersion: 1.1
*cupsManualCopies: True
*ModelName: "VISA printer"
*ShortNickName: "VISA printer"
*NickName: "VISA printer"
*PSVersion: "(3010.000) 550"
*LanguageLevel: "3"
*ColorDevice: True
*FaxSupport: False
Expand Down

0 comments on commit 0c0fc23

Please sign in to comment.