You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by Sebastian Fieber <Se...@mentana.de> on 2020/06/17 13:48:12 UTC

PDFBOX-3812 improvement patch

Hey,

we are using PDFBox for one of our products and have a proposed
improvement for PDFBOX-3812.

The problem we are facing with the current implementation of
auto-sized multiline text fields is the following:

1. If the rectangle of the multiline text field has a reasonable height
   for a few lines and only a few characters are put in the text field
   the font will get too big, resulting in strange looking input.  If
   edited aftewards with Adobe Acrobat the font size is adjusted to 12pt
   (like the DEFAULT_FONT_SIZE).

2. Words are not broken if they are too long to fit in the width of the
   textbox.  The result is that the part not fitting is cut off.

The attached patch tries to fix these issues in the following way:

1. Use DEFAULT_FONT_SIZE instead of MAX_FONT_SIZE to calculate the
   maximum line height for multiline text fields

2. Test if a word is longer than the width if it is the only word
   present on a line.  If yes a similar alorithm to calculate the font
   size in 1. is used.

If there are any problems with the patch, please let me know.
-- 
Mit freundlichen Grüßen
Sebastian Fieber
Software Entwickler

Mentana-Claimsoft GmbH
EIN UNTERNEHMEN DER FP-GRUPPE
Griesbergstr. 8 · 31162 Bad Salzdetfurth
Trebuser Str. 47 · Haus 1 · 15517 Fürstenwalde
Tel: +49 (0)5063 277440 · Fax: +49 (0)5063 2774450
E-Mail: sebastian.fieber@mentana.de · De-Mail: sebastian.fieber@mentana.de-mail.de
Web: www.mentana-claimsoft.de · Blog: fp-francotyp.com/blog

Service Center De-Mail: 01806/ Mentana (6368262)
(0,20 € pro Anruf aus dem deutschen Festnetz, max. 0,60 € pro Anruf aus
dem deutschen Mobilfunknetz)

Service Center Signaturprodukte: 01806/ Signatur (74462887)
(0,20 € pro Anruf aus dem deutschen Festnetz, max. 0,60 € pro Anruf aus
dem deutschen Mobilfunknetz)

Geschäftsführung Stephan Vanberg, Patricius de Gruyter
HRB: 13886 - Amtsgericht Frankfurt/Oder

Re: PDFBOX-3812 improvement patch

Posted by Maruan Sahyoun <sa...@fileaffairs.de>.
 
Hi, 

> 
Thanks; please post attach your text and the patch to the issue you 
> mentioned. This way it is easier to communicate with you and and the 
> coments will be there as long as the bug tracker exists. If possible, 
> avoid making formatting changes to code that you didn't touch.
> 
> Tilman
> 
> Am 17.06.2020 um 15:48 schrieb Sebastian Fieber:
> > Hey,
> > 
> > we are using PDFBox for one of our products and have a proposed
> > improvement for PDFBOX-3812.
> > 
> > The problem we are facing with the current implementation of
> > auto-sized multiline text fields is the following:
> > 
> > 1. If the rectangle of the multiline text field has a reasonable height
> >     for a few lines and only a few characters are put in the text field
> >     the font will get too big, resulting in strange looking input.  If
> >     edited aftewards with Adobe Acrobat the font size is adjusted to 12pt
> >     (like the DEFAULT_FONT_SIZE).


Having done a quick test in Acrobat for a heigh text field with multi line and auto font sizing when entering a small portion of
text the font size will be large. See the attachments I added to PDFBOX-3812 just now.

BR
Maruan 


> > 
> > 2. Words are not broken if they are too long to fit in the width of the
> >     textbox.  The result is that the part not fitting is cut off.
> > 
> > The attached patch tries to fix these issues in the following way:
> > 
> > 1. Use DEFAULT_FONT_SIZE instead of MAX_FONT_SIZE to calculate the
> >     maximum line height for multiline text fields
> > 
> > 2. Test if a word is longer than the width if it is the only word
> >     present on a line.  If yes a similar alorithm to calculate the font
> >     size in 1. is used.
> > 
> > If there are any problems with the patch, please let me know.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: dev-help@pdfbox.apache.org
> 
-- 
Maruan Sahyoun

FileAffairs GmbH
Josef-Schappe-Straße 21
40882 Ratingen

