PDF printer for puppy

Stuff that has yet to be sorted into a category.
Message
Author
User avatar
jcoder24
Posts: 604
Joined: Fri 06 May 2005, 12:33
Location: Barbados

PDF printer for puppy

#1 Post by jcoder24 »

Update 20070508
Version 0.3

- Default options set to be the same for both drivers
- Printing text was actually missing from the gs version. This was re-added and the top-margin problem fixed
- Fixed small bug in pdf interface code
- Now works in grafpup 2.xx

I believe that the ghostpdf.ppd used for the gs driver is the same as that used in most 'free' pdf printers available in windows. It offers a lot more options including lots of page formats, image compression, pdf version conformance, etc. I would recommend the gs version over the ad one.

Update 20070506
Version 0.2

- Displays a file selection dialog so you can specify where to save the pdf.
- Allows specification of a default location to store all generated pdfs (configurable via xpdq)
--make sure to click "Set as default" when configuring this option via the xpdq interface.

The major difference between the two packages is that the adobe version handles text files better than the ghost script version. The ghostscript version gives a large top margin when writing pdfs from text files. The only other difference is the license.

NB Both packages/printers can be installed at the same time without problems.

Original Post
This pupget package pdfprinter_pdq-0.1 is 8k/27k/8k compressed/uncompressed/installed. It creates a printer (similar to those found on windows) that outputs pdf files. CUPS-PDF does the same thing but requires CUPS and produce lesser quality pdf.

Package contents
~~~~~~~~~~~~

File /etc/pdq/drivers/ADIST5.PPD
Adobe Distiller5 PPD file (license permits redistribution once not modified). This is removed after installation. Someone more familiar with licensing issues can indicate if distributing a modified pdq version of this file would be breaking the license. If not I can just packaged the only two files needed.

File /etc/pdq/drivers/extra
Contains language_driver's to add printing of plain-text (tested) and images (not tested) to the converted pdq driver created from the Adobe Distiller5 PPD file. The snippets in the file comes from drivers already in puppy (generic-postscript-1.2 and hp-2500-cm-2.0). If anyone knows of any license issues with reusing those pieces of code please let me know. So far I haven't seen any. This is removed after installation.

File /etc/pdq/interfaces/pdf-0.1
Creates a pdq interface called pdf which allows you to add a pdf printer.

Folder /usr/local/ppdtopdq
This directory contains perl scripts and modules to convert ppd files to pdq. Could be useful for porting other printers' ppd drivers to pdq. This is removed after installation.

Installation
~~~~~~~~~~~~

Install the package with pupget/petget/pkgtool/gpkgtool package manager. NB the conversion from ppd to pdq driver requires perl --so to install this in Puppies/Grafpuppies without perl you would need to install perl or the devx module (I think that has/had in perl subject to correction). This package was tested with puppy2.13 and grafpup2 alpha4.

Usage
~~~~~~~~~~~~

Once installed, a new printer named 'pdf-writer' will be added. By default pdfs are created in /var/spool/pdfs with filename YYYYMMDD-hhmm-ss.pdf with a resolution of 1200dpi. Some applications don't allow printer selection, in that case you will need to set 'pdf-writer' as your default printer. These options can be changed via xpdq. For future releases I hope to have a dialog/file chooser to allow you to specify the filename and location at print time (volunteers welcomed). Also in the immediate future I hope to create a pdfprinter_cups for CUPS (for the times when pdq isn't adequate).
Attachments
pdfprinter_pdq-ad-0.3.tar.gz
Pdf printer based on adobe distiller ppd file.
(8.31 KiB) Downloaded 2122 times
pdfprinter_pdq-gs-0.3.tar.gz
Pdf printer based on ghostscript ghostpdf.ppd file.
(4.62 KiB) Downloaded 2115 times
pdfprinter_pdq-0.1.tar.gz
(8.08 KiB) Downloaded 2002 times
Last edited by jcoder24 on Wed 09 May 2007, 02:20, edited 6 times in total.

disciple
Posts: 6984
Joined: Sun 21 May 2006, 01:46
Location: Auckland, New Zealand

#2 Post by disciple »

It looks good, but:
-with Grafpup 104 it prints blank pages.
-it works properly in Puppy 2.14 from the XPDQ interface, but I can't figure out how to print to it from an application - eg in leafpad I get this error:

Code: Select all

lpr: error - no default destination available.
any ideas?

BTW, how does the quality compare with printing to file and then converting to PDF with Ghostview?

User avatar
HairyWill
Posts: 2928
Joined: Fri 26 May 2006, 23:29
Location: Southampton, UK

#3 Post by HairyWill »

tested it in muppy6
prints from abiword including images, good quality, no configuration needed
thank you very much

