Permalink
Browse files

Added pdfjam dependency to rotate pdfs

  • Loading branch information...
simoncadman committed Oct 6, 2013
1 parent fc27412 commit d6beac3c9d76a693e017b5f1ca4e1dd372a3557e
View
@@ -20,7 +20,7 @@
if len(sys.argv) == 2 and sys.argv[1] == 'version':
# line below is replaced on commit
- CCPVersion = "20131006 165226"
+ CCPVersion = "20131006 200957"
print "CUPS Cloud Print CUPS Backend Version " + CCPVersion
sys.exit(0)
View
@@ -20,7 +20,7 @@
if len(sys.argv) == 2 and sys.argv[1] == 'version':
# line below is replaced on commit
- CCPVersion = "20131006 165226"
+ CCPVersion = "20131006 200957"
print "CUPS Cloud Print Delete Account Script Version " + CCPVersion
sys.exit(0)
View
@@ -19,7 +19,7 @@
if len(sys.argv) == 2 and sys.argv[1] == 'version':
# line below is replaced on commit
- CCPVersion = "20131006 165226"
+ CCPVersion = "20131006 200957"
print "CUPS Cloud Print Dynamic PPD Generator Version " + CCPVersion
sys.exit(0)
View
@@ -21,7 +21,7 @@
if len(sys.argv) == 2 and sys.argv[1] == 'version':
# line below is replaced on commit
- CCPVersion = "20131006 165226"
+ CCPVersion = "20131006 200957"
print "CUPS Cloud Print Printer Lister Version " + CCPVersion
sys.exit(0)
View
@@ -6,7 +6,7 @@ pkgdesc="Print via Google Cloud print using CUPS"
arch=('any')
url="http://ccp.niftiestsoftware.com"
license=('GPL3')
-depends=('cups' 'pycups' 'python2' 'ghostscript' 'python2-httplib2')
+depends=('cups' 'pycups' 'python2' 'ghostscript' 'python2-httplib2' 'texlive-core')
makedepends=('git')
changelog=ChangeLog
install=INSTALL
View
@@ -10,7 +10,7 @@ Vcs-Browser: https://github.com/simoncadman/CUPS-Cloud-Print
Package: cupscloudprint
Architecture: all
-Depends: cups, python-cups, python-httplib2
+Depends: cups, python-cups, python-httplib2, pdfjam
Description: Print via Google Cloud print using CUPS
Print via Google Cloud print using CUPS, useful when you need to print via a printer which does not have Linux support, but does support Google Cloud Print.
@@ -9,6 +9,7 @@ COMMENT= Google Cloud Print driver for CUPS
RUN_DEPENDS= cups:${PORTSDIR}/print/cups\
ps2pdf:${PORTSDIR}/print/ghostscript9-nox11\
+ pdfjam:${PORTSDIR}/print/pdfjam\
${PYTHON_SITELIBDIR}/cups.so:${PORTSDIR}/print/py-cups\
${PYTHON_SITELIBDIR}/httplib2:${PORTSDIR}/www/py-httplib2
@@ -17,7 +17,8 @@ RDEPEND="!net-print/cups-cloudprint
net-print/cups
app-text/ghostscript-gpl
dev-python/pycups
-dev-python/httplib2"
+dev-python/httplib2
+app-text/pdfjam"
S=${WORKDIR}/${P}
src_install() {
@@ -8,7 +8,7 @@ URL: http://ccp.niftiestsoftware.com
Source0: http://ccp.niftiestsoftware.com/cupscloudprint-20130914.tar.bz2
BuildRequires: cups-devel,cups,make,python-httplib2
-Requires: cups,ghostscript,system-config-printer-libs,python-httplib2
+Requires: cups,ghostscript,system-config-printer-libs,python-httplib2,pdfjam
%description
Google Cloud Print driver for CUPS, allows printing to printers hosted on Google Cloud Print.
View
@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-import json, urllib, os, mimetypes, base64, mimetools, re, hashlib
+import json, urllib, os, mimetypes, base64, mimetools, re, hashlib, subprocess
from auth import Auth
from urlparse import urlparse
@@ -376,12 +376,22 @@ def submitJob(self, printerid, jobtype, jobfile, jobname, printername, options="
# nolandscape - already rotates
if optiontext == 'nolandscape':
# rotate back
- rotate = -90
+ rotate = 270
if jobtype == 'pdf':
if not os.path.exists(jobfile):
- print("ERROR: PDF doesnt exist")
- return False
+ print("ERROR: PDF doesnt exist")
+ return False
+ if rotate > 0:
+ p = subprocess.Popen(['pdf' + str(rotate), jobfile, '--outfile', jobfile], stdout=subprocess.PIPE)
+ output = p.communicate()[0]
+ result = p.returncode
+ if result != 0:
+ print("ERROR: Failed to rotate PDF")
+ return False
+ if not os.path.exists(jobfile):
+ print("ERROR: PDF doesnt exist")
+ return False
b64file = self.base64Encode(jobfile)
if b64file == None: # pragma: no cover
print("ERROR: Cannot write to file: " + b64file)
View
@@ -19,7 +19,7 @@
if len(sys.argv) == 2 and sys.argv[1] == 'version':
# line below is replaced on commit
- CCPVersion = "20131006 165226"
+ CCPVersion = "20131006 200957"
print "CUPS Cloud Print Issue Reporting Script Version " + CCPVersion
sys.exit(0)
View
@@ -21,7 +21,7 @@
if len(sys.argv) == 2 and sys.argv[1] == 'version':
# line below is replaced on commit
- CCPVersion = "20131006 165226"
+ CCPVersion = "20131006 200957"
print "CUPS Cloud Print Setup Script Version " + CCPVersion
sys.exit(0)
View
@@ -21,7 +21,7 @@
if len(sys.argv) == 2 and sys.argv[1] == 'version':
# line below is replaced on commit
- CCPVersion = "20131006 165226"
+ CCPVersion = "20131006 200957"
print "CUPS Cloud Print Submit Job Version " + CCPVersion
sys.exit(0)
View
@@ -22,7 +22,7 @@
if len(sys.argv) == 2 and sys.argv[1] == 'version':
# line below is replaced on commit
- CCPVersion = "20131006 165226"
+ CCPVersion = "20131006 200957"
print "CUPS Cloud Print Upgrade Script Version " + CCPVersion
sys.exit(0)

0 comments on commit d6beac3

Please sign in to comment.