Return-Path: Delivered-To: apmail-pdfbox-users-archive@www.apache.org Received: (qmail 20798 invoked from network); 8 Dec 2009 09:55:41 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 8 Dec 2009 09:55:41 -0000 Received: (qmail 86385 invoked by uid 500); 8 Dec 2009 09:55:40 -0000 Delivered-To: apmail-pdfbox-users-archive@pdfbox.apache.org Received: (qmail 86357 invoked by uid 500); 8 Dec 2009 09:55:39 -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 Delivered-To: moderator for users@pdfbox.apache.org Received: (qmail 98669 invoked by uid 99); 7 Dec 2009 18:16:06 -0000 X-ASF-Spam-Status: No, hits=-1.8 required=10.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_MED,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) X-ASG-Debug-ID: 1260211706-720500920000-ulvbhl X-Barracuda-URL: http://10.1.30.72:8000/cgi-bin/mark.cgi X-ASG-Whitelist: Client X-MimeOLE: Produced By Microsoft Exchange V6.5 X-Barracuda-BBL-IP: 10.1.0.161 X-Barracuda-RBL-IP: 10.1.0.161 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01CA7769.419BA9CD" X-ASG-Orig-Subj: RE: PDFBox and barcode fonts Subject: RE: PDFBox and barcode fonts Date: Mon, 7 Dec 2009 13:15:28 -0500 Message-ID: <696502EF39A9E84D8BAD4426F01BE43D01122D6A@TDSEMAIL02.tdsautomotive.com> In-Reply-To: <4B1CAA32.3050000@lehmi.de> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: PDFBox and barcode fonts thread-index: Acp3DE8fHxL9psKJTYOOTmleWp7ryQAWcpqw References: <696502EF39A9E84D8BAD4426F01BE43D01122BCE@TDSEMAIL02.tdsautomotive.com> <4B1CAA32.3050000@lehmi.de> From: "Alex Reichman" To: X-OriginalArrivalTime: 07 Dec 2009 18:15:29.0304 (UTC) FILETIME=[41D21980:01CA7769] X-Barracuda-Connect: UNKNOWN[10.1.0.169] X-Barracuda-Start-Time: 1260211706 X-Barracuda-Virus-Scanned: by Barracuda Spam Firewall at tdsautomotive.com X-Virus-Checked: Checked by ClamAV on apache.org ------_=_NextPart_001_01CA7769.419BA9CD Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hello Andreas, =20 Thanks for your reply! =20 I signed up to mailing list but when I am trying to sign in it freeze my = screen. =20 I have downloaded the latest versions of PdfBox and FontBox. There is no = error message (org.pdfbox.pdmodel.font.PDType0Font cannot=20 > be cast to org.pdfbox.pdmodel.font.PDType1Font) but I am still getting = the exception NULL and report is not printed. I can print easily the = report without barcodes. =20 while (setInt.hasNext()) { String val =3D (String) setInt.next(); =20 PDType1Font pdt =3D (PDType1Font) map.get(val); = // Error is here write_message("'" + val + " " + = pdt.getFontDescriptor().getFontName() + "'"); =20 // Load the Fonts into the Fx Location in the = PDF. write_message("Attemting to loadFontsByName"); PDFont currFont =3D = this.loadFontByName(document, pdt.getFontDescriptor().getFontName(), = val); =20 if (currFont !=3D null) { = currentPage.findResources().getFonts().put(val, currFont); } } DEBUG MESSAGE DirectPrint0: Font = org.apache.pdfbox.pdmodel.font.PDTrueTypeFont@10ebe18 -- this is the = font "V100025_.TTF" DEBUG MESSAGE DirectPrint0: Pages list is NOT empty DEBUG MESSAGE DirectPrint0: Map is: = {F1=3Dorg.apache.pdfbox.pdmodel.font.PDType1Font@161f39e, = F0=3Dorg.apache.pdfbox.pdmodel.font.PDType1Font@1c13d0b, = F2=3Dorg.apache.pdfbox.pdmodel.font.PDType0Font@18eb7b8} DEBUG MESSAGE DirectPrint0: Map KeySet DEBUG MESSAGE DirectPrint0: Map iterator inited DEBUG MESSAGE DirectPrint0: 'F1 Arial,Bold' DEBUG MESSAGE DirectPrint0: Attemting to loadFontsByName DEBUG MESSAGE DirectPrint0: Running loadFontByName DEBUG MESSAGE DirectPrint0: Font not loaded: Arial,Bold DEBUG MESSAGE DirectPrint0: Font not loaded: Arial,Bold DEBUG MESSAGE DirectPrint0: 'F0 Arial' DEBUG MESSAGE DirectPrint0: Attemting to loadFontsByName DEBUG MESSAGE DirectPrint0: Running loadFontByName DEBUG MESSAGE DirectPrint0: Font not loaded: Arial DEBUG MESSAGE DirectPrint0: Font not loaded: Arial DEBUG MESSAGE DirectPrint0: Exception in sendPDFURLToPrinter: null DEBUG MESSAGE DirectPrint0: Document Closed =20 I have also tried to load the font as it explained = http://pdfbox.apache.org/userguide/fonts.html (see the code below) but = this is not working either and its giving the exception null as well. =20 int index1 =3D val.indexOf("F2") ; write_message (" index " + index1 ) ; write_message("Val " + val) ; if ( index1 !=3D -1 ) { PDFont currFont =3D = PDTrueTypeFont.loadTTF(document, new File( = "C:\\Windows\\Fonts\\V100025_.TTF")); write_message("font " + currFont ) ; if (currFont !=3D null)=20 = currentPage.findResources().getFonts().put(val, currFont) ; =20 } =20 Any help will be much appreciated Thanks =20 s y n c r e o n automotive Alex Reichman =20 Software Development Lead Direct NA +1 (905) 755-6136 Mobile NA +1 (416) 209-2047=20 Email alex.reichman@syncreon.com =20 =20 www.syncreon.com -----Original Message----- From: Andreas Lehmk=FChler [mailto:andreas@lehmi.de]=20 Sent: Monday, December 07, 2009 2:10 AM To: Alex Reichman Cc: users@pdfbox.apache.org Subject: Re: PDFBox and barcode fonts =20 Hi Alex, =20 Alex Reichman wrote: > =20 >=20 > Dear Andreas, >=20 > I saw your thread on markmail.org and I have one question to ask you=20 > regarding PdfBox. >=20 > We are using Pdfbox.-0.7.4 for sending the PDF file to client printer=20 > when printing from Oracle Reports 11g. > When I am adding alias mapping for barcode font C39P24DmTt =3D=20 > "V100025_.TTF" I am getting the following error: >=20 > Java code >=20 > while (setInt.hasNext()) { >=20 > String val =3D (String)setInt.next(); >=20 > write_message("Before cast"); >=20 > *PDType1Font pdt =3D (PDType1Font)map.get(val); // error is = here!!!!!* >=20 > write_message("After cast"); >=20 > write_message("'"+val+"=20 > "+pdt.getFontDescriptor().getFontName()+"'"); >=20 > // write_message("Printing after cast " +=20 > "'"+val+" "+pdt.getFontDescriptor().getFontName()+"'"); >=20 > PDFont currFont =3D=20 > = this.loadFontByName(document,pdt.getFontDescriptor().getFontName(),val); >=20 > if(currFont !=3D null) >=20 > { > currentPage.findResources().getFonts().put(val,currFont); > } >=20 > } >=20 > Error >=20 > DEBUG MESSAGE DirectPrint24: Map is:=20 > {F1=3Dorg.pdfbox.pdmodel.font.PDType0Font@91d7c,=20 > F0=3Dorg.pdfbox.pdmodel.font.PDType0Font@6ee404,=20 > F2=3Dorg.pdfbox.pdmodel.font.PDType0Font@3bfc47} >=20 > DEBUG MESSAGE DirectPrint24: org.pdfbox.pdmodel.font.PDType0Font = cannot=20 > be cast to org.pdfbox.pdmodel.font.PDType1Font >=20 >=20 > It looks like this font is not recognizable. >=20 >=20 > Any help or advice will be much appreciated. You're obviously expecting a type1 font but your pdf contains type0 = fonts.=20 Consequently your PDType1Font-cast has to throw an exception. I suggest to upgrade pdfbox to the 0.8-version [1]. It includes a lot of = improvements and fixes, probably your alias mapping will not be needed = anymore. =20 > Thanks, > Alex * * Please use our mailinglist [2] for further questions. I've cc'd my = answer to the=20 users list. =20 BR Andreas Lehmk=FChler =20 [1] http://pdfbox.apache.org/download.html [2] http://pdfbox.apache.org/mailing-list.html =20 ------_=_NextPart_001_01CA7769.419BA9CD--