JPS: printing text overlapping image
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   matteo_albini
Posted On:   Wednesday, October 6, 2004 01:39 AM

How can I print a text file and an image file (gif or jpeg) on the same sheet? I’m able to do this overlapping with two text files only. The code is like this: //… DocFlavor flavor = DocFlavor.INPUT_STREAM.AUTOSENSE; PrintService currentService = PrintServiceLookup.lookupDefaultPrintService(); DocPrintJob printJob = currentService.createPrintJob(); InputStream is = new BufferedInputStream(new FileInputStream("pag1_pcl.txt")); Doc doc = new SimpleDoc(is, flavor, null); printJob.print(doc, null); //… printJob = currentService.createPrintJob(); is = new BufferedInputStream(new FileInputStream("pag1.txt")); doc = new SimpleDoc(is,   More>>

How can I print a text file and an image file (gif or jpeg) on the same sheet?
I’m able to do this overlapping with two text files only. The code is like this:


			
//…
DocFlavor flavor = DocFlavor.INPUT_STREAM.AUTOSENSE;
PrintService currentService = PrintServiceLookup.lookupDefaultPrintService();
DocPrintJob printJob = currentService.createPrintJob();
InputStream is = new BufferedInputStream(new FileInputStream("pag1_pcl.txt"));
Doc doc = new SimpleDoc(is, flavor, null);
printJob.print(doc, null);
//…
printJob = currentService.createPrintJob();
is = new BufferedInputStream(new FileInputStream("pag1.txt"));
doc = new SimpleDoc(is, flavor, null);
printJob.print(doc, null);
//…

Both the text files (one page each) are printed on the same sheet because “pag1_pcl.txt” has PCL character control that place the printing at the beginning of the page.
If I try with an image file (i.e. “pag1.gif”) instead of a text file, I obtain the print on a second page… (I think there is o sort of “automatic feed” associated with image format file…)


Thanks very much in advance.    <<Less
About | Sitemap | Contact