忍者ブログ
  • 2024.02«
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • » 2024.04
UbuntuでCUPSを用いて自動命名印刷
CUPSのいつもの設定

■/etc/cups/cupsd.conf
...
# Restrict access to the admin pages...
<Location /admin>
  Require user @SYSTEM
  Order allow,deny
</Location>
...

■cups-pdfのインストール
sudo apt install cups-pdf

■/etc/cups/cups-pdf.conf
...
### Key: Out (config)
##  CUPS-PDF output directory 
##  special qualifiers: 
##     ${HOME} will be expanded to the user's home directory
##     ${USER} will be expanded to the user name
##  in case it is an NFS export make sure it is exported without
##  root_squash!
##  on Ubuntu, the cupsd AppArmor profile needs to be updated
##  to match the output path as per instructions in LP:147551
### Default: /var/spool/cups-pdf/${USER}

Out${HOME}
...
 ### Key: GSCall (config)
 ## command line for calling GhostScript (!!! DO NOT USE NEWLINES !!!)
 ## MacOSX: for using pstopdf set this to %s %s -o %s %s
 ### Default: %s -q -dCompatibilityLevel=%s -dNOPAUSE -dBATCH -dSAFER -sDEVICE=pdfwrite -sOutputFile="%s" -dAutoRotatePages=/PageByPage -dAutoFilterColorImages=false -dColorImageFilter=/FlateEncode -dPDFSETTINGS=/prepress -c .setpdfwrite -f %s 
GSCall /usr/local/bin/cups-pdf-common %s %s "%s" %s 
 ...

■/usr/local/bin/cups-pdf-common
#!/bin/bash
export MY_GS=$1
export MY_VER=$2
HOME=$(dirname "$3")
USER=$(basename ${HOME})
export MY_IN=$4
export MY_OUT=$(basename "$3")

execpath=~/bin/cups-pdf
if [ -f ${execpath} ]
then
	${execpath}
fi

■~/bin/cups-pdf
#!/bin/bash

#Ps2PDF
${MY_GS} -q -dCompatibilityLevel=${MY_VER} -dNOPAUSE -dBATCH -dSAFER -sDEVICE=pdfwrite -sOutputFile="${HOME}/PDF/$(date +%Y%m%d_%H%M%S.%N)_${MY_OUT}" -dAutoRotatePages=/PageByPage -dAutoFilterColorImages=false -dColorImageFilter=/FlateEncode -dPDFSETTINGS=/prepress -c .setpdfwrite -f ${MY_IN}

拍手[0回]

PR
【2018/12/17 00:01 】 | Ubuntu | 有り難いご意見(0)
<<TSURUGIを入れてみた | ホーム | GRUB2をカスタマイズ>>
有り難いご意見
貴重なご意見の投稿















前ページ | ホーム | 次ページ

忍者ブログ [PR]