pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mickael Marrache <mickaelmarra...@gmail.com>
Subject Re: Text appears reverted in textbox
Date Fri, 28 Apr 2017 08:03:36 GMT
Yes - I'm looking for a Java library. I heard about iText and BFO but they
are not free. Also heard about Apache FOP but I'm not sure if it is
applicable.

Thanks,
Mickael

On Fri, Apr 28, 2017 at 8:59 AM, Maruan Sahyoun <sahyoun@fileaffairs.de>
wrote:

> Hi,
> > Am 28.04.2017 um 05:44 schrieb Mickael Marrache <
> mickaelmarrache@gmail.com>:
> >
> > Thanks for looking at this.
> >
> > Is there an estimate for when PDFBox will be able to support it?
> >
>
> no, as this is a volunteers effort I can't give you any timing on this. We
> are planning to do it but maybe in another major release as one of the
> options we are looking into is dependent on Java 8 (and we are just moving
> to Java 7 for PDFBox 3.0).
>
> Is it Java libraries you are looking for? I could give you some names but
> as I havn't tried filling forms in Hebrew with these I don't know if they
> are able to handle your requirements.
>
> BR
> Maruan
>
>
> > 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" <sahyoun@fileaffairs.de> a
> é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
> need 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 …).
> >>
> >> 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 <sahyoun@fileaffairs.de>
> >> 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 =
> >>>>> PDDocument.load(this.getClass().getClassLoader().
> >> getResourceAsStream("form.pdf"));
> >>>>> PDAcroForm acroForm = pdfDocument.getDocumentCatalog().
> getAcroForm();
> >>>>>
> >>>>> PDResources formResources = acroForm.getDefaultResources();
> >>>>> PDTrueTypeFont font = (PDTrueTypeFont)
> >>>>> formResources.getFont(COSName.getPDFName("David,Bold"));
> >>>>>
> >>>>> TrueTypeFont ttFont = font.getTrueTypeFont();
> >>>>>
> >>>>> PDFont font2 = PDType0Font.load(pdfDocument, ttFont, true);
> >>>>> ttFont.close();
> >>>>>
> >>>>> formResources.put(COSName.getPDFName("F0"), font2);
> >>>>>
> >>>>> if (acroForm != null) {
> >>>>> PDTextField field = (PDTextField) acroForm.getField("full_name");
> >>>>> field.setDefaultAppearance("/F0 10 Tf 0 g");
> >>>>> field.setValue(/* hebrew text here*/);
> >>>>> }
> >>>>>
> >>>>> File targetFile = 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
> >>
> >>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message