Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to print pdf file directly to printer

204 views
Skip to first unread message

Ricardo Ríos

unread,
Aug 14, 2007, 11:06:48 PM8/14/07
to
Hi wizards, I need an advice, I have a report in Ireport , How can I
print this report directly to printer. it is possible ?
Thanks in advance.

Roedy Green

unread,
Aug 15, 2007, 5:47:30 AM8/15/07
to
On Wed, 15 Aug 2007 03:06:48 -0000, Ricardo Ríos
<ricardo...@gmail.com> wrote, quoted or indirectly quoted someone
who said :

>Hi wizards, I need an advice, I have a report in Ireport , How can I
>print this report directly to printer. it is possible ?
>Thanks in advance.

Since printers don't understand PDF, only PostScript, the strict
answer to your question is, it is impossible. You will need something
that understands PDF and can print, e.g. acrobat or clone.

See http://mindprod.com/jgloss/pdf.html
--
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com

Gordon Beaton

unread,
Aug 15, 2007, 7:39:08 AM8/15/07
to
On Wed, 15 Aug 2007 09:47:30 GMT, Roedy Green wrote:
> On Wed, 15 Aug 2007 03:06:48 -0000, Ricardo Ríos
><ricardo...@gmail.com> wrote, quoted or indirectly quoted someone
> who said :
>
>>Hi wizards, I need an advice, I have a report in Ireport , How can I
>>print this report directly to printer. it is possible ?
>>Thanks in advance.
>
> Since printers don't understand PDF, only PostScript, the strict
> answer to your question is, it is impossible. You will need
> something that understands PDF and can print, e.g. acrobat or clone.

Or spool through a filter like ghostscript.

/gordon

--

JohnT

unread,
Aug 15, 2007, 8:16:26 AM8/15/07
to
On Wed, 15 Aug 2007 09:47:30 GMT, Roedy Green expounded upon us in
comp.lang.java.programmer :

> On Wed, 15 Aug 2007 03:06:48 -0000, Ricardo Ríos
> <ricardo...@gmail.com> wrote, quoted or indirectly quoted
> someone who said :
>
>>Hi wizards, I need an advice, I have a report in Ireport , How
>>can I print this report directly to printer. it is possible ?
>>Thanks in advance.
>
> Since printers don't understand PDF, only PostScript, the strict
> answer to your question is, it is impossible. You will need
> something that understands PDF and can print, e.g. acrobat or
> clone.
>
> See http://mindprod.com/jgloss/pdf.html

Actually, that's not entirely true. HP printers understand PCL (PCL
is an HP invention) as well as PS. They *can* understand PDF as
well (printing natively) if they have the correct patches (firmware)
applied.


--
** Filtering out Google Groups since 2007-08-02 RLU 451587
** Nothing will ever be attempted if all possible objections
** must first be overcome. Samuel Johnson
** The Usenet Improvement Project:
http://blinkynet.net/comp/uip5.html

Lew

unread,
Aug 15, 2007, 8:32:02 AM8/15/07
to
JohnT wrote:
> On Wed, 15 Aug 2007 09:47:30 GMT, Roedy Green expounded upon us in
> comp.lang.java.programmer :
>
>> On Wed, 15 Aug 2007 03:06:48 -0000, Ricardo R�os

>> <ricardo...@gmail.com> wrote, quoted or indirectly quoted
>> someone who said :
>>
>>> Hi wizards, I need an advice, I have a report in Ireport , How
>>> can I print this report directly to printer. it is possible ?
>>> Thanks in advance.
>> Since printers don't understand PDF, only PostScript, the strict
>> answer to your question is, it is impossible. You will need
>> something that understands PDF and can print, e.g. acrobat or
>> clone.
>>
>> See http://mindprod.com/jgloss/pdf.html
>
> Actually, that's not entirely true. HP printers understand PCL (PCL
> is an HP invention) as well as PS. They *can* understand PDF as
> well (printing natively) if they have the correct patches (firmware)
> applied.

At one time, no printer spoke Postscript. They all had proprietary control
codes. Now there are two kinds of printer out there - those that speak
Postscript natively and those that speak a proprietary control code.
Sometimes the same printer is both, that is, bilingual.