I don't think linux printing is ever going o happen on my crappy Dell AIO at least I can now dump pdfs somewhere for windows to print automatically when it boots.
Will
contribute: [url=http://www.puppylinux.org]community website[/url], [url=http://tinyurl.com/6c3nm6]screenshots[/url], [url=http://tinyurl.com/6j2gbz]puplets[/url], [url=http://tinyurl.com/57gykn]wiki[/url], [url=http://tinyurl.com/5dgr83]rss[/url]

User avatar
jcoder24
Posts: 604
Joined: Fri 06 May 2005, 12:33
Location: Barbados

#4 Post by jcoder24 »

disciple: I'll look into Grafpup issue. The leafpad error is probably due to not having a default printer set.

As for saving to a file and then converting to pdf with ghostview (ghostscript): The saved file must be (converted to) postscript and it is the quality of the postscript file that determines the quality of the pdf. The quality of the postscript file depends on the application and or printer driver.

However, if you are referring to puppypdf (puppy's pdf converter) that requires abiword and can only convert file types supported by abiword. The quality of the abiword produced pdfs is rather good and maybe be more or less the same. However, the pdf printer allows you to specify the resolution (quality) in the printer options.

Note however, that the main reason for this pdf-writer printer is to be able to print 'directly' to pdf without requiring a lot of dependencies. This feature comes in especially handy when printing web pages and receipts of online transactions. In terms of requirements it only needs pdq and ps2pdf (ghostscript).
Last edited by jcoder24 on Thu 03 May 2007, 20:01, edited 1 time in total.

User avatar
jcoder24
Posts: 604
Joined: Fri 06 May 2005, 12:33
Location: Barbados

#5 Post by jcoder24 »

I forgot to mention that the a new version that brings up a file dialog so you can specify where to store the generated pdf is available. This was completed sometime ago but wasn't posted due to the lack of interest amongst the community. For that same reason I've put off looking into a CUPS version.

I'll try to upload the new versions tonight. One uses a converted adobe distiller file (the 'old' version) and one uses a converted ghostscript ppd. The ghostscript version offers more options for configuring the printer than the adobe version but doesn't print text files as well (at least not yet).

disciple
Posts: 6984
Joined: Sun 21 May 2006, 01:46
Location: Auckland, New Zealand

#6 Post by disciple »

The leafpad error is probably due to not having a default printer set
If I tell XPDQ to make it the default printer, I get the same error - maybe thus doesn't work if I have CUPS installed? I also tried from leafpad

Code: Select all

lpr -Ppdf-writer
which I thought should work if it isn't default.

Don't spend too much time trying to figure out the blank pdfs - Grafpup 104 is kind of outdated now.

User avatar
jcoder24
Posts: 604
Joined: Fri 06 May 2005, 12:33
Location: Barbados

#7 Post by jcoder24 »

Last edited by jcoder24 on Wed 09 May 2007, 02:06, edited 3 times in total.

User avatar
vati
Posts: 28
Joined: Thu 31 Aug 2006, 20:54
Location: Germany
Contact:

PDF printer in Muppy 007

#8 Post by vati »

jcoder24 wrote:These new versions displays a file selection dialog so you can specify where to save the pdf. It also allows you to specify a default location to store all generated pdfs in via an interface option --make sure to click "Set as default" when configuring this option via the xpdq interface.
NB Both packages/printers can be installed at the same time without problems.
Many thanks for this useful app. I'm a little idiot for searching xpdq interface
:wink:
This is : Setup - Xpdq printer management (see the screenshot).
The quality of pdf (adobe) is very good and the size is small.
Thanks a lot.
-vati
Attachments
pdfprinter.gif
Xpdq_printer_management.gif
(66.68 KiB) Downloaded 5734 times
Precise Puppy on EEEPC Asus 1005p frugal SD-Card without pupsave

disciple
Posts: 6984
Joined: Sun 21 May 2006, 01:46
Location: Auckland, New Zealand

#9 Post by disciple »

Does anybody using this also use CUPS? - maybe my problem is that I have CUPS installed, and you can't use both CUPS and XPDQ printers...

User avatar
metre9dmt
Posts: 42
Joined: Fri 09 Mar 2007, 05:44
Location: Philippines
Contact:

PDFPrinter for Puppy

#10 Post by metre9dmt »

Just downloaded from forum. Will report back for the results with version 2.15

Thanks!

Update:

With OpenOffice 2.2, there was no printer recognize.

With AbiWord and Gnumeric, PDF Printer is recognize.

With Seamonkey/Firefox, There was no printer recognize.

With GanttProject and FreeMind (both are Java programs), There was no printer recognize.

With QCAD and Inkscape ver 0.43, There was no printer recognize.

OpenOffice 2.2, GanttProject and FreeMind has an option to export files to PDF.

Seamonkey/Firefox can only print postscript files but the output files have inconsistent formatting.

It seems that Xpdq is not recognize by all programs. Is there a way to make it recognize by Seamonkey/Firefox, QCAD and Inkscape? Even though OOo 2.2, GanttProject and FreeMind can produce their own PDF file, I would still want them to use Xpdq for UI consistency.

Hoping for your assistance in this matter.

Update:

OpenOffice 2.2, GanttProject, Inkscape 0.43, Firefox and Freemind were added to 2.15 CE. I hope this info might help.

Just wondering out loud, isn't printing a part of the system which should make it automatically available to all applications? The reason I ask this question because I am trying to convince co-workers and other people to use Puppy Linux. Whenever the discussion is stirred towards certain issues such printer setup or pdf creation, though I can show it to them how it can be done, I, myself, is still getting stumped.

All the best.

User avatar
jcoder24
Posts: 604
Joined: Fri 06 May 2005, 12:33
Location: Barbados

#11 Post by jcoder24 »

discipleI'm thinking that with CUPS installed it may be 'set' as your default printing system. In that case, printing would most likely use CUPS rather than PDQ. If this is true, then you will have have to find out how to switch between the two. You will have to check with one of our CUPS gurus for this. However, once I'm done with the PDQ version I can try a CUPS version now that there is some interest. I think it should actually be easier.

metre9dmt
Some applications don't allow printer selection, in that case you will need to set 'pdf-writer' as your default printer.
This seem to be the case with a lot of applications eg with firefox printing to the printer "Postscript/default" prints to the default printer which I have set as pdf-writer. In opera i have to enter "lpr" as my printer program before it allows me to print. Hope this helps.

... depending on how you define system, printing is part of the system. Basically, once printing is set up, it's available to all applications. However, the application must have a means of using the printing system available. It can be as simple as running a "cat" on the file and redirecting to lpr or as complicated as converting to postscript before sending it to the printer.

disciple
Posts: 6984
Joined: Sun 21 May 2006, 01:46
Location: Auckland, New Zealand

#12 Post by disciple »

metre9dmt - isn't the PDF printer you can see in Abiword and Gnumeric something else that is already in Puppy to start with? Or am I confused?

User avatar
jcoder24
Posts: 604
Joined: Fri 06 May 2005, 12:33
Location: Barbados

#13 Post by jcoder24 »


User avatar
metre9dmt
Posts: 42
Joined: Fri 09 Mar 2007, 05:44
Location: Philippines
Contact:

Reply to disciple

#14 Post by metre9dmt »

disciple wrote:metre9dmt - isn't the PDF printer you can see in Abiword and Gnumeric something else that is already in Puppy to start with? Or am I confused?
No. Before I installed the PDF Printer, the said option is not available to these programs. But when I installed the PDF Printer, it became available.

Me thinks that since AbiWord and Gnumeric is already organic to version 2.15 CE, it may have easily recognize the PDF Printer. But I maybe wrong because SeaMonkey (which is part of the said distribution) won't recognize the PDF Printer. I just added GanttProject, FreeMind, OpenOffice 2.2, Inkscape 0.43, QCAD and Firefox to the said distribution (along with some games).

User avatar
BarryK
Puppy Master
Posts: 9392
Joined: Mon 09 May 2005, 09:23
Location: Perth, Western Australia
Contact:

#15 Post by BarryK »

Jcoder24, 2.16beta has v0.2 and I modified the pinstall.sh scripts, as per my News Blog. Posted here (they seem to work, I'm running 2.16beta now and the printrc file looks correct.
Unleashed packages attached...
Attachments
pdfprinter_pdq_gs-0.2.tar.gz
(3.98 KiB) Downloaded 1847 times
pdfprinter_pdq_ad-0.2.tar.gz
(8.31 KiB) Downloaded 1828 times

DavidBell
Posts: 132
Joined: Fri 24 Nov 2006, 21:44

#16 Post by DavidBell »

Is this make it into 2.16 final (DLed a week or so ago)? If so what steps do I need to take to print a pdf from Seamonkey? I couldn't find it in the Puppy printer wizard.

TIA. DB

User avatar
BarryK
Puppy Master
Posts: 9392
Joined: Mon 09 May 2005, 09:23
Location: Perth, Western Australia
Contact:

#17 Post by BarryK »

Menu -> System -> Xpdq printer management.

The pdf print entries should be there, you choose one of them and make it the default printer (Xpdq has a menu selection for that).

For any app, if you print to lpr, it should end up as a pdf file.

DavidBell
Posts: 132
Joined: Fri 24 Nov 2006, 21:44

#18 Post by DavidBell »

Thanks Barry (and jcoder). This is something I really wanted. DB

User avatar
jcoder24
Posts: 604
Joined: Fri 06 May 2005, 12:33
Location: Barbados

#19 Post by jcoder24 »

The following script creates a pdf printer for CUPS called CUPS-PDF. This script was adapted from http://www.novell.com/coolsolutions/feature/17636.html. It works the same way as the PDQ version. After testing I'll package it as a dotpet. Please test.

Code: Select all

#!/bin/sh

> /usr/lib/cups/backend/pdf-writer 
cat >> /usr/lib/cups/backend/pdf-writer << EOF_BACKEND
#!/bin/sh
#################################################################################
#
#	File:			pdf-writer
#
#	Description: 	A simple PDF Writer for CUPS 
#
#	Copyright:		(c) 2006  Axel Schmidt,  SUSE LINUX GmbH, Nuernberg, Germany
#				(c) 2001  Michael Goffioul (kdeprint <at> swing <dot> be)
#
#	License:		GPL
#
#################################################################################

PS2PDF=\`which ps2pdf\`

# USERMODE="on" changes PDFPATH to "\$HOME/<user-name>/PDF" 
#
USERMODE="off"
DEFGROUP="users"
JOB=\$1
PRTUSER=\$2

# Check DEVICE DISCOVERY + test PS2PDF 
#
if [ "\$JOB" = "" ]; then
        if test -f "\$PS2PDF" ; then
                echo "file pdf-writer:/export/share/pdf \"unkown\" \"pdf writer\" " 
                logger "pdf-writer: INFO: USERMODE=\"\$USERMODE\""
                if [ "\$USERMODE" = "on" ]; then
                   logger "pdf-writer: CUPS user must be set to root with USERMODE=\"on\"!"
                fi
                exit 0  
        else
                echo "Error: \$0 - ps2pdf is not available!"      
                logger "pdf-writer: ERROR: ps2pdf is not available!"      
                exit 1 
        fi 
fi

logger "pdf-writer started: \$1 \$2 \$3 \$4 \$5 \$6"

# Check number of command line arguments
#
if [ \$# -ne 5 -a \$# -ne 6 ]; then
        echo "Usage: \$0 job-id user title copies options [file]"
        logger "pdf-writer: CRITICAL: Printer stopped !"      
        exit 1
fi

# Get pdf filename from user via xdialog
# added by jcoder24
export PATH=\$PATH:/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/X11R7/bin
export DISPLAY=":0.0"

if [ "\`whoami\`" = "root" ]; then
	export XAUTHORITY="/root/.Xauthority"
	export "FOLDER=/root"
else
	export XAUTHORITY="/home/\`whoami\`/.Xauthority"
	export FOLDER="/home/\`whoami\`"
fi

FILENAME=\`Xdialog --title "PDF-Writer - Save As..." --fselect "\$FOLDER" 28 60 2>&1 | tail -1 | gawk '{gsub (/\.pdf\$|\.PDF\$/,"",\$0); print \$0'}\`

if [ -z "\$FILENAME" ]; then
	exit 0
fi

if [ -f "\$FILENAME.pdf" ]; then 
	FILENAME="\$FILENAME-\`date +%m%d-%H%M-%S\`.pdf"
else
	FILENAME="\$FILENAME.pdf"
fi

# get PDF-WRITER directory file selected 
# modified by jcoder24
PDFPATH="\`dirname \$FILENAME\`" 
logger "pdf-writer: \"\$FILENAME\" was placed in: \$PDFPATH"

# Check write status 
#
if [ ! -d "\$PDFPATH" -o ! -w "\$PDFPATH" ]; then
        logger "pdf-writer: ERROR: directory \$PDFPATH not writeable"
        exit 1
fi

# Run ps2pdf (ghostscript)
#
if [ \$# -eq 6 ]; then
        \$PS2PDF \$6 \$FILENAME >& /dev/null
else
        \$PS2PDF - \$FILENAME >& /dev/null
fi

# Chown + set permissions for the user 
# Note: this will not work if CUPS runs as lp
if [ "\$PRTUSER" != "" ]; then
        chmod 644 \$FILENAME
        chown \$PRTUSER:\$DEFGROUP \$FILENAME
fi
exit 0

#
#########################  CUPS pdf-writer ends here  ########################
#
EOF_BACKEND

chmod 755 /usr/lib/cups/backend/pdf-writer
ln -sf /usr/share/ghostscript/8.15/lib/ghostpdf.ppd /usr/share/cups/model/ghostpdf.ppd
/etc/init.d/cups restart
sleep 5
lpadmin -p CUPS-PDF -v pdf-writer:/export/share/pdf/ -E -P /usr/share/cups/model/ghostpdf.ppd 
/etc/init.d/cups restart

User avatar
BarryK
Puppy Master
Posts: 9392
Joined: Mon 09 May 2005, 09:23
Location: Perth, Western Australia
Contact:

#20 Post by BarryK »

jcoder24, that's great that you're tackling the CUPS implementation of print-to-pdf! ...now that Puppy has CUPS.

If we get some positive tests, then it would be good to get it into the 2.17-final.

Post Reply