You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by jgfa9 <j....@actes-sud.fr> on 2009/02/11 20:38:06 UTC

Printing PDF on the client default printer.

Hi all,
The following message, posted on the list in 2004 exactly describes my
situation : I'm able to print a generated pdf file directly on printer (not
prompted to be opened) on the app server default printer but I'm not able to
print on the client default printer.
Thanks in advance for your help.

On Thu, 2004-10-21 at 00:29, Manoj_Nair@spe.sony.com wrote:
> My requirement is to render an XML as  a PDF and then print the PDF on the
> clients default printer. I dont want the PDF to prompt user to open the
> acrobat reader.
> 
> I already have an applet on the client side which uses PrinterJob class to
> popup the printer selection box on client side.
> 
> Now how do I redirect the content from server to this printer?
> 
> Should I use Driver.RENDER_PRINT / Driver.RENDER_PCL set in the fop driver
> renderer ? and what content type should the response object return?
> 
> Thanks
> Manoj
> 
> PS: I have successfully use the FopPrinter example ( FopPrintServlet ) to
> print pdfs on the app servers default printer but what I need is to be
> able
> to print on the clients default printer and not on servers printer.
> 

-- 
View this message in context: http://www.nabble.com/Printing-PDF-on-the-client-default-printer.-tp21962598p21962598.html
Sent from the FOP - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: Printing PDF on the client default printer.

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
In that case, the most obvious solution is to write a Java Applet that
contains FOP. You can use the PrintRenderer there. From an Applet you
should be able to print to the client's own default printer because it
resides and runs inside the client's browser. Maybe there are commercial
solutions around (ActiveX or whatever) that might be able to do similar
things.

On 11.02.2009 21:32:02 jgfa9 wrote:
> 
> Thanks again but I'm afraid I'm not in the same case : I don't want to print
> a pdf that already exists : I generate the pdf from xml source and xsl file
> and want to send it directly to client's default printer instead of
> displaying it (that works).
> Do you have an idea ?
> 
> 
> jgfa9 wrote:
> > 
> > Hi all,
> > The following message, posted on the list in 2004 exactly describes my
> > situation : I'm able to print a generated pdf file directly on printer
> > (not prompted to be opened) on the app server default printer but I'm not
> > able to print on the client default printer.
> > Thanks in advance for your help.
> > 
> > On Thu, 2004-10-21 at 00:29, Manoj_Nair@spe.sony.com wrote:
> >> My requirement is to render an XML as  a PDF and then print the PDF on
> >> the
> >> clients default printer. I dont want the PDF to prompt user to open the
> >> acrobat reader.
> >> 
> >> I already have an applet on the client side which uses PrinterJob class
> >> to
> >> popup the printer selection box on client side.
> >> 
> >> Now how do I redirect the content from server to this printer?
> >> 
> >> Should I use Driver.RENDER_PRINT / Driver.RENDER_PCL set in the fop
> >> driver
> >> renderer ? and what content type should the response object return?
> >> 
> >> Thanks
> >> Manoj
> >> 
> >> PS: I have successfully use the FopPrinter example ( FopPrintServlet ) to
> >> print pdfs on the app servers default printer but what I need is to be
> >> able
> >> to print on the clients default printer and not on servers printer.
> >> 
> > 
> > 
> 
> -- 
> View this message in context: http://www.nabble.com/Printing-PDF-on-the-client-default-printer.-tp21962598p21963368.html
> Sent from the FOP - Users mailing list archive at Nabble.com.
> 



Jeremias Maerki


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: Printing PDF on the client default printer.

Posted by jgfa9 <j....@actes-sud.fr>.
Thanks again but I'm afraid I'm not in the same case : I don't want to print
a pdf that already exists : I generate the pdf from xml source and xsl file
and want to send it directly to client's default printer instead of
displaying it (that works).
Do you have an idea ?


