GithubHelp home page GithubHelp logo

guozht / cups-pdf-to-pdf Goto Github PK

View Code? Open in Web Editor NEW

This project forked from alexivkin/cups-pdf-to-pdf

0.0 0.0 0.0 31 KB

CUPS-PDF with a patch to print text correctly

License: GNU General Public License v2.0

C 100.00%

cups-pdf-to-pdf's Introduction

CUPS-PDF v3 with text print support

This is a cups-pdf v3.0.1 with a patch to allow printing text as text, not as images. This issue is also known as "cups-pdf not embedding text", or "producing large PDFs with text that can not be searched"

This is fix is achieved by adding PDF passthrough functionality, so incoming PDFs remain PDFs, instead of being converted from PDF to PostScript, then back to PDF. Why is this fix not in the original code? The author had different goals for CUPS-PDF in mind, refusing to fix it.

How is this better than a Save-as-PDF or Print-as-file functionality in many GTK/QT interfaces?

  1. You can do post-processing, for example choose pdf filename and saving location in a standard file save dialog, and automatically open generated PDF.
  2. Use PDF printing from non GTK/QT apps, like Wine
  3. Provide consistent PDF printing experience

Installing

There is a cups-pdf version 2.6.1 with the fix in an easy to install deb patch form in ppa:jethrogb/ppa. Add it to your list of apt sources and update. For Arch Linux you can find it in AUR: cups-pdf-to-pdf-git

For all the other system, or if you want the latest functionality follow the directions below:

  1. Get the development prerequisites

apt-get install libcups2-dev

  1. Compile

gcc -O9 -s -o cups-pdf cups-pdf.c -lcups

(note the different order of options than the one suggested on the cups-pdf website)

  1. Copy to your system folder
	sudo cp /usr/lib/cups/backend/cups-pdf /usr/lib/cups/backend/cups-pdf.bak
	sudo cp cups-pdf /usr/lib/cups/backend/
  1. Copy CUPS-PDF_opt.ppd to your CUPS model directory

sudo cp CUPS-PDF_opt.ppd /usr/share/cups/model

  1. Copy cups-pdf.conf to /etc/cups (and then edit as needed):

sudo cp cups-pdf.conf /etc/cups/

  1. Remove CUPS-PDF printer, if you have any, and recreate it. Make sure to pick "Generic CUPS-PDF Printer (w/ options)" as the driver

Troubleshooting

The options from /etc/cups/cups-pdf.conf are ignored

If you create the printer with the URL like this: cups-pdf://localhost, then it will be looking for a file cups-pdf-/localhost.conf Change the URL to cups-pdf:/ (it is a valid url after it's created, but you might not be able to use it during creation). It will then look for cups-pdf.conf

Apparmor is getting in the way

sudo vi /etc/apparmor.d/usr.sbin.cupsd

  1. At the end of the /usr/sbin/cupsd flags=(attach_disconnected) section add
	unix peer=(label=/usr/lib/cups/backend/cups-pdf),
	signal peer=/usr/lib/cups/backend/cups-pdf,
  1. At the end of the /usr/lib/cups/backend/cups-pdf section add
	/var/log/cups/ r,
	/var/log/cups/** rwk,
	/etc/cups/ r,
	unix peer=(label=/usr/sbin/cupsd),
	signal peer=/usr/sbin/cupsd,
	@{HOME}/bin/pdfpostproc.sh rUx,

(last line is needed if you indicated a post-processor in your /etc/cups/cups-pdf.conf)

  1. Reload apparmor profile

sudo apparmor_parser -r /etc/apparmor.d/usr.sbin.cupsd

Other

cups-pdf-to-pdf's People

Contributors

alexivkin avatar noeljunior avatar nth0 avatar tomm77 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.