Either way, Roedy's point holds. Whether it's Postscript or some other
printer command code, something must transform the output from the computer's
format to the printer's.

--
Lew

Lew

unread,
Aug 15, 2007, 8:54:39 AM8/15/07
to
Roedy Green expounded upon us in
>>> Since printers don't understand PDF, only PostScript, the strict
>>> answer to your question is, it is impossible. You will need
>>> something that understands PDF and can print, e.g. acrobat or
>>> clone.
>>> See http://mindprod.com/jgloss/pdf.html

JohnT wrote:
>> Actually, that's not entirely true. HP printers understand PCL (PCL
>> is an HP invention) as well as PS. They *can* understand PDF as well
>> (printing natively) if they have the correct patches (firmware) applied.

Lew wrote:
> Either way, Roedy's point holds. Whether it's Postscript or some other
> printer command code, something must transform the output from the
> computer's format to the printer's.

Though now that I think of it, PDF is Postscript so it really should print
natively on PS printers, shouldn't it?

--
Lew

JohnT

unread,
Aug 15, 2007, 9:57:07 AM8/15/07
to
On Wed, 15 Aug 2007 12:54:39 GMT, Lew expounded upon us in
comp.lang.java.programmer :

> Roedy Green expounded upon us in

PS and PDF are two different schemas. If you ever get a chance,
open a PS file in a text editor and then try to do the same thing
with a PDF. You can actually edit the PS file if you need to, but
you can't do this with PDFs.

I know for a fact, having done this myself, that without the proper
drivers, non-HP printers (i.e Lexmark) cannot render the PCL
properly. But, and I should add, any printer can print PCL with
the proper drivers. It's the drivers that act as the interperter.

Furthermore, it is possible to stream PS files together and create
one large file, but you can't do that with PDF files. You have to
disassemble them to PS and then stream the PS together. It's
something ghostscript can do, but I haven't had a reason to try it.
I was able to take PDF files and convert them to PS so that they
would print as passthrough (no conversion required... take it and
print it). This is, as opposed to having to RIP the PDF to MOD:CA
first.

Yeah.. I know.. too much information.. but this is what I do for a
living, that's why I know a bit about how printers work. Or at
least how they do in the infrastructure I designed.

Joshua Cranmer

unread,
Aug 15, 2007, 5:04:13 PM8/15/07
to
JohnT wrote:
> PS and PDF are two different schemas. If you ever get a chance,
> open a PS file in a text editor and then try to do the same thing
> with a PDF. You can actually edit the PS file if you need to, but
> you can't do this with PDFs.

You can also edit the PDF if your editor is nice about handling binary
formats as well. The only binary stuff is streams, and that is generally
only a problem if the PDF uses any sort of filters (or contains a
picture)... which happens to be true for all but maybe two PDF's out there.

That said, modifying PDF's is really dangerous, and it is not a good
idea to do so by hand.
--
Beware of bugs in the above code; I have only proved it correct, not
tried it. -- Donald E. Knuth

Roedy Green

unread,
Aug 15, 2007, 7:32:19 PM8/15/07
to
On Wed, 15 Aug 2007 08:54:39 -0400, Lew <l...@lewscanon.com> wrote,

quoted or indirectly quoted someone who said :

>Though now that I think of it, PDF is Postscript so it really should print

>natively on PS printers, shouldn't it?

PostScript is human-readable. PDF is not. Perhaps PDF is PostScript
plus extra junk (e.g. indexes), then compressed.

PDF is gradually becoming an interchange format like HTML, where you
want precise control of the layout.

Adobe pulled off a near miracle, persuading the major font companies
to allow their fonts to be embedded in PDF files, without royalties.
There is no way to do this with standard HTML, CSS or Java. If you
include the fonts, everyone will see the document with the proper
fonts. If you don't, people without the fonts installed will see the
document with a rough approximation to the correct font using Adobe's
morphing master font technology. The document will be rendered with
whatever fonts the end user has available. They may look absolutely
nothing like the ones you used to compose the document. Only the
glyphs you actually use in the document are included. If you don't
want the bulk, the distiller will save some information about the font
metrics instead, then the viewer's reader software can warp one of the
installed fonts to create a substitute that will at least have the
same spacing even if it looks nothing like the original font.

