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 C60D597BE for ; Tue, 7 Feb 2012 16:50:39 +0000 (UTC) Received: (qmail 73843 invoked by uid 500); 7 Feb 2012 16:50:39 -0000 Delivered-To: apmail-pdfbox-users-archive@pdfbox.apache.org Received: (qmail 73723 invoked by uid 500); 7 Feb 2012 16:50:38 -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 73709 invoked by uid 99); 7 Feb 2012 16:50:38 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 07 Feb 2012 16:50:38 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of marc@goprint.com designates 162.42.205.68 as permitted sender) Received: from [162.42.205.68] (HELO mail.ivertex.com) (162.42.205.68) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 07 Feb 2012 16:50:30 +0000 Received: (qmail 1697 invoked by uid 210); 7 Feb 2012 16:50:09 -0000 Received: from office.ivertex.com by mail (envelope-from , uid 201) with qmail-scanner-2.08st (clamdscan: 0.97/14411. spamassassin: 3.3.1. perlscan: 2.08st. Clear:RC:1(216.161.162.88):. Processed in 0.028524 secs); 07 Feb 2012 16:50:09 -0000 Received: from office.ivertex.com (HELO marc-imac.office.ivertex.com) (216.161.162.88) by mail.local with SMTP; 7 Feb 2012 16:50:09 -0000 Content-Type: text/plain; charset=iso-8859-1 Mime-Version: 1.0 (Apple Message framework v1251.1) Subject: Re: Printing on Windows - Set Job Owner Name? From: Marc Rainville In-Reply-To: <1328561596.71478.YahooMailNeo@web88608.mail.bf1.yahoo.com> Date: Tue, 7 Feb 2012 09:50:08 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: <379D3A85-2572-469E-AC19-7291054EC759@goprint.com> References: <1328561596.71478.YahooMailNeo@web88608.mail.bf1.yahoo.com> To: "users@pdfbox.apache.org" , Mike Kuindersma X-Mailer: Apple Mail (2.1251.1) You may want to check the "notify" field on the print document = properties in Windows; this field is usually used to mark the user when = a job is printed through a process account. I don't think it's possible = to change the owner. Thanks, Marc=20 On Feb 6, 2012, at 1:53 PM, Mike Kuindersma wrote: > I'm using PDFBox-1.6.0 on Windows XP SP3 with Sun JRE 1.6.0_24. >=20 >=20 > The following code fragment prints the target PDF and the job shows up = in the Windows print queue with the proper Document Name but the Owner = field shows the userID of the User that launches the program, not the = text I requested "Requesting User Name". >=20 > Is there a way to get what I want? Am I doing it wrong? >=20 >=20 > PDDocument pdDoc =3D null; > try > { > pdDoc =3D PDDocument.load( "C:\\automatic-heap-sizing.pdf" = ); > =20 > PrinterJob printerJob =3D PrinterJob.getPrinterJob(); > =20 >=20 >=20 > PrintService printService =3D null; > PrintService[] printServices =3D = PrinterJob.lookupPrintServices(); >=20 > for( PrintService tPS : printServices ) > { > if( tPS.getName().equals( "Samsung ML-4550 Series PCL = 6" ) ) > { > printService =3D tPS; > break; > } > } >=20 > if( printService =3D=3D null ) > { > System.out.println( "Unable to locate specified = PrintService - cannot print!" ); > } > else > { > printerJob.setPrintService( printService ); > =20 > printerJob.setJobName( "automatic-heap-sizing.pdf" ); > =20 > PrintRequestAttributeSet as =3D new = HashPrintRequestAttributeSet(); > as.add( new RequestingUserName( "Requesting User = Name", Locale.getDefault() ) ); > =20 > printerJob.setPageable( new PDPageable( pdDoc, = printerJob ) ); > =20 > printerJob.print( as ); > } > } > catch( IOException ioe ) > { > System.out.println( "Caught IOException: " + = ioe.getClass().getName() + " - " + ioe.getMessage() ); > } > catch( PrinterException pe ) > { > System.out.println( "Caught PrinterException: " + = pe.getClass().getName() + " - " + pe.getMessage() ); > } > catch( Throwable t ) > { > System.out.println( "Caught Throwable: " + = t.getClass().getName() + " - " + t.getMessage() ); > } > finally > { > if( pdDoc !=3D null ) > { > try > { > pdDoc.close(); > } > catch( Throwable t ) > { > System.out.println( "Caught Throwable: " + = t.getClass().getName() + " - " + t.getMessage() ); > } > } > } >=20 >=20 >=20 > Regards, > Mike Kuindersma > mkuinder _at_ rogers.com