LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Text printing as a PDF (https://www.linuxquestions.org/questions/linux-newbie-8/text-printing-as-a-pdf-4175694980/)

WayCon 05-10-2021 08:06 PM

Text printing as a PDF
 
Hello,
I'm probably asking an old question, but when I print from a simple Linux text editor like xed to a simple parallel port dot matrix printer, I get all the random seeming output of a PDF. Wherever I search online about this, I only see links to the opposite problem--ways of turning text into PDF. How do I keep text from outputting as a PDF? I want my text RAW, or text. I thank you for your time.
WayCon

frankbell 05-10-2021 08:25 PM

I have never encountered anything like this, so I have no answers, but some questions:

What distro/version are you using? (Your user agent icon says "Ubuntu," but that could be Ubuntu or a derivative.)

What happens when you print a test page via CUPS (http://localhost:631)?

Which text editor(s) have you tested for this? (I doubt it makes a difference, but it would be nice to fill in the picture.)

Would it be possible to post a scan of one of these print-outs to bring to life what the phrase "output of a PDF."

jefro 05-10-2021 09:06 PM

Does the printer work under any condition? Did it ever?
You are not seeing PDF you are seeing wrong printing.


What you see



echo "Y helo thar" > /dev/lp0

Or

more text-file | lp

michaelk 05-10-2021 09:17 PM

Maybe, the default print output format from GUI applications is PDF so it depends on how the printer is configured.

How did you setup your printer in cups? What is the make and model number of the printer?

All of the old legacy print drivers are now maintained by Open Printing now days since many distributions do not install them by default anymore nor by Apple (They own cups). http://www.openprinting.org

WayCon 05-10-2021 09:39 PM

1 Attachment(s)
Attachment 36357
Hello frankbell,
I am trying to attach a poor photo of the print out. It's pretty clearly page description output, or so I believe. The quality is poor because the ribbon is old and dried up. This is what I got when I went to CUPS as you suggested and I hit the print test button.
Thank you,
WayCon

michaelk 05-10-2021 09:49 PM

To expand on jefro's post you can try printing directly to the printer and bypass cups via the command

cat file.name > /dev/lp0

WayCon 05-10-2021 09:50 PM

Hello, jefro,
The printer is one of several that I have used on and off for some years with Windows 10, Windows 7, and with other, older machines, so it is working.

Hello, michaelk,
I installed the printer through the print installer on my Mint machine. It did see it as an Epson printer, so I used the driver suggested and also I tried the most absolutely generic set up the print installer offered. I am certainly willing to give you any specific information you want. What would be useful?

I thank you both,

WayCon

frankbell 05-10-2021 09:53 PM

Quote:

Hello frankbell,
I am trying to attach a poor photo of the print out.
Thank you for the effort.

Unfortunately, the photo was so faint that I could not discern anything helpful. But, again, thank you very much for trying.

I will continue to follow this thread, as I want to know what the heck is going on here!

jefro 05-10-2021 09:59 PM

"Windows 10, Windows 7, and with other, older machines, so it is working."

I should have included the word Linux. Does it work or ever work in linux on your system under any condition?

Can you print the configuration from only the printer? Usually power on while holding one or two menu keys and it prints the current configuration.

michaelk 05-10-2021 10:15 PM

Have you tried my suggestion in post #6?

I'm wondering if you will have to setup your own cups filter to convert PDF back to text.

WayCon 05-10-2021 10:17 PM

Hello, all,

And thank you, everybody,

This is what I've done on localhost:631 :

Description: EPSON TM-P2.01
Location: wc-O-Plex-960
Driver: Epson 9-Pin Series (grayscale)
Connection: parallel:/dev/lp0
Defaults: job-sheets=none, none media=na_letter_8.5x11in sides=one-sided

ID Name User Size Pages State
EPSON-TM-P2.01-3-42 Test Page anonymous 1k 1 processing since Mon 10 May 2021 11:09:09 PM EDT "Rendering completed"

It prints out one 40 character line every several minutes.

WayCon 05-10-2021 10:21 PM

The one above was based on a driver that CUPS, I guess, in printer set up found itself.

I get rather similar results if I use the most generic set up I could find:

Description: printer
Location:
Driver: Local Raw Printer (grayscale, 2-sided printing)
Connection: parallel:/dev/lp0
Defaults: job-sheets=none, none media=unknown

WayCon 05-10-2021 10:24 PM

This type of Epson printer I was using, back when I was really running everything on Dos, so I don't think it really needs or, ordinarily, uses drivers. Of course I could be wrong, but I imagine there must be a solution, somewhere.

rnturn 05-10-2021 11:43 PM

Quote:

Originally Posted by WayCon (Post 6249848)
Hello,
I'm probably asking an old question, but when I print from a simple Linux text editor like xed to a simple parallel port dot matrix printer, I get all the random seeming output of a PDF. Wherever I search online about this, I only see links to the opposite problem--ways of turning text into PDF. How do I keep text from outputting as a PDF? I want my text RAW, or text. I thank you for your time.
WayCon

I'm not sure what the "random seeming output of a PDF" looks like. I can only assume that it looks like plain old binary characters with some PostScript sprinkled in for good measure.

Aside from the "/dev/lpt0" suggestion mentioned above -- which I haven't tried since the pre-CUPS era -- have you tried something like:
Code:

$ lpr -l plain.txt
This works but... I do have a CUPS-defined printer set up. The file will need to have CR-LF line terminators instead of the standard LF line terminators that UNIX files employ if you're going to bypass the filters that CUPS will use. Emacs provides a simple way to do this: Esc<Esc% ^Q^J[Ret]^Q^M^Q^J[Ret]! (OK... maybe simple to some).

If you're into programming, a simple filter could be written to change all LFs to CR/LFs which would let you issue:
Code:

$ crlffilter < plain.txt | lpr -l -
Ah... after scrolling through the posts again, I see that you've gotten a CUPS printer set up. If it's slow, try bypassing CUPS filters using the "lpr -l" command I showed above.

I'm betting that CUPS doesn't put a lot of effort into optimizing their dot matrix printer support. Q: Where do you find tractor-feed paper and ribbons for those old beasts nowadays? (I was just joking with someone today about "disa-perf" paper. :^D )

HTH...

michaelk 05-11-2021 11:30 AM

In order for cups to print to a text Epson type printer the PDF file needs to be converted via a raster filter and I believe the required filter is rastertoespon. Mint does have the raster filter so something must be amiss with cups somewhere or it is possible the raster filter does not work anymore. I have a Zebra label printer and it no longer "works" with later cups versions due to the raster filter. I have yet to figure it all out but Michael Sweet (The original cups developer) had to create a special spooler program because I think that Apple screwed it up. From what I can tell they had a falling out and he no longer works for Apple.

A raw printer bypasses the filters so that is not going to work with PDF formated output. Printing from the command line would send plain text directly to the printer instead of PDF and was requested as a test.

https://www.cups.org/doc/raster-driver.html


All times are GMT -5. The time now is 09:16 AM.