Pseudo Silk Kimono

unread,
Aug 15, 2007, 7:43:56 PM8/15/07
to
On Wed, 15 Aug 2007 09:47:30 +0000, Roedy Green wrote:

> On Wed, 15 Aug 2007 03:06:48 -0000, Ricardo Ríos
> <ricardo...@gmail.com> wrote, quoted or indirectly quoted someone
> who said :
>
>>Hi wizards, I need an advice, I have a report in Ireport , How can I
>>print this report directly to printer. it is possible ?
>>Thanks in advance.
>
> Since printers don't understand PDF, only PostScript, the strict
> answer to your question is, it is impossible. You will need something
> that understands PDF and can print, e.g. acrobat or clone.
>
> See http://mindprod.com/jgloss/pdf.html

Mr. Green:

You seem to have an abundance of knowledge about various document formats.
If I may, I would like to ask you a question. Is there a way to imbed
what could be considered versioning (i.e. Subversion or CVS) tags within a
PDF document without disassembling the PDF and then rebuilding?

Thank you.


--
/home/john/.signature

Roedy Green

unread,
Aug 15, 2007, 9:26:53 PM8/15/07
to
On Wed, 15 Aug 2007 23:43:56 +0000 (UTC), Pseudo Silk Kimono
<pseudo_si...@mariliion.com> wrote, quoted or indirectly quoted
someone who said :

>You seem to have an abundance of knowledge about various document formats.


>If I may, I would like to ask you a question. Is there a way to imbed
>what could be considered versioning (i.e. Subversion or CVS) tags within a
>PDF document without disassembling the PDF and then rebuilding?

see http://mindprod.com/jgloss/pdf.html

There are all manner of tools for creating and editing PDF documents.
Perhaps if you check the list out you will find something. I doubt
Subversion or CVS will be smart enough to embed tags, unless they have
now implemented pluggable inserter. I have only seen it plop raw text
in as comments. You might prod the creators of Subversion and CVS
with an "innocent" question on how you go about embedding version info
in PDF. Likely, PDFs will have to be treated like binaries without
any embedding.

Ian Wilson

unread,
Aug 16, 2007, 6:07:10 AM8/16/07
to
Roedy Green wrote:
> On Wed, 15 Aug 2007 03:06:48 -0000, Ricardo Ríos
> <ricardo...@gmail.com> wrote, quoted or indirectly quoted someone
> who said :
>
>
>>Hi wizards, I need an advice, I have a report in Ireport , How can I
>>print this report directly to printer. it is possible ?
>>Thanks in advance.
>
>
> Since printers don't understand PDF

Some printers *do* understand PDF.
e.g. HP Color LaserJet 4650 series printer

Print languages, std.
HP PCL 6, HP PCL 5c (Web download),
HP postscript level 3 emulation,
native PDF printing

<http://h10010.www1.hp.com/wwpc/us/en/sm/WF06a/18972-236251-236268-15077-f58-375773.html>

Ian Wilson

unread,
Aug 16, 2007, 7:06:40 AM8/16/07
to
Roedy Green wrote:

> Perhaps PDF is PostScript plus extra junk (e.g. indexes), then compressed.

No, Postscript is a programming language with flow-control,
conditionals, loops, subroutines, recursion, etc.
AFAIK PDF isn't.

Consider loop.ps

%!PS
/Helvetica 12 selectfont
/y 780 def
1 1 600 {
72 y moveto
(Postscript is a proper programming language) show
/y y 12 sub def
y 70 lt {
showpage
/y 780 def
} if
} for
showpage

As Postscript that is a file with size 211 bytes. Converted to PDF using
Ghostscript I get a PDF file with size 1536 bytes. That's because the
conversion to PDF has to (effectively) unroll the loop.

If you change 600 to a much larger number, the Postscript file size only
goes up by a one or two bytes. The PDF file size will go up by hundreds
of thousands of bytes.

The 895 byte Postscript program at
http://www.acm.org/tog/resources/RTNews/html/rtnv6n2.html#art11
expands to a 1,321,462 byte PDF!
(The PS is well worth copying to a file and running in GS!)

