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 2F8291809D for ; Tue, 18 Aug 2015 08:12:01 +0000 (UTC) Received: (qmail 77612 invoked by uid 500); 18 Aug 2015 08:12:01 -0000 Delivered-To: apmail-pdfbox-users-archive@pdfbox.apache.org Received: (qmail 77590 invoked by uid 500); 18 Aug 2015 08:12:00 -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 77579 invoked by uid 99); 18 Aug 2015 08:12:00 -0000 Received: from Unknown (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 18 Aug 2015 08:12:00 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 26CD7C0BCF for ; Tue, 18 Aug 2015 08:12:00 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.001 X-Spam-Level: * X-Spam-Status: No, score=1.001 tagged_above=-999 required=6.31 tests=[KAM_LAZY_DOMAIN_SECURITY=1, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-us-west.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id VXvbrA4cFKDB for ; Tue, 18 Aug 2015 08:11:51 +0000 (UTC) Received: from www168.your-server.de (www168.your-server.de [213.133.104.168]) by mx1-us-west.apache.org (ASF Mail Server at mx1-us-west.apache.org) with ESMTPS id 19AE22055B for ; Tue, 18 Aug 2015 08:11:50 +0000 (UTC) Received: from [88.198.220.130] (helo=sslproxy01.your-server.de) by www168.your-server.de with esmtpsa (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.80.1) (envelope-from ) id 1ZRbzY-00035X-IX for users@pdfbox.apache.org; Tue, 18 Aug 2015 10:11:42 +0200 Received: from [79.242.126.68] (helo=mbp001.fritz.box) by sslproxy01.your-server.de with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.80) (envelope-from ) id 1ZRbzV-0000IK-9l for users@pdfbox.apache.org; Tue, 18 Aug 2015 10:11:29 +0200 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2104\)) Subject: Re: Supporting Unicode characters to fill in an existing PDF with Acroforms From: Maruan Sahyoun In-Reply-To: Date: Tue, 18 Aug 2015 10:11:25 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: References: To: users@pdfbox.apache.org X-Mailer: Apple Mail (2.2104) X-Authenticated-Sender: sahyoun@fileaffairs.de X-Virus-Scanned: Clear (ClamAV 0.98.5/20801/Tue Aug 18 02:36:38 2015) Hi, > Am 18.08.2015 um 00:49 schrieb Rakshit Ashtekar : >=20 > Hello, >=20 > I am using PDFBox 2.0 dev snapshot to support Unicode characters. I = have > few questions: >=20 > I want to write an existing PDF file which have few PDTextField with > Unicode characters. >=20 > I am using PDType0Font to load an external .ttf file > (Arial-Unicode-Regular.ttf) and setting the new font object to the > PDResources. Code snippet below: >=20 > PDType0Font font =3D PDType0Font.load(pdfDocument, new > File("Arial-Unicode-Regular.ttf")); > // Add and set the resources and default appearance at the form level > PDResources res =3D new PDResources(); > COSName fontName =3D res.add(font); > acroForm.setDefaultResources(res); > String da =3D "/" + fontName.getName() + " 12 Tf 0 g"; > acroForm.setDefaultAppearance(da); >=20 > But I am getting below exception > java.io.IOException: Could not find font: /CourierNewPSMT > at > = org.apache.pdfbox.pdmodel.interactive.form.PDAppearanceString.getFont(PDAp= pearanceString.java:126) the reason is very likely that the field you are trying to fill has a = default appearance where the font is set to CourierNewPSMT. You need to = also set the default appearance for the field to use the loaded font. If you could upload your file to a public location I can take a closer = look. >=20 > I saw a similar ticket - = https://issues.apache.org/jira/browse/PDFBOX-2848 >=20 > *My questions:* > 1. Does PDFBox 2.0 supports Unicode characters values to be set on an > existing PDF file which has PDTextField using setValue(String value) = of the > PDTextField? I saw an example where Unicode characters are supported = but > that PDF is created from scratch and it did not have AcroForms. Unicode for field values is supported as of PDFBox 2.0 >=20 > 2. Will the .ttf file currently in sources of / > pdfbox/src/main/resources/org/apache/pdfbox/resources/ttf/ be packaged = with > the final PDFBox jar? or the developers have to load it externally? Yes, BR Maruan >=20 > Appreciate your help. >=20 > Thanks, > Rakshit --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org For additional commands, e-mail: users-help@pdfbox.apache.org