Tel: +49 (2102) 89497 88
Fax: +49 (2102) 89497 91
sahyoun@fileaffairs.de
www.fileaffairs.de

Geschäftsführer: Maruan Sahyoun
Handelsregister: AG Düsseldorf, HRB 53837
UST.-ID: DE248275827


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org


Re: PDFBOX-3812 improvement patch

Posted by Tilman Hausherr <TH...@t-online.de>.
Hi,

Thanks; please post attach your text and the patch to the issue you 
mentioned. This way it is easier to communicate with you and and the 
coments will be there as long as the bug tracker exists. If possible, 
avoid making formatting changes to code that you didn't touch.

Tilman

Am 17.06.2020 um 15:48 schrieb Sebastian Fieber:
> Hey,
>
> we are using PDFBox for one of our products and have a proposed
> improvement for PDFBOX-3812.
>
> The problem we are facing with the current implementation of
> auto-sized multiline text fields is the following:
>
> 1. If the rectangle of the multiline text field has a reasonable height
>     for a few lines and only a few characters are put in the text field
>     the font will get too big, resulting in strange looking input.  If
>     edited aftewards with Adobe Acrobat the font size is adjusted to 12pt
>     (like the DEFAULT_FONT_SIZE).
>
> 2. Words are not broken if they are too long to fit in the width of the
>     textbox.  The result is that the part not fitting is cut off.
>
> The attached patch tries to fix these issues in the following way:
>
> 1. Use DEFAULT_FONT_SIZE instead of MAX_FONT_SIZE to calculate the
>     maximum line height for multiline text fields
>
> 2. Test if a word is longer than the width if it is the only word
>     present on a line.  If yes a similar alorithm to calculate the font
>     size in 1. is used.
>
> If there are any problems with the patch, please let me know.



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org


Re: PDFBOX-3812 improvement patch

Posted by Sebastian Fieber <Se...@mentana.de>.
Forgot to mention that this patch was created off the 2.0.19 tag of the
repository.  If I see it correctly it shouldn't be big effort to apply
it to trunk.  If I can help, let me know.

On Wed, Jun 17 2020, Sebastian Fieber <se...@mentana.de> wrote:

> Hey,
>
> we are using PDFBox for one of our products and have a proposed
> improvement for PDFBOX-3812.
>
> The problem we are facing with the current implementation of
> auto-sized multiline text fields is the following:
>
> 1. If the rectangle of the multiline text field has a reasonable height
>    for a few lines and only a few characters are put in the text field
>    the font will get too big, resulting in strange looking input.  If
>    edited aftewards with Adobe Acrobat the font size is adjusted to 12pt
>    (like the DEFAULT_FONT_SIZE).
>
> 2. Words are not broken if they are too long to fit in the width of the
>    textbox.  The result is that the part not fitting is cut off.
>
> The attached patch tries to fix these issues in the following way:
>
> 1. Use DEFAULT_FONT_SIZE instead of MAX_FONT_SIZE to calculate the
>    maximum line height for multiline text fields
>
> 2. Test if a word is longer than the width if it is the only word
>    present on a line.  If yes a similar alorithm to calculate the font
>    size in 1. is used.
>
> If there are any problems with the patch, please let me know.

-- 
Mit freundlichen Grüßen
Sebastian Fieber
Software Entwickler

Mentana-Claimsoft GmbH
EIN UNTERNEHMEN DER FP-GRUPPE
Griesbergstr. 8 · 31162 Bad Salzdetfurth
Trebuser Str. 47 · Haus 1 · 15517 Fürstenwalde
Tel: +49 (0)5063 277440 · Fax: +49 (0)5063 2774450
E-Mail: sebastian.fieber@mentana.de · De-Mail: sebastian.fieber@mentana.de-mail.de
Web: www.mentana-claimsoft.de · Blog: fp-francotyp.com/blog

Service Center De-Mail: 01806/ Mentana (6368262)
(0,20 € pro Anruf aus dem deutschen Festnetz, max. 0,60 € pro Anruf aus
dem deutschen Mobilfunknetz)

Service Center Signaturprodukte: 01806/ Signatur (74462887)
(0,20 € pro Anruf aus dem deutschen Festnetz, max. 0,60 € pro Anruf aus
dem deutschen Mobilfunknetz)

Geschäftsführung Stephan Vanberg, Patricius de Gruyter
HRB: 13886 - Amtsgericht Frankfurt/Oder