PDF is not a superset of Postscript. Each has features and capabilities
the other doesn't.

Pseudo Silk Kimono

unread,
Aug 16, 2007, 3:26:02 PM8/16/07
to
On Thu, 16 Aug 2007 10:07:10 GMT, Ian Wilson expounded upon us in
comp.lang.java.programmer :

> Roedy Green wrote:

NO Freaking way. Did you happen to notice if they mention whether
or not these printers can handle batch printed PDFs, or do you
still have to open them up with Acrobat or something like that. HP
told me a while ago that their new HP9050's could print PDF's
natively and I was happy as a clam. But, alas, what they told me
did not help me with the problem of printing them in a batch
format. Oh well.. this is extremly Off-Topic so perhaps we should
move it to a more appropriate forum?

Roedy Green

unread,
Aug 16, 2007, 5:36:29 PM8/16/07
to
On Thu, 16 Aug 2007 19:26:02 +0000 (UTC), Pseudo Silk Kimono
<misplaced...@marillion.com> wrote, quoted or indirectly quoted
someone who said :

>


>NO Freaking way. Did you happen to notice if they mention whether
>or not these printers can handle batch printed PDFs, or do you
>still have to open them up with Acrobat or something like that. HP
>told me a while ago that their new HP9050's could print PDF's
>natively and I was happy as a clam. But, alas, what they told me
>did not help me with the problem of printing them in a batch
>format. Oh well.. this is extremly Off-Topic so perhaps we should
>move it to a more appropriate forum?

How would Windows set that up. Perhaps you have two logical printers
attached to the same physical printer, one speaking PS or PCL and the
other PDF. Then you need some way of passing a PDF through unmodified
and also to create a PDF from meta print calls.

Sounds like something quite tricky to pull off without help from
Windows.

Pseudo Silk Kimono

unread,
Aug 16, 2007, 7:01:41 PM8/16/07
to

Alas, I do not believe Windows is capable of pulling that off. We use a
software package which converts the PDF to printable PCL using MOD:CA as
its PSF mechanism.


--
Huddled in the safety of a pseudo silk kimono wearing bracelets of smoke
Naked of understanding
Nicotine smears, long, long dried tears, invisible tears
Safe in my own words, learning from my own words

Pseudo Silk Kimono

unread,
Aug 16, 2007, 7:04:10 PM8/16/07
to
On Thu, 16 Aug 2007 12:06:40 +0100, Ian Wilson wrote:

>
> PDF is not a superset of Postscript. Each has features and capabilities
> the other doesn't.

Ghostscript, with the correct options, does a great job of converting PDF
to Postscript which can then be printed on pretty much any printer. I had
to create something like that to eliminate an unnecessary load on a print
server. It works like a charm.

Ian Wilson

unread,
Aug 17, 2007, 6:16:52 AM8/17/07
to

There are 3rd party utilities like "Printfile"[1] but I use what comes
with Windows XP pro ...


1) Windows XP pro "command prompt" :

C:\>lpr /?

Sends a print job to a network printer

Usage: lpr -S server -P printer [-C class] [-J job] [-o option] [-x]
[-d] filename

Options:
-S server Name or ipaddress of the host providing lpd service
-P printer Name of the print queue
-C class Job classification for use on the burst page
-J job Job name to print on the burst page
-o option Indicates type of the file
(by default assumes a text file)
Use "-o l" for binary (e.g. postscript) files
-x Compatibility with SunOS 4.1.x and prior
-d Send data file first

C:\>lpr -S jetdirect -P auto loop.ps


2) A printer icon on my Windows XP pro desktop to which I drag and drop
text, PCL or PS files from "Windows Explorer".

To create the icon:
Right click on the desktop, select "new", "shortcut"
enter the target as
%windir%\System32\lpr.exe -S jetdirect -P auto %1%


For local printers and for printers that dont know the LPD protocol, I
expect you can use the "copy /b" command with a target like LPT1: or
//computername/printername.

There seems to no Java content in this posting, my apologies for that!


[1] http://www.lerup.com/printfile/

0 new messages