You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by Mickael Marrache <mi...@gmail.com> on 2017/04/26 06:19:06 UTC
Text appears reverted in textbox
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
.
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
Re: Text appears reverted in textbox
Posted by Mickael Marrache <mi...@gmail.com>.
Hi Tilman,
I tried AcroForm.setNeedAppearances(true) in the past but you mentioned on
Stackoverflow that the resulting document will only be readable on Adobe
Reader, and I checked - only Adobe Reader renders it correctly - other
readers display default values.
I'm not sure it's related to the JIRA issue you mentioned since I don't see
any exception - PDF is generated correctly.
I'll wait...
Thanks,
Mickael
On Thu, Apr 27, 2017 at 9:29 PM, Tilman Hausherr <TH...@t-online.de>
wrote:
> Am 27.04.2017 um 20:24 schrieb Mickael Marrache:
>
>> Hi,
>>
>> Any news with this issue?
>>
>
> Be patient... maybe he's busy... or maybe it is a known weakness:
> https://issues.apache.org/jira/browse/PDFBOX-3138
>
> We're not good with complex scripts and RTL fonts :-(
>
> What you could try, is to call AcroForm.setNeedAppearances(true).
>
> Tilman
>
>
>
>> Thanks,
>> Mickael
>>
>> On Wed, Apr 26, 2017 at 1:34 PM, Mickael Marrache <
>> mickael@wakeuppension.com
>>
>>> wrote:
>>> 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 <sa...@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
>
>
Re: Text appears reverted in textbox
Posted by Tilman Hausherr <TH...@t-online.de>.
Am 27.04.2017 um 20:24 schrieb Mickael Marrache:
> Hi,
>
> Any news with this issue?
Be patient... maybe he's busy... or maybe it is a known weakness:
https://issues.apache.org/jira/browse/PDFBOX-3138
We're not good with complex scripts and RTL fonts :-(
What you could try, is to call AcroForm.setNeedAppearances(true).
Tilman
>
> Thanks,
> Mickael
>
> On Wed, Apr 26, 2017 at 1:34 PM, Mickael Marrache <mickael@wakeuppension.com
>> wrote:
>> 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 <sa...@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
Re: Text appears reverted in textbox
Posted by Mickael Marrache <mi...@gmail.com>.
Hi,
Any news with this issue?
Thanks,
Mickael
On Wed, Apr 26, 2017 at 1:34 PM, Mickael Marrache <mickael@wakeuppension.com
> wrote:
> 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 <sa...@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
>
>
Re: Text appears reverted in textbox
Posted by Gilad Denneboom <gi...@gmail.com>.
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 <mickaelmarrache@gmail.com
> 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" <sa...@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 <sa...@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
> >
> >
>
Re: Text appears reverted in textbox
Posted by Maruan Sahyoun <sa...@fileaffairs.de>.
> Am 28.04.2017 um 10:03 schrieb Mickael Marrache <mi...@gmail.com>:
>
> 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.
many are not free for commercial use.
in addition to the ones you mentioned
Datalogics PDF Java Toolkit http://www.datalogics.com/products/pdf/pdfjavatoolkit/
PDFTron http://www.pdftron.com/pdfnet/index.html
Quoppa https://www.qoppa.com/pdffields/
to name some.
Apache FOP would be a good option for PDF generation from scratch.
There might be others I'm not aware of which can fulfill your needs. Maybe some more people comment on that thread.
Maruan
PS: implementing complex-text support for PDFBox will propably be several weeks (if not months) effort.
>
> Thanks,
> Mickael
>
> On Fri, Apr 28, 2017 at 8:59 AM, Maruan Sahyoun <sa...@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" <sa...@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 <sa...@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
>>
>>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org
Re: Text appears reverted in textbox
Posted by Mickael Marrache <mi...@gmail.com>.
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 <sa...@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" <sa...@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 <sa...@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
>
>
Re: Text appears reverted in textbox
Posted by Maruan Sahyoun <sa...@fileaffairs.de>.
Hi,
> Am 28.04.2017 um 05:44 schrieb Mickael Marrache <mi...@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" <sa...@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 <sa...@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
Re: Text appears reverted in textbox
Posted by Mickael Marrache <mi...@gmail.com>.
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" <sa...@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 <sa...@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
>
>
Re: Text appears reverted in textbox
Posted by Maruan Sahyoun <sa...@fileaffairs.de>.
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 <mi...@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 <sa...@fileaffairs.de> wrote:
>> Hi,
>>
>>> Am 26.04.2017 um 08:19 schrieb Mickael Marrache <mi...@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
Re: Text appears reverted in textbox
Posted by Mickael Marrache <mi...@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 <sa...@fileaffairs.de> wrote:
> Hi,
>
> > Am 26.04.2017 um 08:19 schrieb Mickael Marrache <mi...@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
Re: Text appears reverted in textbox
Posted by Maruan Sahyoun <sa...@fileaffairs.de>.
Hi,
> Am 26.04.2017 um 08:19 schrieb Mickael Marrache <mi...@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