Return-Path: X-Original-To: apmail-pdfbox-users-archive@www.apache.org Delivered-To: apmail-pdfbox-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 5A2A610118 for ; Thu, 21 Nov 2013 08:03:30 +0000 (UTC) Received: (qmail 12867 invoked by uid 500); 21 Nov 2013 08:03:29 -0000 Delivered-To: apmail-pdfbox-users-archive@pdfbox.apache.org Received: (qmail 12197 invoked by uid 500); 21 Nov 2013 08:03:20 -0000 Mailing-List: contact users-help@pdfbox.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@pdfbox.apache.org Delivered-To: mailing list users@pdfbox.apache.org Received: (qmail 11719 invoked by uid 99); 21 Nov 2013 08:03:18 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 21 Nov 2013 08:03:18 +0000 X-ASF-Spam-Status: No, hits=2.2 required=5.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [195.228.124.9] (HELO mail2.mve.hu) (195.228.124.9) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 21 Nov 2013 08:03:11 +0000 Received: from localhost (localhost [127.0.0.1]) by mail2.mve.hu (Postfix) with ESMTP id C237A2C01E1 for ; Thu, 21 Nov 2013 09:02:50 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mail2.mve.hu Received: from mail2.mve.hu ([127.0.0.1]) by localhost (mail2.mve.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id l0uSDXs9jcyC for ; Thu, 21 Nov 2013 09:02:50 +0100 (CET) Received: from [172.16.174.85] (gistvan25.local [172.16.174.85]) (Authenticated sender: gistvan@mve.hu) by mail2.mve.hu (Postfix) with ESMTPSA id 1D3FA2C01AE for ; Thu, 21 Nov 2013 09:02:50 +0100 (CET) Message-ID: <528DBE2A.9090606@mve.hu> Date: Thu, 21 Nov 2013 09:02:50 +0100 From: =?ISO-8859-1?Q?Gyenes_Istv=E1n?= User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.1.1 MIME-Version: 1.0 To: users@pdfbox.apache.org Subject: Re: PDDocument getPrintable endless loop References: <528CD4A9.5090507@mve.hu> In-Reply-To: Content-Type: multipart/alternative; boundary="------------080808060500040209070501" X-Virus-Checked: Checked by ClamAV on apache.org --------------080808060500040209070501 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Dear Gilad Denneboom, thank you advices, I modify my code, but it still not working. The print command looping and newer end. Not one page send to printer, unending page number is sending. This is my code now: PDDocument pdf = PDDocument.load("c:\\Java\\nb74_projects\\lpu\\AISB08.pdf"); PrintService[] ps = PrinterJob.lookupPrintServices(); int x=0; for (x=0; x Not sure why it's happening, but why not add a break command when you find > the printer you want to print to (after you sent the print command, of > course)? > Also, Java arrays are zero-based, so the initial value of x should probably > be 0, not 1. > > > On Wed, Nov 20, 2013 at 4:26 PM, Gyenes Istv�n wrote: > >> Hi All! >> >> I'm new in BDFBox. >> I try to print one page to specified tray, but it is make an endless >> printing loop. I do something wrong or it is a bug in the library? >> My source code is: >> PDDocument pdf = PDDocument.load("c:\\Java\\nb74_projects\\lpu\\AISB08. >> pdf"); >> PrintService[] ps = PrinterJob.lookupPrintServices(); >> for (int x=1; x> System.out.println(ps[x].getName()); >> if (ps[x].getName().compareTo("Canon Generic PCL6 >> Driver")==0) { >> PrinterJob pj = PrinterJob.getPrinterJob(); >> pj.setPrintService(ps[x]); >> PrintRequestAttributeSet pset = new >> HashPrintRequestAttributeSet(); >> pset.add(MediaTray.TOP); >> pj.setPrintable(pdf.getPrintable(0)); >> pj.print(pset); >> } >> } >> >> Big thanks for any help! >> Stephen Gyenes >> --------------080808060500040209070501--