xpdf printing with pdftops

View: New views
8 Messages — Rating Filter:   Alert me  

xpdf printing with pdftops

by Andreas Goesele :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi!

pdftops allows to expand a smaller page to fill the paper. xpdf
doesn't have such an option.

I was wondering whether it would be possible to use pdftops in a
clever printing command in the xpdf printing dialog ("Print with
command" or "Print to file").

Any suggestions?

Thanks a lot in advance

Andreas Gösele

--
Omnis enim res, quae dando non deficit, dum habetur et non datur,
nondum habetur, quomodo habenda est.
                                      Augustinus, De doctrina christiana


--
To UNSUBSCRIBE, email to debian-user-REQUEST@...
with a subject of "unsubscribe". Trouble? Contact listmaster@...


Re: xpdf printing with pdftops

by Florian Kulzer-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sat, Oct 31, 2009 at 00:11:44 +0100, Andreas Goesele wrote:
> Hi!
>
> pdftops allows to expand a smaller page to fill the paper. xpdf
> doesn't have such an option.
>
> I was wondering whether it would be possible to use pdftops in a
> clever printing command in the xpdf printing dialog ("Print with
> command" or "Print to file").

I don't know how to use pdftops as a print command because it does not
seem to be capable of reading the PDF directly from STDIN. (Processing a
PDF requires random access to the file and the STDIN stream is not
seekable.) Ghostscript, on the other hand, is smart enough to copy the
input PDF stream to a temporary file for processing:

cat test.pdf | gs -q -dSAFER -sDEVICE=pswrite -dFIXEDMEDIA -dPDFFitPage -sPAPERSIZE=a4 -o %pipe%lpr -

The above combination of commands prints test.pdf on my default printer
after scaling it to fit the page. Therefore I would hope that the
following works as a print command for XPDF (which I have not used in
years, though):

gs -q -dSAFER -sDEVICE=pswrite -dFIXEDMEDIA -dPDFFitPage -sPAPERSIZE=a4 -o %pipe%lpr -

If you want to specify further options for lpr then you have to use
quoting like this:

"%pipe%lpr ..."

where "..." stands for all the options. (The rest of the command remains
the same.)

--
Regards,            |
          Florian   |


--
To UNSUBSCRIBE, email to debian-user-REQUEST@...
with a subject of "unsubscribe". Trouble? Contact listmaster@...


Re: Re: xpdf printing with pdftops

by Andreas Goesele :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> cat test.pdf | gs -q -dSAFER -sDEVICE=pswrite -dFIXEDMEDIA -dPDFFitPage -sPAPERSIZE=a4 -o %pipe%lpr -

> The above combination of commands prints test.pdf on my default printer
> after scaling it to fit the page. Therefore I would hope that the
> following works as a print command for XPDF (which I have not used in
> years, though):

> gs -q -dSAFER -sDEVICE=pswrite -dFIXEDMEDIA -dPDFFitPage -sPAPERSIZE=a4 -o %pipe%lpr -

Thanks for the suggestion. The first line works (more or less) on the command line, but gives the warning:

GPL Ghostscript 8.62: **** Could not open the file lpr .

(I say more or less, because an image isn't printed correctly but replaced by a blurry box.)

The second inside xpdf gives the very same waring, but prints pages which are not scaled.

Any idea how I could correct this?

Thanks a lot

Andreas Gösele




--
To UNSUBSCRIBE, email to debian-user-REQUEST@...
with a subject of "unsubscribe". Trouble? Contact listmaster@...


Re: xpdf printing with pdftops

by Florian Kulzer-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sun, Nov 01, 2009 at 19:35:57 +0100, Andreas Goesele wrote:

> >cat test.pdf | gs -q -dSAFER -sDEVICE=pswrite -dFIXEDMEDIA -dPDFFitPage -sPAPERSIZE=a4 -o %pipe%lpr -
>
> >The above combination of commands prints test.pdf on my default printer
> >after scaling it to fit the page. Therefore I would hope that the
> >following works as a print command for XPDF (which I have not used in
> >years, though):
>
> >gs -q -dSAFER -sDEVICE=pswrite -dFIXEDMEDIA -dPDFFitPage -sPAPERSIZE=a4 -o %pipe%lpr -
>
> Thanks for the suggestion. The first line works (more or less) on the command line, but gives the warning:
>
> GPL Ghostscript 8.62: **** Could not open the file lpr .
>
> (I say more or less, because an image isn't printed correctly but replaced by a blurry box.)

I would call that "not working at all".

I have GPL Ghostscript 8.70, maybe I used syntax that is not supported
by version 8.62.

You can try this variant:

cat test.pdf | gs -q -dSAFER -dNOPAUSE -dBATCH -sDEVICE=pswrite -dFIXEDMEDIA -dPDFFitPage -sPAPERSIZE=a4 -sOutputFile='%pipe%lpr' -

Or you can tell gs to send the output to STDOUT and then pipe it to lpr:

cat test.pdf | gs -q -dSAFER -dNOPAUSE -dBATCH -sDEVICE=pswrite -dFIXEDMEDIA -dPDFFitPage -sPAPERSIZE=a4 -sOutputFile=- - | lpr

> The second inside xpdf gives the very same waring, but prints pages which are not scaled.

I think we should first try to make it work correctly on the command
line.

--
Regards,            |
          Florian   |


--
To UNSUBSCRIBE, email to debian-user-REQUEST@...
with a subject of "unsubscribe". Trouble? Contact listmaster@...


Re: Re: xpdf printing with pdftops

by Andreas Goesele :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> > >gs -q -dSAFER -sDEVICE=pswrite -dFIXEDMEDIA -dPDFFitPage -sPAPERSIZE=a4 -o %pipe%lpr -
> >
> > Thanks for the suggestion. The first line works (more or less) on the command line, but gives the warning:
>
> >GPL Ghostscript 8.62: **** Could not open the file lpr .
>
> > (I say more or less, because an image isn't printed correctly but replaced by a blurry box.)

> I would call that "not working at all".


You are very strict ;-) or I didn't express myself very well:

Despite the warning the file is printed, just that additionally I get the warning and a non-essential image is
replaced by a blurry box.

The first variant:

cat test.pdf | gs -q -dSAFER -dNOPAUSE -dBATCH -sDEVICE=pswrite -dFIXEDMEDIA -dPDFFitPage -sPAPERSIZE=a4 -sOutputFile='%pipe%lpr' -

gives the same warning.

The second variant:

cat test.pdf | gs -q -dSAFER -dNOPAUSE -dBATCH -sDEVICE=pswrite -dFIXEDMEDIA -dPDFFitPage -sPAPERSIZE=a4 -sOutputFile=- - | lpr

works without warning (but still with the blurred box replacing the image).

Inside xpdf

gs -q -dSAFER -dNOPAUSE -dBATCH -sDEVICE=pswrite -dFIXEDMEDIA -dPDFFitPage -sPAPERSIZE=a4 -sOutputFile=- - | lpr

prints the page without warning, with the blurred box and unfortunately without expanding the page.

Thanks again

Andreas Gösele


--
To UNSUBSCRIBE, email to debian-user-REQUEST@...
with a subject of "unsubscribe". Trouble? Contact listmaster@...


Re: xpdf printing with pdftops

by Florian Kulzer-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Mon, Nov 02, 2009 at 17:58:51 +0100, Andreas Goesele wrote:
> >> >gs -q -dSAFER -sDEVICE=pswrite -dFIXEDMEDIA -dPDFFitPage -sPAPERSIZE=a4 -o %pipe%lpr -
> >> > Thanks for the suggestion. The first line works (more or less)
> >on the command line, but gives the warning:
> >
> >>GPL Ghostscript 8.62: **** Could not open the file lpr .

[...]

> Despite the warning the file is printed, just that additionally I get
> the warning and a non-essential image is replaced by a blurry box.

Is the page expanded to fit the paper?

> The first variant:
>
> cat test.pdf | gs -q -dSAFER -dNOPAUSE -dBATCH -sDEVICE=pswrite -dFIXEDMEDIA -dPDFFitPage -sPAPERSIZE=a4 -sOutputFile='%pipe%lpr' -
>
> gives the same warning.
>
> The second variant:
>
> cat test.pdf | gs -q -dSAFER -dNOPAUSE -dBATCH -sDEVICE=pswrite -dFIXEDMEDIA -dPDFFitPage -sPAPERSIZE=a4 -sOutputFile=- - | lpr
>
> works without warning (but still with the blurred box replacing the
> image).
>
> Inside xpdf
>
> gs -q -dSAFER -dNOPAUSE -dBATCH -sDEVICE=pswrite -dFIXEDMEDIA -dPDFFitPage -sPAPERSIZE=a4 -sOutputFile=- - | lpr
>
> prints the page without warning, with the blurred box and
> unfortunately without expanding the page.

Hmm, I am starting to think that maybe we should try a different
approach. Which printing system do you use? CUPS, for example, has the
"fitplot" option which might do what you want, or e.g. "scaling=95" to
scale the file to 95% of the page size.

--
Regards,            |
          Florian   |


--
To UNSUBSCRIBE, email to debian-user-REQUEST@...
with a subject of "unsubscribe". Trouble? Contact listmaster@...


Re: Re: xpdf printing with pdftops

by Andreas Goesele :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

>> Despite the warning the file is printed, just that additionally I get
>> the warning and a non-essential image is replaced by a blurry box.

> Is the page expanded to fit the paper?


On the command line, yes. Not in xpdf

> Hmm, I am starting to think that maybe we should try a different
> approach. Which printing system do you use? CUPS, for example, has the
> "fitplot" option which might do what you want, or e.g. "scaling=95" to
> scale the file to 95% of the page size.

I'm using CUPS. On the command line the option fitplot expands the size.

Inside xpdf it doesn't have any effect.

Regards

Andreas Gösele


--
To UNSUBSCRIBE, email to debian-user-REQUEST@...
with a subject of "unsubscribe". Trouble? Contact listmaster@...


Re: xpdf printing with pdftops

by Florian Kulzer-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, Nov 03, 2009 at 00:35:02 +0100, Andreas Goesele wrote:

> >>Despite the warning the file is printed, just that additionally I get
> >>the warning and a non-essential image is replaced by a blurry box.
>
> >Is the page expanded to fit the paper?
>
> On the command line, yes. Not in xpdf
>
> >Hmm, I am starting to think that maybe we should try a different
> >approach. Which printing system do you use? CUPS, for example, has the
> >"fitplot" option which might do what you want, or e.g. "scaling=95" to
> >scale the file to 95% of the page size.
>
> I'm using CUPS. On the command line the option fitplot expands the size.
>
> Inside xpdf it doesn't have any effect.

It seems that xpdf somehow messes with the printing options. Maybe it
cuts off everything after the first space; did you try to put the
command in quotation marks into the print command filed?

I can think of three other things to try:

- Add "fitplot" to the options for your default printer in
  ~/.cups/lpoptions.

- If you run a desktop environment that has its own printing system then
  it might be possible to use that as the printing command. When I was
  still using xpdf I set the printing command to "kprinter" and then I
  could configure print quality, duplexing, etc. with KDE's print
  dialog. I never tried this with the fitplot option, though.

- Write a script that configures the printer correctly and acts a print
  command. It has to accept the file to print on STDIN and then pass it
  on to CUPS.

--
Regards,            |
          Florian   |


--
To UNSUBSCRIBE, email to debian-user-REQUEST@...
with a subject of "unsubscribe". Trouble? Contact listmaster@...