On Thu, Mar 25, 2010 at 4:20 PM, Maruan Sahyoun <[email protected]> wrote:
> Hi Oguz,
>
Hi,
> you need to set the document to be printed by adding
> printJob.setPageable(document).
>
> If you do document.print() which - is an alternative - the generation of the
> printJob is done from within the document itself.
>
That solved my problem. Thanx.
But now i got the below warning:
INFO: unsupported/disabled operation: BDC
Mar 26, 2010 3:03:10 PM org.apache.pdfbox.util.PDFStreamEngine processOperator
INFO: unsupported/disabled operation: EMC
I googled and saw that the 1.0.1 snapshot, this problem is solved. I
checked the svn but i am not sure how i will prepare the jar file of
the current snapshot. Can you guide me?
> Maruan Sahyoun
>
> Am 25.03.2010 um 15:12 schrieb Oguz Yarimtepe:
>
>> Hi all,
>>
>> I was trying to select tray while printing my pdf file. Below is the
>> exaple code i am working,
>>
>> PDDocument document = null;
>> try
>> {
>> document = new PDDocument();
>> document = PDDocument.load("Fatura.pdf");
>> PrinterJob printJob = PrinterJob.getPrinterJob();
>>
>> PrintService service =
>> PrintServiceLookup.lookupDefaultPrintService();
>> if (service != null)
>> {
>> msg = " % selected printer " + service.getName();
>> showMsg(msg);
>>
>> printJob.setPrintService(service);
>>
>> HashPrintRequestAttributeSet attrSet = new
>> HashPrintRequestAttributeSet();
>> attrSet.add(MediaSizeName.ISO_A4);
>> attrSet.add(MediaTray.BOTTOM);
>> attrSet.add(new Copies(1));
>>
>> printJob.print(attrSet);
>>
>> msg = "Print is sent";
>> showMsg(msg);
>> }
>> else
>> {
>> msg = " % No printer found ";
>> showMsg(msg);
>> }
>> }
>> catch (IOException ioe)
>> {
>> showMsg(ioe.toString());
>> }
>> catch (PrinterException pe)
>> {
>> showMsg(pe.toString());
>> }
>> finally
>> {
>> try
>> {
>> if (document != null)
>> {
>> document.close();
>> }
>> }
>> catch (IOException ioe)
>> {
>> showMsg(ioe.toString());
>> }
>> }
>>
>> When i call printJob.print(attrSet), i dont see any printing
>> activity. But whenever i call document.silentPrint(printJob) i can see
>> that the pdf file is sent. I want to set the printing attributes
>> before sending the pdf file to printer. How can i do it?
>>
>> Thanx.
>>
>> --
>> Oğuz Yarımtepe
>> www.loopbacking.info
>
>
--
Oğuz Yarımtepe
www.loopbacking.info