jgfa9 wrote:
> 
> Hi all,
> The following message, posted on the list in 2004 exactly describes my
> situation : I'm able to print a generated pdf file directly on printer
> (not prompted to be opened) on the app server default printer but I'm not
> able to print on the client default printer.
> Thanks in advance for your help.
> 
> On Thu, 2004-10-21 at 00:29, Manoj_Nair@spe.sony.com wrote:
>> My requirement is to render an XML as  a PDF and then print the PDF on
>> the
>> clients default printer. I dont want the PDF to prompt user to open the
>> acrobat reader.
>> 
>> I already have an applet on the client side which uses PrinterJob class
>> to
>> popup the printer selection box on client side.
>> 
>> Now how do I redirect the content from server to this printer?
>> 
>> Should I use Driver.RENDER_PRINT / Driver.RENDER_PCL set in the fop
>> driver
>> renderer ? and what content type should the response object return?
>> 
>> Thanks
>> Manoj
>> 
>> PS: I have successfully use the FopPrinter example ( FopPrintServlet ) to
>> print pdfs on the app servers default printer but what I need is to be
>> able
>> to print on the clients default printer and not on servers printer.
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Printing-PDF-on-the-client-default-printer.-tp21962598p21963368.html
Sent from the FOP - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: Printing PDF on the client default printer.

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
What you've shown here only works if you're printing on the local server.
You need to look at the link that is provided with the FAQ entry:
http://marc.theaimsgroup.com/?l=fop-dev&m=101065988325115&w=2

With this approach you'll produce a PDF on the server and send that to
the browser using a servlet. Then you call the printAll() method via
JavaScript from the HTML code. I've never tried this myself but it looks
useful.

BTW, if you're writing new stuff using FOP anyway, you might want to
consider upgrading to the latest FOP release.

On 11.02.2009 20:56:55 jgfa9 wrote:
> 
> Thanks for the quick answer.
> I've already seen this FAQ but I can't achieve this : 
> Here is my code : 
> 
> public static void printFO(InputSource foFile) {
>         try {
>         System.out.println("printFo");
> 
>         Driver driver = new Driver(foFile, null);
> 
>         System.out.println("printFo 2");
> 
>         PrinterJob pj = PrinterJob.getPrinterJob();
> 
>         System.out.println("printFo 3");
> 
>         PrintRenderer renderer = new PrintRenderer(pj);
> 
>         System.out.println("printFo 4");
> 
>         driver.setRenderer(renderer);
> 
>         System.out.println("printFo 5");
> 
>         driver.run();
>         } catch (Exception ex) {
>     }
>  }
> 
> The trace displays printFo and printFo2 and then nothing...
> Do you have an idea (I hope I provided enough information) ?
> Thanks again.
> 
> 
> Jeremias Maerki-2 wrote:
> > 
> > Please take a look at the follow FAQ entry:
> > http://xmlgraphics.apache.org/fop/faq.html#iex-pdf-print-from-browser
> > 
> > HTH
> > 
> > On 11.02.2009 20:38:06 jgfa9 wrote:
> >> 
> >> Hi all,
> >> The following message, posted on the list in 2004 exactly describes my
> >> situation : I'm able to print a generated pdf file directly on printer
> >> (not
> >> prompted to be opened) on the app server default printer but I'm not able
> >> to
> >> print on the client default printer.
> >> Thanks in advance for your help.
> >> 
> >> On Thu, 2004-10-21 at 00:29, Manoj_Nair@spe.sony.com wrote:
> >> > My requirement is to render an XML as  a PDF and then print the PDF on
> >> the
> >> > clients default printer. I dont want the PDF to prompt user to open the
> >> > acrobat reader.
> >> > 
> >> > I already have an applet on the client side which uses PrinterJob class
> >> to
> >> > popup the printer selection box on client side.
> >> > 
> >> > Now how do I redirect the content from server to this printer?
> >> > 
> >> > Should I use Driver.RENDER_PRINT / Driver.RENDER_PCL set in the fop
> >> driver
> >> > renderer ? and what content type should the response object return?
> >> > 
> >> > Thanks
> >> > Manoj
> >> > 
> >> > PS: I have successfully use the FopPrinter example ( FopPrintServlet )
> >> to
> >> > print pdfs on the app servers default printer but what I need is to be
> >> > able
> >> > to print on the clients default printer and not on servers printer.
> >> > 
> >> 
> >> -- 
> >> View this message in context:
> >> http://www.nabble.com/Printing-PDF-on-the-client-default-printer.-tp21962598p21962598.html
> >> Sent from the FOP - Users mailing list archive at Nabble.com.
> >> 
> > 
> > 
> > 
> > Jeremias Maerki
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> > For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
> > 
> > 
> > 
> 
> -- 
> View this message in context: http://www.nabble.com/Printing-PDF-on-the-client-default-printer.-tp21962598p21962945.html
> Sent from the FOP - Users mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org




