Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id F0747200C64 for ; Fri, 28 Apr 2017 11:13:36 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id EEFA8160BA3; Fri, 28 Apr 2017 09:13:36 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 1975E160B8C for ; Fri, 28 Apr 2017 11:13:35 +0200 (CEST) Received: (qmail 85332 invoked by uid 500); 28 Apr 2017 09:13:35 -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 85285 invoked by uid 99); 28 Apr 2017 09:13:32 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 28 Apr 2017 09:13:32 +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 A2C33C031B for ; Fri, 28 Apr 2017 09:13:31 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 3.379 X-Spam-Level: *** X-Spam-Status: No, score=3.379 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_REPLY=1, HTML_MESSAGE=2, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_SORBS_SPAM=0.5, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd4-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id EGkQXpck71ca for ; Fri, 28 Apr 2017 09:13:29 +0000 (UTC) Received: from mail-yb0-f170.google.com (mail-yb0-f170.google.com [209.85.213.170]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id CEC585FB29 for ; Fri, 28 Apr 2017 09:13:28 +0000 (UTC) Received: by mail-yb0-f170.google.com with SMTP id p143so13976152yba.2 for ; Fri, 28 Apr 2017 02:13:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=DwLJqZxm2OYcN1J4tAA7z+ULkVyBbmuF7uvWLwDG7L4=; b=bi2You6zPaH/csHCGUeY3hdEOfHrYSTFv9xjFGugCro6cDxPd5kTO7COQEea796A0R PfGB8kTqvo4vKtFsNsODRIYWWaffKpcf3y+BRCww1cvwnpeLcVRWQq0JQ2y+Kzm7Slud MHB3g6e7GesV4OMBHNr0nhQVpshw79TIW95EnNq4oT/NczrzMIN2qWFa/QA1m+cFdtlk D4bqqB/byaMYKNfJBHGkMdEOExUlab50mVuXfxOPA8Y6HRB4kupG5cg1J0bYDJLm0RiL N2wTo0lYCQLnU+2Ulq5cBsYmQj2qulD8MWlIuxzRpM80mQEiEJjujNNIoieJ91BChKlv nTEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=DwLJqZxm2OYcN1J4tAA7z+ULkVyBbmuF7uvWLwDG7L4=; b=e5rJ0chpCGYzvf3HsLg6VxaO/PCe0z/6xHx4jPldgQjQVWiYvgX23OETiAcLuuKgsj e47vsWVXawlHnIEohhj8kuZe9tUN/nmKXuWiYA0hyiGOiXfDIue5E7qC33RHIDxdha84 5gs42A2HOSOOjkjnEVuDMNhItq8Jr9PYX4Y76S9jAmQCwOjbzCmBFi75VCaU5U1SJKFQ K1zLC9uAsA8sYKVCnISDW1GCUrdbCOhkp68kLOXeqx/84brQcHRLPCiL4ECPWcZ5vyeD dz3wOcup465fs/dJ0DMCm7klsaPOXR6GvdqMvrS3cWtwp1TZ9XaGPRMYmmqS55U8y11x 0HQg== X-Gm-Message-State: AN3rC/5wV5vUsy5bemNyN3chLtpIL5TWTjQ/Vpznwn1fnyor5MeJoE4r 3kw+zRos0XPEkUWMJe6jdESXWA5Tag== X-Received: by 10.37.20.138 with SMTP id 132mr8245289ybu.0.1493370796808; Fri, 28 Apr 2017 02:13:16 -0700 (PDT) MIME-Version: 1.0 Received: by 10.13.198.135 with HTTP; Fri, 28 Apr 2017 02:12:56 -0700 (PDT) In-Reply-To: References: <294B0B1E-E183-4CE6-80B8-7D9C98DF7BA4@fileaffairs.de> <4CB8CAC1-D9F0-4C1E-826C-E3D6FA438F62@fileaffairs.de> From: Gilad Denneboom Date: Fri, 28 Apr 2017 11:12:56 +0200 Message-ID: Subject: Re: Text appears reverted in textbox To: "users@pdfbox.apache.org" Content-Type: multipart/alternative; boundary=001a113e710cdca76a054e367b2a archived-at: Fri, 28 Apr 2017 09:13:37 -0000 --001a113e710cdca76a054e367b2a Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable When I faced a similar issue I followed Tilman's advice in the JIRA issue I opened about it (and which was linked to above), and it worked fine. Basically what I did was create the form fields in Acrobat in advance and set them as having Adobe Hebrew as their font. That forces the font to be embedded in the PDF. I then applied the value using PDFBox and set the NeedsAppearances flag as true. When I open the file in Acrobat/Reader the text appeared correctly. I'm not sure about other PDF viewers, though. They are generally problematic when it comes to form fields in general, so I try to avoid them= . On Fri, Apr 28, 2017 at 5:44 AM, Mickael Marrache wrote: > Thanks for looking at this. > > Is there an estimate for when PDFBox will be able to support it? > > Could you please propose alternative libraries that we can use in the > meantime? Free libraries preferred but not only. > > Thanks, > Mickael > > Le 28 avr. 2017 01:14, "Maruan Sahyoun" a =C3=A9= crit : > > > OK, I had a look at this. > > > > At this point in time PDFBox doesn't support the appearance generation > for > > RTL text. The reason you see the text reverted is because one would nee= d > to > > handle the text in visual order. > > > > So where PDFBox writes the string as > > > > \000\250\000\243\000\245\000\232\000\246 > > > > Adobe Reader writes the string as > > > > \000\246\000\232\000\245\000\243\000\250 > > > > This could be fixed but wouldn't be sufficient to completely handle > Hebrew > > and other languages whith complex-text requirements (word forming, > > character shaping, BIDI =E2=80=A6). > > > > At that point in time PDFBox doesn't provide the capabilites needed. > > > > BR > > Maruan > > > > > > > Am 26.04.2017 um 12:34 schrieb Mickael Marrache < > > mickael@wakeuppension.com>: > > > > > > The PDF before filling: > > > > > > http://docdro.id/ybLln7x > > > > > > The PDF after filling: > > > > > > http://docdro.id/QcZfT9H > > > > > > On 2017-04-26 10:56 (+0300), Maruan Sahyoun > > wrote: > > >> Hi, > > >> > > >>> Am 26.04.2017 um 08:19 schrieb Mickael Marrache < > > mickaelmarrache@gmail.com>: > > >>> > > >>> Hi, > > >>> > > >>> I'm trying to fill a PDF form using PDFBox 2.0.5 as follows: > > >>> > > >>> PDDocument pdfDocument =3D > > >>> PDDocument.load(this.getClass().getClassLoader(). > > getResourceAsStream("form.pdf")); > > >>> PDAcroForm acroForm =3D pdfDocument.getDocumentCatalog(). > getAcroForm(); > > >>> > > >>> PDResources formResources =3D acroForm.getDefaultResources(); > > >>> PDTrueTypeFont font =3D (PDTrueTypeFont) > > >>> formResources.getFont(COSName.getPDFName("David,Bold")); > > >>> > > >>> TrueTypeFont ttFont =3D font.getTrueTypeFont(); > > >>> > > >>> PDFont font2 =3D PDType0Font.load(pdfDocument, ttFont, true); > > >>> ttFont.close(); > > >>> > > >>> formResources.put(COSName.getPDFName("F0"), font2); > > >>> > > >>> if (acroForm !=3D null) { > > >>> PDTextField field =3D (PDTextField) acroForm.getField("full_name"); > > >>> field.setDefaultAppearance("/F0 10 Tf 0 g"); > > >>> field.setValue(/* hebrew text here*/); > > >>> } > > >>> > > >>> File targetFile =3D File.createTempFile("", ".pdf"); > > >>> pdfDocument.save(targetFile); > > >>> pdfDocument.close(); > > >>> > > >>> The reason I embed the David,Bold font is explained here > > >>> http://stackoverflow.com/questions/42903217/write- > > cyrillic-chars-into-pdf-form-fields-with-pdfbox > > >> > > >> > > >> could you upload a PDF before and after filling to a public location= ? > > >> > > >> BR > > >> Maruan > > >> > > >> > > >>> . > > >>> > > >>> The issue is that the resulting PDF file has the text in the > full_name > > >>> textbox displayed in the reverse direction. However, if I click on > the > > >>> textbox, the text appears correctly. I precise that the text filled > in > > the > > >>> textbox is in Hebrew (right-to-left). > > >>> > > >>> Any idea? > > >>> > > >>> Thanks, > > >>> Mickael > > >> > > >> > > >> --------------------------------------------------------------------= - > > >> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org > > >> For additional commands, e-mail: users-help@pdfbox.apache.org > > >> > > >> > > > > > > --------------------------------------------------------------------- > > > To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org > > > For additional commands, e-mail: users-help@pdfbox.apache.org > > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org > > For additional commands, e-mail: users-help@pdfbox.apache.org > > > > > --001a113e710cdca76a054e367b2a--