Java Forum / General / August 2007
How to print pdf file directly to printer
Ricardo Ríos - 15 Aug 2007 04:06 GMT 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 - 15 Aug 2007 10:47 GMT On Wed, 15 Aug 2007 03:06:48 -0000, Ricardo Ríos <ricardo.rios.sv@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
 Signature Roedy Green Canadian Mind Products The Java Glossary http://mindprod.com
Gordon Beaton - 15 Aug 2007 12:39 GMT > On Wed, 15 Aug 2007 03:06:48 -0000, Ricardo Ríos ><ricardo.rios.sv@gmail.com> wrote, quoted or indirectly quoted someone [quoted text clipped - 7 lines] > 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 - 15 Aug 2007 13:16 GMT > On Wed, 15 Aug 2007 03:06:48 -0000, Ricardo Ríos > <ricardo.rios.sv@gmail.com> wrote, quoted or indirectly quoted [quoted text clipped - 10 lines] > > 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.
 Signature ** 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 - 15 Aug 2007 13:32 GMT >> On Wed, 15 Aug 2007 03:06:48 -0000, Ricardo R�os >> <ricardo.rios.sv@gmail.com> wrote, quoted or indirectly quoted [quoted text clipped - 14 lines] > 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.
 Signature Lew
Lew - 15 Aug 2007 13:54 GMT 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.
> 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?
 Signature Lew
JohnT - 15 Aug 2007 14:57 GMT > Roedy Green expounded upon us in >>>> Since printers don't understand PDF, only PostScript, the [quoted text clipped - 15 lines] > Though now that I think of it, PDF is Postscript so it really > should print natively on PS printers, shouldn't it? 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.
 Signature ** 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
Joshua Cranmer - 15 Aug 2007 22:04 GMT > 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.
 Signature Beware of bugs in the above code; I have only proved it correct, not tried it. -- Donald E. Knuth
Roedy Green - 16 Aug 2007 00:32 GMT >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.
 Signature Roedy Green Canadian Mind Products The Java Glossary http://mindprod.com
Ian Wilson - 16 Aug 2007 12:06 GMT > 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 - 17 Aug 2007 00:04 GMT > 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.
 Signature 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 - 16 Aug 2007 00:43 GMT > On Wed, 15 Aug 2007 03:06:48 -0000, Ricardo Ríos > <ricardo.rios.sv@gmail.com> wrote, quoted or indirectly quoted someone [quoted text clipped - 9 lines] > > 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.
 Signature /home/john/.signature
Roedy Green - 16 Aug 2007 02:26 GMT On Wed, 15 Aug 2007 23:43:56 +0000 (UTC), Pseudo Silk Kimono <pseudo_silk_kimono@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.
 Signature Roedy Green Canadian Mind Products The Java Glossary http://mindprod.com
Ian Wilson - 16 Aug 2007 11:07 GMT > On Wed, 15 Aug 2007 03:06:48 -0000, Ricardo Ríos > <ricardo.rios.sv@gmail.com> wrote, quoted or indirectly quoted someone [quoted text clipped - 5 lines] > > 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-3757 73.html>
Pseudo Silk Kimono - 16 Aug 2007 20:26 GMT >> On Wed, 15 Aug 2007 03:06:48 -0000, Ricardo Ríos >> <ricardo.rios.sv@gmail.com> wrote, quoted or indirectly quoted [quoted text clipped - 16 lines] > <http://h10010.www1.hp.com/wwpc/us/en/sm/WF06a/18972-236251-23626 > 8-15077-f58-375773.html> 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 - 16 Aug 2007 22:36 GMT On Thu, 16 Aug 2007 19:26:02 +0000 (UTC), Pseudo Silk Kimono <misplacedchildhoods@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 [quoted text clipped - 4 lines] >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.
 Signature Roedy Green Canadian Mind Products The Java Glossary http://mindprod.com
Pseudo Silk Kimono - 17 Aug 2007 00:01 GMT > On Thu, 16 Aug 2007 19:26:02 +0000 (UTC), Pseudo Silk Kimono > <misplacedchildhoods@marillion.com> wrote, quoted or indirectly quoted [quoted text clipped - 15 lines] > Sounds like something quite tricky to pull off without help from > Windows. 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.
 Signature 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
Ian Wilson - 17 Aug 2007 11:16 GMT > On Thu, 16 Aug 2007 19:26:02 +0000 (UTC), Pseudo Silk Kimono > <misplacedchildhoods@marillion.com> wrote, quoted or indirectly quoted [quoted text clipped - 16 lines] > Sounds like something quite tricky to pull off without help from > Windows. 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/
Free MagazinesGet these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...
|
|
|