Jeremias Maerki


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: Printing PDF on the client default printer.

Posted by jgfa9 <j....@actes-sud.fr>.
Thanks for the quick answer.
I've already seen this FAQ but I can't achieve this : 
Here is my code : 

public static void printFO(InputSource foFile) {
        try {
        System.out.println("printFo");

        Driver driver = new Driver(foFile, null);

        System.out.println("printFo 2");

        PrinterJob pj = PrinterJob.getPrinterJob();

        System.out.println("printFo 3");

        PrintRenderer renderer = new PrintRenderer(pj);

        System.out.println("printFo 4");

        driver.setRenderer(renderer);

        System.out.println("printFo 5");

        driver.run();
        } catch (Exception ex) {
    }
 }

The trace displays printFo and printFo2 and then nothing...
Do you have an idea (I hope I provided enough information) ?
Thanks again.


Jeremias Maerki-2 wrote:
> 
> Please take a look at the follow FAQ entry:
> http://xmlgraphics.apache.org/fop/faq.html#iex-pdf-print-from-browser
> 
> HTH
> 
> On 11.02.2009 20:38:06 jgfa9 wrote:
>> 
>> Hi all,
>> The following message, posted on the list in 2004 exactly describes my
>> situation : I'm able to print a generated pdf file directly on printer
>> (not
>> prompted to be opened) on the app server default printer but I'm not able
>> to
>> print on the client default printer.
>> Thanks in advance for your help.
>> 
>> On Thu, 2004-10-21 at 00:29, Manoj_Nair@spe.sony.com wrote:
>> > My requirement is to render an XML as  a PDF and then print the PDF on
>> the
>> > clients default printer. I dont want the PDF to prompt user to open the
>> > acrobat reader.
>> > 
>> > I already have an applet on the client side which uses PrinterJob class
>> to
>> > popup the printer selection box on client side.
>> > 
>> > Now how do I redirect the content from server to this printer?
>> > 
>> > Should I use Driver.RENDER_PRINT / Driver.RENDER_PCL set in the fop
>> driver
>> > renderer ? and what content type should the response object return?
>> > 
>> > Thanks
>> > Manoj
>> > 
>> > PS: I have successfully use the FopPrinter example ( FopPrintServlet )
>> to
>> > print pdfs on the app servers default printer but what I need is to be
>> > able
>> > to print on the clients default printer and not on servers printer.
>> > 
>> 
>> -- 
>> View this message in context:
>> http://www.nabble.com/Printing-PDF-on-the-client-default-printer.-tp21962598p21962598.html
>> Sent from the FOP - Users mailing list archive at Nabble.com.
>> 
> 
> 
> 
> Jeremias Maerki
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Printing-PDF-on-the-client-default-printer.-tp21962598p21962945.html
Sent from the FOP - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: Printing PDF on the client default printer.

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
Please take a look at the follow FAQ entry:
http://xmlgraphics.apache.org/fop/faq.html#iex-pdf-print-from-browser

HTH

On 11.02.2009 20:38:06 jgfa9 wrote:
> 
> Hi all,
> The following message, posted on the list in 2004 exactly describes my
> situation : I'm able to print a generated pdf file directly on printer (not
> prompted to be opened) on the app server default printer but I'm not able to
> print on the client default printer.
> Thanks in advance for your help.
> 
> On Thu, 2004-10-21 at 00:29, Manoj_Nair@spe.sony.com wrote:
> > My requirement is to render an XML as  a PDF and then print the PDF on the
> > clients default printer. I dont want the PDF to prompt user to open the
> > acrobat reader.
> > 
> > I already have an applet on the client side which uses PrinterJob class to
> > popup the printer selection box on client side.
> > 
> > Now how do I redirect the content from server to this printer?
> > 
> > Should I use Driver.RENDER_PRINT / Driver.RENDER_PCL set in the fop driver
> > renderer ? and what content type should the response object return?
> > 
> > Thanks
> > Manoj
> > 
> > PS: I have successfully use the FopPrinter example ( FopPrintServlet ) to
> > print pdfs on the app servers default printer but what I need is to be
> > able
> > to print on the clients default printer and not on servers printer.
> > 
> 
> -- 
> View this message in context: http://www.nabble.com/Printing-PDF-on-the-client-default-printer.-tp21962598p21962598.html
> Sent from the FOP - Users mailing list archive at Nabble.com.
> 



Jeremias Maerki


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org