1

I need printer that prints to PDF files. I have application that automatically searches some text in printed PDF file so printed PDF files have to be searchable.

As I wrote I need PDF printer because I print from Java Application that prints only on printers. I mean that any command line tool that converts txt files or any other format to PDF does not meet my requirements. My application does not execute any command, my application prints on indicated system printer so I need printer.

I know that cups-pdf is mostly recommended and used. There is one big problem with cups-pdf. Cups-pdf prints to PDF files whose text can not be searched or copied. I spent a lot of time trying to configure cups-pdf to fix this problem, unfortunately without success.
I have tried to install BullZip printer using Wine, also without success. I also tried Generic PDF Printer from cups filters. I mean following printer:

lpadmin -p gpdf -v file:///cups/prints/generic_pdf.pdf -E -m lsb/usr/cupsfilters/Generic-PDF_Printer-PDF.ppd

Copied and pasted text looks differently than text from cups-pdf but it is also garbled. Search does not work.

I also tried to print do PS file and convert PS file to PDF file in postprocessing. I noticed that printing to PS file is lossy. I described it in What PS driver to use with cups-pdf? question.

I cannot find any other PDF printer.

I can't believe there's no virtual PDF printer on Linux that prints to PDF files whose text can be searched or copied.

Is there any PDF printer that meets my requirements?

EDIT

My question differs from How to install a "pdf printer"? question in my opinion. The main difference is that I need PDF whose text can be searched. Answer that has the most point advices using cups-pdf. cups-pdf works in general for me, it prints to PDF file but text can not be searched or copied so it does not meet my requirements. The second answer that advices using 'Print to file" option also does not meet my requirements because I need system printer.

I have java application that prints on real physical printers. I have integration tests that prints on virtual PDF printers but it works only on Windows OS. I would like execute integration tests in docker and I need system printer.

Mariusz
  • 267
  • 1
    This question is similar to: How to install a "pdf printer"?. If you believe it’s different, please [edit] the question, make it clear how it’s different and/or how the answers on that question are not helpful for your problem. – graham Oct 01 '24 at 17:00
  • 2
    @graham this isn't a dupe. The OP clearly states in the question that they are using cups-pdf (which is what the answer of the dupe target suggests; the other answer isn't relevant as that fake device isn't available as a system printer to other applications), but it doesn't work for them. – terdon Oct 01 '24 at 17:06
  • Which version of Ubuntu are you using? Have you tried "Print to PDF/file" option in the "printer" setting? I was able to copy text as well as search (find) text within the PDF files generated this way in Ubuntu 24.04. – user68186 Oct 01 '24 at 17:14
  • I use Ubuntu 22.04 but I can use any Ubuntu version, it does not matter for me because I use Docker. I have tried "Print to PDF/file" option , it is not available/visible in cups. I have no idea how to share it. Maybe I will write java application that lists all printers and I will check if "save to file" is listed. – Mariusz Oct 01 '24 at 17:30
  • @user68186 I don't think that option is available as an actual printer device that can be used for automated testing. The OP hasn't mentioned it here, but from one of their other posts, I know that the objective is to do automated testing in a docker image (you might want to explain this requirement in the question, Mariusz). – terdon Oct 01 '24 at 17:30
  • I wrote java application that prints all printer and "save to file" is not listed. – Mariusz Oct 01 '24 at 17:42
  • Crossposted: https://unix.stackexchange.com/q/783756/70524 – muru Oct 02 '24 at 03:28

0 Answers0