[jira] [Commented] (PDFBOX-4616) Orientation changing when splitting a particular PDF document with clipped output

2019-08-16 Thread Jitendra Mahendrapuri Goswami (JIRA)


[ 
https://issues.apache.org/jira/browse/PDFBOX-4616?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16909032#comment-16909032
 ] 

Jitendra Mahendrapuri Goswami commented on PDFBOX-4616:
---

Thank you [~tilman],

I will make suggested changes and revert with results.

> Orientation changing when splitting a particular PDF document with clipped 
> output
> -
>
> Key: PDFBOX-4616
> URL: https://issues.apache.org/jira/browse/PDFBOX-4616
> Project: PDFBox
>  Issue Type: Bug
>  Components: .NET
>Affects Versions: 2.0.12
> Environment: PDF extracted from Crystal report
>Reporter: Jitendra Mahendrapuri Goswami
>Priority: Major
> Attachments: PDF_Split_Issue.zip
>
>
> When I am splitting a PDF(with landscape orientation) that is extracted from 
> crystal report, resulting files are converted in Portrait orientation with 
> partial part getting removed. We are using getDocumentCatalog().getPages() to 
> get particular page and saving it.
>  
> The same file when opened in Internet Explorer and selected to print, detects 
> orientation correctly. It is working when using 
> Please share if there is any specific reason for such behavior and the way to 
> handle it in coding.



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

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



[jira] [Commented] (PDFBOX-4071) Improve code quality (3)

2019-08-16 Thread ASF subversion and git services (JIRA)


[ 
https://issues.apache.org/jira/browse/PDFBOX-4071?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16909110#comment-16909110
 ] 

ASF subversion and git services commented on PDFBOX-4071:
-

Commit 1865303 from Tilman Hausherr in branch 'pdfbox/branches/issue45'
[ https://svn.apache.org/r1865303 ]

PDFBOX-4071: use constants; improve logging; fix typo

> Improve code quality (3)
> 
>
> Key: PDFBOX-4071
> URL: https://issues.apache.org/jira/browse/PDFBOX-4071
> Project: PDFBox
>  Issue Type: Task
>Affects Versions: 2.0.8
>Reporter: Tilman Hausherr
>Priority: Major
> Attachments: pdfbox-screenshot-bad.png, pdfbox-screenshot-good.png
>
>
> This is a longterm issue for the task to improve code quality, by using the 
> [SonarQube 
> report|https://analysis.apache.org/dashboard/index/org.apache.pdfbox:pdfbox-reactor],
>  hints in different IDEs, the FindBugs tool and other code quality tools.
> This is a follow-up of PDFBOX-2852, which was getting too long.



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

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



[jira] [Commented] (PDFBOX-4071) Improve code quality (3)

2019-08-16 Thread ASF subversion and git services (JIRA)


[ 
https://issues.apache.org/jira/browse/PDFBOX-4071?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16909112#comment-16909112
 ] 

ASF subversion and git services commented on PDFBOX-4071:
-

Commit 1865305 from Tilman Hausherr in branch 'pdfbox/trunk'
[ https://svn.apache.org/r1865305 ]

PDFBOX-4071: use constants; improve logging; fix typo

> Improve code quality (3)
> 
>
> Key: PDFBOX-4071
> URL: https://issues.apache.org/jira/browse/PDFBOX-4071
> Project: PDFBox
>  Issue Type: Task
>Affects Versions: 2.0.8
>Reporter: Tilman Hausherr
>Priority: Major
> Attachments: pdfbox-screenshot-bad.png, pdfbox-screenshot-good.png
>
>
> This is a longterm issue for the task to improve code quality, by using the 
> [SonarQube 
> report|https://analysis.apache.org/dashboard/index/org.apache.pdfbox:pdfbox-reactor],
>  hints in different IDEs, the FindBugs tool and other code quality tools.
> This is a follow-up of PDFBOX-2852, which was getting too long.



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

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



[jira] [Commented] (PDFBOX-4071) Improve code quality (3)

2019-08-16 Thread ASF subversion and git services (JIRA)


[ 
https://issues.apache.org/jira/browse/PDFBOX-4071?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16909113#comment-16909113
 ] 

ASF subversion and git services commented on PDFBOX-4071:
-

Commit 1865306 from Tilman Hausherr in branch 'pdfbox/branches/issue4569'
[ https://svn.apache.org/r1865306 ]

PDFBOX-4071: use constants; improve logging; fix typo

> Improve code quality (3)
> 
>
> Key: PDFBOX-4071
> URL: https://issues.apache.org/jira/browse/PDFBOX-4071
> Project: PDFBox
>  Issue Type: Task
>Affects Versions: 2.0.8
>Reporter: Tilman Hausherr
>Priority: Major
> Attachments: pdfbox-screenshot-bad.png, pdfbox-screenshot-good.png
>
>
> This is a longterm issue for the task to improve code quality, by using the 
> [SonarQube 
> report|https://analysis.apache.org/dashboard/index/org.apache.pdfbox:pdfbox-reactor],
>  hints in different IDEs, the FindBugs tool and other code quality tools.
> This is a follow-up of PDFBOX-2852, which was getting too long.



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

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



[jira] [Commented] (PDFBOX-4071) Improve code quality (3)

2019-08-16 Thread ASF subversion and git services (JIRA)


[ 
https://issues.apache.org/jira/browse/PDFBOX-4071?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16909111#comment-16909111
 ] 

ASF subversion and git services commented on PDFBOX-4071:
-

Commit 1865304 from Tilman Hausherr in branch 'pdfbox/branches/2.0'
[ https://svn.apache.org/r1865304 ]

PDFBOX-4071: use constants; improve logging; fix typo

> Improve code quality (3)
> 
>
> Key: PDFBOX-4071
> URL: https://issues.apache.org/jira/browse/PDFBOX-4071
> Project: PDFBox
>  Issue Type: Task
>Affects Versions: 2.0.8
>Reporter: Tilman Hausherr
>Priority: Major
> Attachments: pdfbox-screenshot-bad.png, pdfbox-screenshot-good.png
>
>
> This is a longterm issue for the task to improve code quality, by using the 
> [SonarQube 
> report|https://analysis.apache.org/dashboard/index/org.apache.pdfbox:pdfbox-reactor],
>  hints in different IDEs, the FindBugs tool and other code quality tools.
> This is a follow-up of PDFBOX-2852, which was getting too long.



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

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



[jira] [Commented] (PDFBOX-4631) NPE due to bounding box not being set on PDAppearanceStream

2019-08-16 Thread ASF subversion and git services (JIRA)


[ 
https://issues.apache.org/jira/browse/PDFBOX-4631?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16909188#comment-16909188
 ] 

ASF subversion and git services commented on PDFBOX-4631:
-

Commit 1865323 from Tilman Hausherr in branch 'pdfbox/trunk'
[ https://svn.apache.org/r1865323 ]

PDFBOX-4631: avoid NPE

> NPE due to bounding box not being set on PDAppearanceStream
> ---
>
> Key: PDFBOX-4631
> URL: https://issues.apache.org/jira/browse/PDFBOX-4631
> Project: PDFBox
>  Issue Type: Bug
>  Components: AcroForm
>Affects Versions: 2.0.16
> Environment: Windows 10
>Reporter: sjoblomj
>Priority: Major
> Fix For: 2.0.17, 3.0.0 PDFBox
>
> Attachments: PdfBoxTest.java, bidragsoknad_strange-content.pdf
>
>
> PDFBox 2.0.16 as well as the current SNAPSNOT version crashes with a 
> NullPointerException. Attached is a small test that triggers the NPE, as well 
> as the PDF.
> The stack trace:
> {code:java}
> java.lang.NullPointerException
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelper.applyPadding(AppearanceGeneratorHelper.java:816)
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelper.insertGeneratedCombAppearance(AppearanceGeneratorHelper.java:611)
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelper.insertGeneratedAppearance(AppearanceGeneratorHelper.java:505)
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelper.setAppearanceContent(AppearanceGeneratorHelper.java:374)
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelper.setAppearanceValue(AppearanceGeneratorHelper.java:223)
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.PDTextField.constructAppearances(PDTextField.java:264)
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.PDTerminalField.applyChange(PDTerminalField.java:228)
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.PDTextField.setValue(PDTextField.java:219)
>     at PdfBoxTest.reformatFields(PdfBoxTest.java:67)
>     at PdfBoxTest.flattenDocument(PdfBoxTest.java:52)
>     at PdfBoxTest.flatten(PdfBoxTest.java:42)
>     at PdfBoxTest.fileWithStrangeContent(PdfBoxTest.java:27){code}
>  
> The origin of the error seems to be in 
> {{AppearanceGeneratorHelper.setAppearanceValue()}}. A PDAppearanceStream is 
> created, but a bounding box is only set for it if this is false: {{if 
> (appearance != null && appearance.isStream())}}. In my case, the conditional 
> is true, and PDFBox takes a path where no bounding box gets set.
> The following could be a solution, but I'm not very fluent in the inner 
> workings of PDFs, and it's not directly obvious from looking at the code that 
> this is a good approach.
> {code:java}
> diff --git 
> a/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/AppearanceGeneratorHelper.java
>  
> b/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/AppearanceGeneratorHelper.java
> index dc2825d4c..a82236069 100644
> --- 
> a/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/AppearanceGeneratorHelper.java
> +++ 
> b/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/AppearanceGeneratorHelper.java
> @@ -201,6 +201,7 @@ class AppearanceGeneratorHelper
>  if (appearance != null && appearance.isStream())
>  {
>  appearanceStream = appearance.getAppearanceStream();
> +setBoundingBoxOnAppearanceStream(widget, 
> appearanceStream);
>  }
>  else
>  {
> @@ -235,15 +236,9 @@ class AppearanceGeneratorHelper
>  // Calculate the entries for the bounding box and the transformation 
> matrix
>  // settings for the appearance stream
> -int rotation = resolveRotation(widget);
> -PDRectangle rect = widget.getRectangle();
> -Matrix matrix = Matrix.getRotateInstance(Math.toRadians(rotation), 
> 0, 0);
> -Point2D.Float point2D = matrix.transformPoint(rect.getWidth(), 
> rect.getHeight());
> +setBoundingBoxOnAppearanceStream(widget, appearanceStream);
> -PDRectangle bbox = new PDRectangle(Math.abs((float) point2D.getX()), 
> Math.abs((float) point2D.getY()));
> -appearanceStream.setBBox(bbox);
> -
> -AffineTransform at = calculateMatrix(bbox, rotation);
> +AffineTransform at = calculateMatrix(appearanceStream.getBBox(), 
> resolveRotation(widget));
>  if (!at.isIdentity())
>  {
>  appearanceStream.setMatrix(at);
> @@ -252,7 +247,17 @@ class AppearanceGeneratorHelper
>  appearanceStream.setResources(new PDResources());
>  return appearanceStream;
>  }
> -
> +
> +private void 

[jira] [Commented] (PDFBOX-4631) NPE due to bounding box not being set on PDAppearanceStream

2019-08-16 Thread ASF subversion and git services (JIRA)


[ 
https://issues.apache.org/jira/browse/PDFBOX-4631?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16909185#comment-16909185
 ] 

ASF subversion and git services commented on PDFBOX-4631:
-

Commit 1865320 from Tilman Hausherr in branch 'pdfbox/branches/issue4569'
[ https://svn.apache.org/r1865320 ]

PDFBOX-4631: avoid NPE

> NPE due to bounding box not being set on PDAppearanceStream
> ---
>
> Key: PDFBOX-4631
> URL: https://issues.apache.org/jira/browse/PDFBOX-4631
> Project: PDFBox
>  Issue Type: Bug
>  Components: AcroForm
>Affects Versions: 2.0.16
> Environment: Windows 10
>Reporter: sjoblomj
>Priority: Major
> Fix For: 2.0.17, 3.0.0 PDFBox
>
> Attachments: PdfBoxTest.java, bidragsoknad_strange-content.pdf
>
>
> PDFBox 2.0.16 as well as the current SNAPSNOT version crashes with a 
> NullPointerException. Attached is a small test that triggers the NPE, as well 
> as the PDF.
> The stack trace:
> {code:java}
> java.lang.NullPointerException
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelper.applyPadding(AppearanceGeneratorHelper.java:816)
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelper.insertGeneratedCombAppearance(AppearanceGeneratorHelper.java:611)
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelper.insertGeneratedAppearance(AppearanceGeneratorHelper.java:505)
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelper.setAppearanceContent(AppearanceGeneratorHelper.java:374)
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelper.setAppearanceValue(AppearanceGeneratorHelper.java:223)
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.PDTextField.constructAppearances(PDTextField.java:264)
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.PDTerminalField.applyChange(PDTerminalField.java:228)
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.PDTextField.setValue(PDTextField.java:219)
>     at PdfBoxTest.reformatFields(PdfBoxTest.java:67)
>     at PdfBoxTest.flattenDocument(PdfBoxTest.java:52)
>     at PdfBoxTest.flatten(PdfBoxTest.java:42)
>     at PdfBoxTest.fileWithStrangeContent(PdfBoxTest.java:27){code}
>  
> The origin of the error seems to be in 
> {{AppearanceGeneratorHelper.setAppearanceValue()}}. A PDAppearanceStream is 
> created, but a bounding box is only set for it if this is false: {{if 
> (appearance != null && appearance.isStream())}}. In my case, the conditional 
> is true, and PDFBox takes a path where no bounding box gets set.
> The following could be a solution, but I'm not very fluent in the inner 
> workings of PDFs, and it's not directly obvious from looking at the code that 
> this is a good approach.
> {code:java}
> diff --git 
> a/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/AppearanceGeneratorHelper.java
>  
> b/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/AppearanceGeneratorHelper.java
> index dc2825d4c..a82236069 100644
> --- 
> a/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/AppearanceGeneratorHelper.java
> +++ 
> b/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/AppearanceGeneratorHelper.java
> @@ -201,6 +201,7 @@ class AppearanceGeneratorHelper
>  if (appearance != null && appearance.isStream())
>  {
>  appearanceStream = appearance.getAppearanceStream();
> +setBoundingBoxOnAppearanceStream(widget, 
> appearanceStream);
>  }
>  else
>  {
> @@ -235,15 +236,9 @@ class AppearanceGeneratorHelper
>  // Calculate the entries for the bounding box and the transformation 
> matrix
>  // settings for the appearance stream
> -int rotation = resolveRotation(widget);
> -PDRectangle rect = widget.getRectangle();
> -Matrix matrix = Matrix.getRotateInstance(Math.toRadians(rotation), 
> 0, 0);
> -Point2D.Float point2D = matrix.transformPoint(rect.getWidth(), 
> rect.getHeight());
> +setBoundingBoxOnAppearanceStream(widget, appearanceStream);
> -PDRectangle bbox = new PDRectangle(Math.abs((float) point2D.getX()), 
> Math.abs((float) point2D.getY()));
> -appearanceStream.setBBox(bbox);
> -
> -AffineTransform at = calculateMatrix(bbox, rotation);
> +AffineTransform at = calculateMatrix(appearanceStream.getBBox(), 
> resolveRotation(widget));
>  if (!at.isIdentity())
>  {
>  appearanceStream.setMatrix(at);
> @@ -252,7 +247,17 @@ class AppearanceGeneratorHelper
>  appearanceStream.setResources(new PDResources());
>  return appearanceStream;
>  }
> -
> +
> +private 

[jira] [Commented] (PDFBOX-4631) NPE due to bounding box not being set on PDAppearanceStream

2019-08-16 Thread ASF subversion and git services (JIRA)


[ 
https://issues.apache.org/jira/browse/PDFBOX-4631?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16909187#comment-16909187
 ] 

ASF subversion and git services commented on PDFBOX-4631:
-

Commit 1865322 from Tilman Hausherr in branch 'pdfbox/branches/2.0'
[ https://svn.apache.org/r1865322 ]

PDFBOX-4631: avoid NPE

> NPE due to bounding box not being set on PDAppearanceStream
> ---
>
> Key: PDFBOX-4631
> URL: https://issues.apache.org/jira/browse/PDFBOX-4631
> Project: PDFBox
>  Issue Type: Bug
>  Components: AcroForm
>Affects Versions: 2.0.16
> Environment: Windows 10
>Reporter: sjoblomj
>Priority: Major
> Fix For: 2.0.17, 3.0.0 PDFBox
>
> Attachments: PdfBoxTest.java, bidragsoknad_strange-content.pdf
>
>
> PDFBox 2.0.16 as well as the current SNAPSNOT version crashes with a 
> NullPointerException. Attached is a small test that triggers the NPE, as well 
> as the PDF.
> The stack trace:
> {code:java}
> java.lang.NullPointerException
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelper.applyPadding(AppearanceGeneratorHelper.java:816)
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelper.insertGeneratedCombAppearance(AppearanceGeneratorHelper.java:611)
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelper.insertGeneratedAppearance(AppearanceGeneratorHelper.java:505)
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelper.setAppearanceContent(AppearanceGeneratorHelper.java:374)
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelper.setAppearanceValue(AppearanceGeneratorHelper.java:223)
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.PDTextField.constructAppearances(PDTextField.java:264)
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.PDTerminalField.applyChange(PDTerminalField.java:228)
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.PDTextField.setValue(PDTextField.java:219)
>     at PdfBoxTest.reformatFields(PdfBoxTest.java:67)
>     at PdfBoxTest.flattenDocument(PdfBoxTest.java:52)
>     at PdfBoxTest.flatten(PdfBoxTest.java:42)
>     at PdfBoxTest.fileWithStrangeContent(PdfBoxTest.java:27){code}
>  
> The origin of the error seems to be in 
> {{AppearanceGeneratorHelper.setAppearanceValue()}}. A PDAppearanceStream is 
> created, but a bounding box is only set for it if this is false: {{if 
> (appearance != null && appearance.isStream())}}. In my case, the conditional 
> is true, and PDFBox takes a path where no bounding box gets set.
> The following could be a solution, but I'm not very fluent in the inner 
> workings of PDFs, and it's not directly obvious from looking at the code that 
> this is a good approach.
> {code:java}
> diff --git 
> a/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/AppearanceGeneratorHelper.java
>  
> b/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/AppearanceGeneratorHelper.java
> index dc2825d4c..a82236069 100644
> --- 
> a/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/AppearanceGeneratorHelper.java
> +++ 
> b/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/AppearanceGeneratorHelper.java
> @@ -201,6 +201,7 @@ class AppearanceGeneratorHelper
>  if (appearance != null && appearance.isStream())
>  {
>  appearanceStream = appearance.getAppearanceStream();
> +setBoundingBoxOnAppearanceStream(widget, 
> appearanceStream);
>  }
>  else
>  {
> @@ -235,15 +236,9 @@ class AppearanceGeneratorHelper
>  // Calculate the entries for the bounding box and the transformation 
> matrix
>  // settings for the appearance stream
> -int rotation = resolveRotation(widget);
> -PDRectangle rect = widget.getRectangle();
> -Matrix matrix = Matrix.getRotateInstance(Math.toRadians(rotation), 
> 0, 0);
> -Point2D.Float point2D = matrix.transformPoint(rect.getWidth(), 
> rect.getHeight());
> +setBoundingBoxOnAppearanceStream(widget, appearanceStream);
> -PDRectangle bbox = new PDRectangle(Math.abs((float) point2D.getX()), 
> Math.abs((float) point2D.getY()));
> -appearanceStream.setBBox(bbox);
> -
> -AffineTransform at = calculateMatrix(bbox, rotation);
> +AffineTransform at = calculateMatrix(appearanceStream.getBBox(), 
> resolveRotation(widget));
>  if (!at.isIdentity())
>  {
>  appearanceStream.setMatrix(at);
> @@ -252,7 +247,17 @@ class AppearanceGeneratorHelper
>  appearanceStream.setResources(new PDResources());
>  return appearanceStream;
>  }
> -
> +
> +private void 

[jira] [Commented] (PDFBOX-4631) NPE due to bounding box not being set on PDAppearanceStream

2019-08-16 Thread ASF subversion and git services (JIRA)


[ 
https://issues.apache.org/jira/browse/PDFBOX-4631?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16909186#comment-16909186
 ] 

ASF subversion and git services commented on PDFBOX-4631:
-

Commit 1865321 from Tilman Hausherr in branch 'pdfbox/branches/issue45'
[ https://svn.apache.org/r1865321 ]

PDFBOX-4631: avoid NPE

> NPE due to bounding box not being set on PDAppearanceStream
> ---
>
> Key: PDFBOX-4631
> URL: https://issues.apache.org/jira/browse/PDFBOX-4631
> Project: PDFBox
>  Issue Type: Bug
>  Components: AcroForm
>Affects Versions: 2.0.16
> Environment: Windows 10
>Reporter: sjoblomj
>Priority: Major
> Fix For: 2.0.17, 3.0.0 PDFBox
>
> Attachments: PdfBoxTest.java, bidragsoknad_strange-content.pdf
>
>
> PDFBox 2.0.16 as well as the current SNAPSNOT version crashes with a 
> NullPointerException. Attached is a small test that triggers the NPE, as well 
> as the PDF.
> The stack trace:
> {code:java}
> java.lang.NullPointerException
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelper.applyPadding(AppearanceGeneratorHelper.java:816)
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelper.insertGeneratedCombAppearance(AppearanceGeneratorHelper.java:611)
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelper.insertGeneratedAppearance(AppearanceGeneratorHelper.java:505)
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelper.setAppearanceContent(AppearanceGeneratorHelper.java:374)
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelper.setAppearanceValue(AppearanceGeneratorHelper.java:223)
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.PDTextField.constructAppearances(PDTextField.java:264)
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.PDTerminalField.applyChange(PDTerminalField.java:228)
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.PDTextField.setValue(PDTextField.java:219)
>     at PdfBoxTest.reformatFields(PdfBoxTest.java:67)
>     at PdfBoxTest.flattenDocument(PdfBoxTest.java:52)
>     at PdfBoxTest.flatten(PdfBoxTest.java:42)
>     at PdfBoxTest.fileWithStrangeContent(PdfBoxTest.java:27){code}
>  
> The origin of the error seems to be in 
> {{AppearanceGeneratorHelper.setAppearanceValue()}}. A PDAppearanceStream is 
> created, but a bounding box is only set for it if this is false: {{if 
> (appearance != null && appearance.isStream())}}. In my case, the conditional 
> is true, and PDFBox takes a path where no bounding box gets set.
> The following could be a solution, but I'm not very fluent in the inner 
> workings of PDFs, and it's not directly obvious from looking at the code that 
> this is a good approach.
> {code:java}
> diff --git 
> a/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/AppearanceGeneratorHelper.java
>  
> b/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/AppearanceGeneratorHelper.java
> index dc2825d4c..a82236069 100644
> --- 
> a/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/AppearanceGeneratorHelper.java
> +++ 
> b/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/AppearanceGeneratorHelper.java
> @@ -201,6 +201,7 @@ class AppearanceGeneratorHelper
>  if (appearance != null && appearance.isStream())
>  {
>  appearanceStream = appearance.getAppearanceStream();
> +setBoundingBoxOnAppearanceStream(widget, 
> appearanceStream);
>  }
>  else
>  {
> @@ -235,15 +236,9 @@ class AppearanceGeneratorHelper
>  // Calculate the entries for the bounding box and the transformation 
> matrix
>  // settings for the appearance stream
> -int rotation = resolveRotation(widget);
> -PDRectangle rect = widget.getRectangle();
> -Matrix matrix = Matrix.getRotateInstance(Math.toRadians(rotation), 
> 0, 0);
> -Point2D.Float point2D = matrix.transformPoint(rect.getWidth(), 
> rect.getHeight());
> +setBoundingBoxOnAppearanceStream(widget, appearanceStream);
> -PDRectangle bbox = new PDRectangle(Math.abs((float) point2D.getX()), 
> Math.abs((float) point2D.getY()));
> -appearanceStream.setBBox(bbox);
> -
> -AffineTransform at = calculateMatrix(bbox, rotation);
> +AffineTransform at = calculateMatrix(appearanceStream.getBBox(), 
> resolveRotation(widget));
>  if (!at.isIdentity())
>  {
>  appearanceStream.setMatrix(at);
> @@ -252,7 +247,17 @@ class AppearanceGeneratorHelper
>  appearanceStream.setResources(new PDResources());
>  return appearanceStream;
>  }
> -
> +
> +private 

[jira] [Comment Edited] (PDFBOX-4631) NPE due to bounding box not being set on PDAppearanceStream

2019-08-16 Thread Tilman Hausherr (JIRA)


[ 
https://issues.apache.org/jira/browse/PDFBOX-4631?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16908795#comment-16908795
 ] 

Tilman Hausherr edited comment on PDFBOX-4631 at 8/16/19 4:18 PM:
--

No, the change isn't what I was thinking, the check was meant to be at another 
place, near {{if (appearance != null && appearance.isStream())}}.

The other one can be solved similarly, i.e. add a check to {{if 
(!annotation.isInvisible() && !annotation.isHidden() && 
annotation.getNormalAppearanceStream() != null)}}. I'll test that later.


was (Author: tilman):
No, the change isn't what I was thinking, the check was meant to be at another 
place, near {{if (appearance != null && appearance.isStream())}}.

The other one can be solved similarly, i.e. add a check to {{if 
(!annotation.isInvisible() && !annotation.isHidden() && 
annotation.getNormalAppearanceStream() != null)}}. I'll test that later.

> NPE due to bounding box not being set on PDAppearanceStream
> ---
>
> Key: PDFBOX-4631
> URL: https://issues.apache.org/jira/browse/PDFBOX-4631
> Project: PDFBox
>  Issue Type: Bug
>  Components: AcroForm
>Affects Versions: 2.0.16
> Environment: Windows 10
>Reporter: sjoblomj
>Priority: Major
> Fix For: 2.0.17, 3.0.0 PDFBox
>
> Attachments: PdfBoxTest.java, bidragsoknad_strange-content.pdf
>
>
> PDFBox 2.0.16 as well as the current SNAPSNOT version crashes with a 
> NullPointerException. Attached is a small test that triggers the NPE, as well 
> as the PDF.
> The stack trace:
> {code:java}
> java.lang.NullPointerException
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelper.applyPadding(AppearanceGeneratorHelper.java:816)
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelper.insertGeneratedCombAppearance(AppearanceGeneratorHelper.java:611)
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelper.insertGeneratedAppearance(AppearanceGeneratorHelper.java:505)
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelper.setAppearanceContent(AppearanceGeneratorHelper.java:374)
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelper.setAppearanceValue(AppearanceGeneratorHelper.java:223)
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.PDTextField.constructAppearances(PDTextField.java:264)
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.PDTerminalField.applyChange(PDTerminalField.java:228)
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.PDTextField.setValue(PDTextField.java:219)
>     at PdfBoxTest.reformatFields(PdfBoxTest.java:67)
>     at PdfBoxTest.flattenDocument(PdfBoxTest.java:52)
>     at PdfBoxTest.flatten(PdfBoxTest.java:42)
>     at PdfBoxTest.fileWithStrangeContent(PdfBoxTest.java:27){code}
>  
> The origin of the error seems to be in 
> {{AppearanceGeneratorHelper.setAppearanceValue()}}. A PDAppearanceStream is 
> created, but a bounding box is only set for it if this is false: {{if 
> (appearance != null && appearance.isStream())}}. In my case, the conditional 
> is true, and PDFBox takes a path where no bounding box gets set.
> The following could be a solution, but I'm not very fluent in the inner 
> workings of PDFs, and it's not directly obvious from looking at the code that 
> this is a good approach.
> {code:java}
> diff --git 
> a/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/AppearanceGeneratorHelper.java
>  
> b/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/AppearanceGeneratorHelper.java
> index dc2825d4c..a82236069 100644
> --- 
> a/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/AppearanceGeneratorHelper.java
> +++ 
> b/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/AppearanceGeneratorHelper.java
> @@ -201,6 +201,7 @@ class AppearanceGeneratorHelper
>  if (appearance != null && appearance.isStream())
>  {
>  appearanceStream = appearance.getAppearanceStream();
> +setBoundingBoxOnAppearanceStream(widget, 
> appearanceStream);
>  }
>  else
>  {
> @@ -235,15 +236,9 @@ class AppearanceGeneratorHelper
>  // Calculate the entries for the bounding box and the transformation 
> matrix
>  // settings for the appearance stream
> -int rotation = resolveRotation(widget);
> -PDRectangle rect = widget.getRectangle();
> -Matrix matrix = Matrix.getRotateInstance(Math.toRadians(rotation), 
> 0, 0);
> -Point2D.Float point2D = matrix.transformPoint(rect.getWidth(), 
> rect.getHeight());
> +setBoundingBoxOnAppearanceStream(widget, appearanceStream);
> -PDRectangle 

[jira] [Commented] (PDFBOX-4071) Improve code quality (3)

2019-08-16 Thread ASF subversion and git services (JIRA)


[ 
https://issues.apache.org/jira/browse/PDFBOX-4071?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16909169#comment-16909169
 ] 

ASF subversion and git services commented on PDFBOX-4071:
-

Commit 1865314 from Tilman Hausherr in branch 'pdfbox/trunk'
[ https://svn.apache.org/r1865314 ]

PDFBOX-4071: fix typo

> Improve code quality (3)
> 
>
> Key: PDFBOX-4071
> URL: https://issues.apache.org/jira/browse/PDFBOX-4071
> Project: PDFBox
>  Issue Type: Task
>Affects Versions: 2.0.8
>Reporter: Tilman Hausherr
>Priority: Major
> Attachments: pdfbox-screenshot-bad.png, pdfbox-screenshot-good.png
>
>
> This is a longterm issue for the task to improve code quality, by using the 
> [SonarQube 
> report|https://analysis.apache.org/dashboard/index/org.apache.pdfbox:pdfbox-reactor],
>  hints in different IDEs, the FindBugs tool and other code quality tools.
> This is a follow-up of PDFBOX-2852, which was getting too long.



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

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



[jira] [Commented] (PDFBOX-4071) Improve code quality (3)

2019-08-16 Thread ASF subversion and git services (JIRA)


[ 
https://issues.apache.org/jira/browse/PDFBOX-4071?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16909170#comment-16909170
 ] 

ASF subversion and git services commented on PDFBOX-4071:
-

Commit 1865315 from Tilman Hausherr in branch 'pdfbox/branches/issue4569'
[ https://svn.apache.org/r1865315 ]

PDFBOX-4071: fix typo

> Improve code quality (3)
> 
>
> Key: PDFBOX-4071
> URL: https://issues.apache.org/jira/browse/PDFBOX-4071
> Project: PDFBox
>  Issue Type: Task
>Affects Versions: 2.0.8
>Reporter: Tilman Hausherr
>Priority: Major
> Attachments: pdfbox-screenshot-bad.png, pdfbox-screenshot-good.png
>
>
> This is a longterm issue for the task to improve code quality, by using the 
> [SonarQube 
> report|https://analysis.apache.org/dashboard/index/org.apache.pdfbox:pdfbox-reactor],
>  hints in different IDEs, the FindBugs tool and other code quality tools.
> This is a follow-up of PDFBOX-2852, which was getting too long.



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

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



[jira] [Commented] (PDFBOX-4071) Improve code quality (3)

2019-08-16 Thread ASF subversion and git services (JIRA)


[ 
https://issues.apache.org/jira/browse/PDFBOX-4071?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16909167#comment-16909167
 ] 

ASF subversion and git services commented on PDFBOX-4071:
-

Commit 1865312 from Tilman Hausherr in branch 'pdfbox/branches/issue45'
[ https://svn.apache.org/r1865312 ]

PDFBOX-4071: fix typo

> Improve code quality (3)
> 
>
> Key: PDFBOX-4071
> URL: https://issues.apache.org/jira/browse/PDFBOX-4071
> Project: PDFBox
>  Issue Type: Task
>Affects Versions: 2.0.8
>Reporter: Tilman Hausherr
>Priority: Major
> Attachments: pdfbox-screenshot-bad.png, pdfbox-screenshot-good.png
>
>
> This is a longterm issue for the task to improve code quality, by using the 
> [SonarQube 
> report|https://analysis.apache.org/dashboard/index/org.apache.pdfbox:pdfbox-reactor],
>  hints in different IDEs, the FindBugs tool and other code quality tools.
> This is a follow-up of PDFBOX-2852, which was getting too long.



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

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



[jira] [Commented] (PDFBOX-4071) Improve code quality (3)

2019-08-16 Thread ASF subversion and git services (JIRA)


[ 
https://issues.apache.org/jira/browse/PDFBOX-4071?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16909168#comment-16909168
 ] 

ASF subversion and git services commented on PDFBOX-4071:
-

Commit 1865313 from Tilman Hausherr in branch 'pdfbox/branches/2.0'
[ https://svn.apache.org/r1865313 ]

PDFBOX-4071: fix typo

> Improve code quality (3)
> 
>
> Key: PDFBOX-4071
> URL: https://issues.apache.org/jira/browse/PDFBOX-4071
> Project: PDFBox
>  Issue Type: Task
>Affects Versions: 2.0.8
>Reporter: Tilman Hausherr
>Priority: Major
> Attachments: pdfbox-screenshot-bad.png, pdfbox-screenshot-good.png
>
>
> This is a longterm issue for the task to improve code quality, by using the 
> [SonarQube 
> report|https://analysis.apache.org/dashboard/index/org.apache.pdfbox:pdfbox-reactor],
>  hints in different IDEs, the FindBugs tool and other code quality tools.
> This is a follow-up of PDFBOX-2852, which was getting too long.



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

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



[jira] [Commented] (PDFBOX-4631) NPE due to bounding box not being set on PDAppearanceStream

2019-08-16 Thread Tilman Hausherr (JIRA)


[ 
https://issues.apache.org/jira/browse/PDFBOX-4631?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16909189#comment-16909189
 ] 

Tilman Hausherr commented on PDFBOX-4631:
-

[~sjoblomj] please retry with this new version and check that your result file 
is what you'd expect.

> NPE due to bounding box not being set on PDAppearanceStream
> ---
>
> Key: PDFBOX-4631
> URL: https://issues.apache.org/jira/browse/PDFBOX-4631
> Project: PDFBox
>  Issue Type: Bug
>  Components: AcroForm
>Affects Versions: 2.0.16
> Environment: Windows 10
>Reporter: sjoblomj
>Priority: Major
> Fix For: 2.0.17, 3.0.0 PDFBox
>
> Attachments: PdfBoxTest.java, bidragsoknad_strange-content.pdf
>
>
> PDFBox 2.0.16 as well as the current SNAPSNOT version crashes with a 
> NullPointerException. Attached is a small test that triggers the NPE, as well 
> as the PDF.
> The stack trace:
> {code:java}
> java.lang.NullPointerException
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelper.applyPadding(AppearanceGeneratorHelper.java:816)
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelper.insertGeneratedCombAppearance(AppearanceGeneratorHelper.java:611)
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelper.insertGeneratedAppearance(AppearanceGeneratorHelper.java:505)
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelper.setAppearanceContent(AppearanceGeneratorHelper.java:374)
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelper.setAppearanceValue(AppearanceGeneratorHelper.java:223)
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.PDTextField.constructAppearances(PDTextField.java:264)
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.PDTerminalField.applyChange(PDTerminalField.java:228)
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.PDTextField.setValue(PDTextField.java:219)
>     at PdfBoxTest.reformatFields(PdfBoxTest.java:67)
>     at PdfBoxTest.flattenDocument(PdfBoxTest.java:52)
>     at PdfBoxTest.flatten(PdfBoxTest.java:42)
>     at PdfBoxTest.fileWithStrangeContent(PdfBoxTest.java:27){code}
>  
> The origin of the error seems to be in 
> {{AppearanceGeneratorHelper.setAppearanceValue()}}. A PDAppearanceStream is 
> created, but a bounding box is only set for it if this is false: {{if 
> (appearance != null && appearance.isStream())}}. In my case, the conditional 
> is true, and PDFBox takes a path where no bounding box gets set.
> The following could be a solution, but I'm not very fluent in the inner 
> workings of PDFs, and it's not directly obvious from looking at the code that 
> this is a good approach.
> {code:java}
> diff --git 
> a/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/AppearanceGeneratorHelper.java
>  
> b/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/AppearanceGeneratorHelper.java
> index dc2825d4c..a82236069 100644
> --- 
> a/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/AppearanceGeneratorHelper.java
> +++ 
> b/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/AppearanceGeneratorHelper.java
> @@ -201,6 +201,7 @@ class AppearanceGeneratorHelper
>  if (appearance != null && appearance.isStream())
>  {
>  appearanceStream = appearance.getAppearanceStream();
> +setBoundingBoxOnAppearanceStream(widget, 
> appearanceStream);
>  }
>  else
>  {
> @@ -235,15 +236,9 @@ class AppearanceGeneratorHelper
>  // Calculate the entries for the bounding box and the transformation 
> matrix
>  // settings for the appearance stream
> -int rotation = resolveRotation(widget);
> -PDRectangle rect = widget.getRectangle();
> -Matrix matrix = Matrix.getRotateInstance(Math.toRadians(rotation), 
> 0, 0);
> -Point2D.Float point2D = matrix.transformPoint(rect.getWidth(), 
> rect.getHeight());
> +setBoundingBoxOnAppearanceStream(widget, appearanceStream);
> -PDRectangle bbox = new PDRectangle(Math.abs((float) point2D.getX()), 
> Math.abs((float) point2D.getY()));
> -appearanceStream.setBBox(bbox);
> -
> -AffineTransform at = calculateMatrix(bbox, rotation);
> +AffineTransform at = calculateMatrix(appearanceStream.getBBox(), 
> resolveRotation(widget));
>  if (!at.isIdentity())
>  {
>  appearanceStream.setMatrix(at);
> @@ -252,7 +247,17 @@ class AppearanceGeneratorHelper
>  appearanceStream.setResources(new PDResources());
>  return appearanceStream;
>  }
> -
> +
> +private void setBoundingBoxOnAppearanceStream(PDAnnotationWidget widget, 

[jira] [Commented] (PDFBOX-4631) NPE due to bounding box not being set on PDAppearanceStream

2019-08-16 Thread ASF subversion and git services (JIRA)


[ 
https://issues.apache.org/jira/browse/PDFBOX-4631?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16909181#comment-16909181
 ] 

ASF subversion and git services commented on PDFBOX-4631:
-

Commit 1865317 from Tilman Hausherr in branch 'pdfbox/branches/2.0'
[ https://svn.apache.org/r1865317 ]

PDFBOX-4631: avoid NPE

> NPE due to bounding box not being set on PDAppearanceStream
> ---
>
> Key: PDFBOX-4631
> URL: https://issues.apache.org/jira/browse/PDFBOX-4631
> Project: PDFBox
>  Issue Type: Bug
>  Components: AcroForm
>Affects Versions: 2.0.16
> Environment: Windows 10
>Reporter: sjoblomj
>Priority: Major
> Fix For: 2.0.17, 3.0.0 PDFBox
>
> Attachments: PdfBoxTest.java, bidragsoknad_strange-content.pdf
>
>
> PDFBox 2.0.16 as well as the current SNAPSNOT version crashes with a 
> NullPointerException. Attached is a small test that triggers the NPE, as well 
> as the PDF.
> The stack trace:
> {code:java}
> java.lang.NullPointerException
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelper.applyPadding(AppearanceGeneratorHelper.java:816)
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelper.insertGeneratedCombAppearance(AppearanceGeneratorHelper.java:611)
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelper.insertGeneratedAppearance(AppearanceGeneratorHelper.java:505)
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelper.setAppearanceContent(AppearanceGeneratorHelper.java:374)
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelper.setAppearanceValue(AppearanceGeneratorHelper.java:223)
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.PDTextField.constructAppearances(PDTextField.java:264)
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.PDTerminalField.applyChange(PDTerminalField.java:228)
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.PDTextField.setValue(PDTextField.java:219)
>     at PdfBoxTest.reformatFields(PdfBoxTest.java:67)
>     at PdfBoxTest.flattenDocument(PdfBoxTest.java:52)
>     at PdfBoxTest.flatten(PdfBoxTest.java:42)
>     at PdfBoxTest.fileWithStrangeContent(PdfBoxTest.java:27){code}
>  
> The origin of the error seems to be in 
> {{AppearanceGeneratorHelper.setAppearanceValue()}}. A PDAppearanceStream is 
> created, but a bounding box is only set for it if this is false: {{if 
> (appearance != null && appearance.isStream())}}. In my case, the conditional 
> is true, and PDFBox takes a path where no bounding box gets set.
> The following could be a solution, but I'm not very fluent in the inner 
> workings of PDFs, and it's not directly obvious from looking at the code that 
> this is a good approach.
> {code:java}
> diff --git 
> a/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/AppearanceGeneratorHelper.java
>  
> b/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/AppearanceGeneratorHelper.java
> index dc2825d4c..a82236069 100644
> --- 
> a/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/AppearanceGeneratorHelper.java
> +++ 
> b/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/AppearanceGeneratorHelper.java
> @@ -201,6 +201,7 @@ class AppearanceGeneratorHelper
>  if (appearance != null && appearance.isStream())
>  {
>  appearanceStream = appearance.getAppearanceStream();
> +setBoundingBoxOnAppearanceStream(widget, 
> appearanceStream);
>  }
>  else
>  {
> @@ -235,15 +236,9 @@ class AppearanceGeneratorHelper
>  // Calculate the entries for the bounding box and the transformation 
> matrix
>  // settings for the appearance stream
> -int rotation = resolveRotation(widget);
> -PDRectangle rect = widget.getRectangle();
> -Matrix matrix = Matrix.getRotateInstance(Math.toRadians(rotation), 
> 0, 0);
> -Point2D.Float point2D = matrix.transformPoint(rect.getWidth(), 
> rect.getHeight());
> +setBoundingBoxOnAppearanceStream(widget, appearanceStream);
> -PDRectangle bbox = new PDRectangle(Math.abs((float) point2D.getX()), 
> Math.abs((float) point2D.getY()));
> -appearanceStream.setBBox(bbox);
> -
> -AffineTransform at = calculateMatrix(bbox, rotation);
> +AffineTransform at = calculateMatrix(appearanceStream.getBBox(), 
> resolveRotation(widget));
>  if (!at.isIdentity())
>  {
>  appearanceStream.setMatrix(at);
> @@ -252,7 +247,17 @@ class AppearanceGeneratorHelper
>  appearanceStream.setResources(new PDResources());
>  return appearanceStream;
>  }
> -
> +
> +private void 

[jira] [Commented] (PDFBOX-4631) NPE due to bounding box not being set on PDAppearanceStream

2019-08-16 Thread ASF subversion and git services (JIRA)


[ 
https://issues.apache.org/jira/browse/PDFBOX-4631?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16909180#comment-16909180
 ] 

ASF subversion and git services commented on PDFBOX-4631:
-

Commit 1865316 from Tilman Hausherr in branch 'pdfbox/branches/issue4569'
[ https://svn.apache.org/r1865316 ]

PDFBOX-4631: avoid NPE

> NPE due to bounding box not being set on PDAppearanceStream
> ---
>
> Key: PDFBOX-4631
> URL: https://issues.apache.org/jira/browse/PDFBOX-4631
> Project: PDFBox
>  Issue Type: Bug
>  Components: AcroForm
>Affects Versions: 2.0.16
> Environment: Windows 10
>Reporter: sjoblomj
>Priority: Major
> Fix For: 2.0.17, 3.0.0 PDFBox
>
> Attachments: PdfBoxTest.java, bidragsoknad_strange-content.pdf
>
>
> PDFBox 2.0.16 as well as the current SNAPSNOT version crashes with a 
> NullPointerException. Attached is a small test that triggers the NPE, as well 
> as the PDF.
> The stack trace:
> {code:java}
> java.lang.NullPointerException
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelper.applyPadding(AppearanceGeneratorHelper.java:816)
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelper.insertGeneratedCombAppearance(AppearanceGeneratorHelper.java:611)
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelper.insertGeneratedAppearance(AppearanceGeneratorHelper.java:505)
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelper.setAppearanceContent(AppearanceGeneratorHelper.java:374)
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelper.setAppearanceValue(AppearanceGeneratorHelper.java:223)
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.PDTextField.constructAppearances(PDTextField.java:264)
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.PDTerminalField.applyChange(PDTerminalField.java:228)
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.PDTextField.setValue(PDTextField.java:219)
>     at PdfBoxTest.reformatFields(PdfBoxTest.java:67)
>     at PdfBoxTest.flattenDocument(PdfBoxTest.java:52)
>     at PdfBoxTest.flatten(PdfBoxTest.java:42)
>     at PdfBoxTest.fileWithStrangeContent(PdfBoxTest.java:27){code}
>  
> The origin of the error seems to be in 
> {{AppearanceGeneratorHelper.setAppearanceValue()}}. A PDAppearanceStream is 
> created, but a bounding box is only set for it if this is false: {{if 
> (appearance != null && appearance.isStream())}}. In my case, the conditional 
> is true, and PDFBox takes a path where no bounding box gets set.
> The following could be a solution, but I'm not very fluent in the inner 
> workings of PDFs, and it's not directly obvious from looking at the code that 
> this is a good approach.
> {code:java}
> diff --git 
> a/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/AppearanceGeneratorHelper.java
>  
> b/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/AppearanceGeneratorHelper.java
> index dc2825d4c..a82236069 100644
> --- 
> a/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/AppearanceGeneratorHelper.java
> +++ 
> b/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/AppearanceGeneratorHelper.java
> @@ -201,6 +201,7 @@ class AppearanceGeneratorHelper
>  if (appearance != null && appearance.isStream())
>  {
>  appearanceStream = appearance.getAppearanceStream();
> +setBoundingBoxOnAppearanceStream(widget, 
> appearanceStream);
>  }
>  else
>  {
> @@ -235,15 +236,9 @@ class AppearanceGeneratorHelper
>  // Calculate the entries for the bounding box and the transformation 
> matrix
>  // settings for the appearance stream
> -int rotation = resolveRotation(widget);
> -PDRectangle rect = widget.getRectangle();
> -Matrix matrix = Matrix.getRotateInstance(Math.toRadians(rotation), 
> 0, 0);
> -Point2D.Float point2D = matrix.transformPoint(rect.getWidth(), 
> rect.getHeight());
> +setBoundingBoxOnAppearanceStream(widget, appearanceStream);
> -PDRectangle bbox = new PDRectangle(Math.abs((float) point2D.getX()), 
> Math.abs((float) point2D.getY()));
> -appearanceStream.setBBox(bbox);
> -
> -AffineTransform at = calculateMatrix(bbox, rotation);
> +AffineTransform at = calculateMatrix(appearanceStream.getBBox(), 
> resolveRotation(widget));
>  if (!at.isIdentity())
>  {
>  appearanceStream.setMatrix(at);
> @@ -252,7 +247,17 @@ class AppearanceGeneratorHelper
>  appearanceStream.setResources(new PDResources());
>  return appearanceStream;
>  }
> -
> +
> +private 

[jira] [Commented] (PDFBOX-4631) NPE due to bounding box not being set on PDAppearanceStream

2019-08-16 Thread ASF subversion and git services (JIRA)


[ 
https://issues.apache.org/jira/browse/PDFBOX-4631?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16909182#comment-16909182
 ] 

ASF subversion and git services commented on PDFBOX-4631:
-

Commit 1865318 from Tilman Hausherr in branch 'pdfbox/trunk'
[ https://svn.apache.org/r1865318 ]

PDFBOX-4631: avoid NPE

> NPE due to bounding box not being set on PDAppearanceStream
> ---
>
> Key: PDFBOX-4631
> URL: https://issues.apache.org/jira/browse/PDFBOX-4631
> Project: PDFBox
>  Issue Type: Bug
>  Components: AcroForm
>Affects Versions: 2.0.16
> Environment: Windows 10
>Reporter: sjoblomj
>Priority: Major
> Fix For: 2.0.17, 3.0.0 PDFBox
>
> Attachments: PdfBoxTest.java, bidragsoknad_strange-content.pdf
>
>
> PDFBox 2.0.16 as well as the current SNAPSNOT version crashes with a 
> NullPointerException. Attached is a small test that triggers the NPE, as well 
> as the PDF.
> The stack trace:
> {code:java}
> java.lang.NullPointerException
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelper.applyPadding(AppearanceGeneratorHelper.java:816)
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelper.insertGeneratedCombAppearance(AppearanceGeneratorHelper.java:611)
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelper.insertGeneratedAppearance(AppearanceGeneratorHelper.java:505)
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelper.setAppearanceContent(AppearanceGeneratorHelper.java:374)
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelper.setAppearanceValue(AppearanceGeneratorHelper.java:223)
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.PDTextField.constructAppearances(PDTextField.java:264)
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.PDTerminalField.applyChange(PDTerminalField.java:228)
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.PDTextField.setValue(PDTextField.java:219)
>     at PdfBoxTest.reformatFields(PdfBoxTest.java:67)
>     at PdfBoxTest.flattenDocument(PdfBoxTest.java:52)
>     at PdfBoxTest.flatten(PdfBoxTest.java:42)
>     at PdfBoxTest.fileWithStrangeContent(PdfBoxTest.java:27){code}
>  
> The origin of the error seems to be in 
> {{AppearanceGeneratorHelper.setAppearanceValue()}}. A PDAppearanceStream is 
> created, but a bounding box is only set for it if this is false: {{if 
> (appearance != null && appearance.isStream())}}. In my case, the conditional 
> is true, and PDFBox takes a path where no bounding box gets set.
> The following could be a solution, but I'm not very fluent in the inner 
> workings of PDFs, and it's not directly obvious from looking at the code that 
> this is a good approach.
> {code:java}
> diff --git 
> a/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/AppearanceGeneratorHelper.java
>  
> b/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/AppearanceGeneratorHelper.java
> index dc2825d4c..a82236069 100644
> --- 
> a/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/AppearanceGeneratorHelper.java
> +++ 
> b/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/AppearanceGeneratorHelper.java
> @@ -201,6 +201,7 @@ class AppearanceGeneratorHelper
>  if (appearance != null && appearance.isStream())
>  {
>  appearanceStream = appearance.getAppearanceStream();
> +setBoundingBoxOnAppearanceStream(widget, 
> appearanceStream);
>  }
>  else
>  {
> @@ -235,15 +236,9 @@ class AppearanceGeneratorHelper
>  // Calculate the entries for the bounding box and the transformation 
> matrix
>  // settings for the appearance stream
> -int rotation = resolveRotation(widget);
> -PDRectangle rect = widget.getRectangle();
> -Matrix matrix = Matrix.getRotateInstance(Math.toRadians(rotation), 
> 0, 0);
> -Point2D.Float point2D = matrix.transformPoint(rect.getWidth(), 
> rect.getHeight());
> +setBoundingBoxOnAppearanceStream(widget, appearanceStream);
> -PDRectangle bbox = new PDRectangle(Math.abs((float) point2D.getX()), 
> Math.abs((float) point2D.getY()));
> -appearanceStream.setBBox(bbox);
> -
> -AffineTransform at = calculateMatrix(bbox, rotation);
> +AffineTransform at = calculateMatrix(appearanceStream.getBBox(), 
> resolveRotation(widget));
>  if (!at.isIdentity())
>  {
>  appearanceStream.setMatrix(at);
> @@ -252,7 +247,17 @@ class AppearanceGeneratorHelper
>  appearanceStream.setResources(new PDResources());
>  return appearanceStream;
>  }
> -
> +
> +private void 

[jira] [Commented] (PDFBOX-4631) NPE due to bounding box not being set on PDAppearanceStream

2019-08-16 Thread ASF subversion and git services (JIRA)


[ 
https://issues.apache.org/jira/browse/PDFBOX-4631?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16909183#comment-16909183
 ] 

ASF subversion and git services commented on PDFBOX-4631:
-

Commit 1865319 from Tilman Hausherr in branch 'pdfbox/branches/issue45'
[ https://svn.apache.org/r1865319 ]

PDFBOX-4631: avoid NPE

> NPE due to bounding box not being set on PDAppearanceStream
> ---
>
> Key: PDFBOX-4631
> URL: https://issues.apache.org/jira/browse/PDFBOX-4631
> Project: PDFBox
>  Issue Type: Bug
>  Components: AcroForm
>Affects Versions: 2.0.16
> Environment: Windows 10
>Reporter: sjoblomj
>Priority: Major
> Fix For: 2.0.17, 3.0.0 PDFBox
>
> Attachments: PdfBoxTest.java, bidragsoknad_strange-content.pdf
>
>
> PDFBox 2.0.16 as well as the current SNAPSNOT version crashes with a 
> NullPointerException. Attached is a small test that triggers the NPE, as well 
> as the PDF.
> The stack trace:
> {code:java}
> java.lang.NullPointerException
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelper.applyPadding(AppearanceGeneratorHelper.java:816)
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelper.insertGeneratedCombAppearance(AppearanceGeneratorHelper.java:611)
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelper.insertGeneratedAppearance(AppearanceGeneratorHelper.java:505)
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelper.setAppearanceContent(AppearanceGeneratorHelper.java:374)
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelper.setAppearanceValue(AppearanceGeneratorHelper.java:223)
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.PDTextField.constructAppearances(PDTextField.java:264)
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.PDTerminalField.applyChange(PDTerminalField.java:228)
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.PDTextField.setValue(PDTextField.java:219)
>     at PdfBoxTest.reformatFields(PdfBoxTest.java:67)
>     at PdfBoxTest.flattenDocument(PdfBoxTest.java:52)
>     at PdfBoxTest.flatten(PdfBoxTest.java:42)
>     at PdfBoxTest.fileWithStrangeContent(PdfBoxTest.java:27){code}
>  
> The origin of the error seems to be in 
> {{AppearanceGeneratorHelper.setAppearanceValue()}}. A PDAppearanceStream is 
> created, but a bounding box is only set for it if this is false: {{if 
> (appearance != null && appearance.isStream())}}. In my case, the conditional 
> is true, and PDFBox takes a path where no bounding box gets set.
> The following could be a solution, but I'm not very fluent in the inner 
> workings of PDFs, and it's not directly obvious from looking at the code that 
> this is a good approach.
> {code:java}
> diff --git 
> a/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/AppearanceGeneratorHelper.java
>  
> b/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/AppearanceGeneratorHelper.java
> index dc2825d4c..a82236069 100644
> --- 
> a/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/AppearanceGeneratorHelper.java
> +++ 
> b/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/AppearanceGeneratorHelper.java
> @@ -201,6 +201,7 @@ class AppearanceGeneratorHelper
>  if (appearance != null && appearance.isStream())
>  {
>  appearanceStream = appearance.getAppearanceStream();
> +setBoundingBoxOnAppearanceStream(widget, 
> appearanceStream);
>  }
>  else
>  {
> @@ -235,15 +236,9 @@ class AppearanceGeneratorHelper
>  // Calculate the entries for the bounding box and the transformation 
> matrix
>  // settings for the appearance stream
> -int rotation = resolveRotation(widget);
> -PDRectangle rect = widget.getRectangle();
> -Matrix matrix = Matrix.getRotateInstance(Math.toRadians(rotation), 
> 0, 0);
> -Point2D.Float point2D = matrix.transformPoint(rect.getWidth(), 
> rect.getHeight());
> +setBoundingBoxOnAppearanceStream(widget, appearanceStream);
> -PDRectangle bbox = new PDRectangle(Math.abs((float) point2D.getX()), 
> Math.abs((float) point2D.getY()));
> -appearanceStream.setBBox(bbox);
> -
> -AffineTransform at = calculateMatrix(bbox, rotation);
> +AffineTransform at = calculateMatrix(appearanceStream.getBBox(), 
> resolveRotation(widget));
>  if (!at.isIdentity())
>  {
>  appearanceStream.setMatrix(at);
> @@ -252,7 +247,17 @@ class AppearanceGeneratorHelper
>  appearanceStream.setResources(new PDResources());
>  return appearanceStream;
>  }
> -
> +
> +private 

Jenkins build is back to normal : PDFBox-Trunk-jdk13 #898

2019-08-16 Thread Apache Jenkins Server
See 



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



Jenkins build is back to normal : PDFBox-Trunk-jdk13 » Apache PDFBox examples #898

2019-08-16 Thread Apache Jenkins Server
See 



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



[jira] [Commented] (PDFBOX-4080) Improve memory consumption of PDAbstractAppearanceHandler

2019-08-16 Thread ASF subversion and git services (JIRA)


[ 
https://issues.apache.org/jira/browse/PDFBOX-4080?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16908784#comment-16908784
 ] 

ASF subversion and git services commented on PDFBOX-4080:
-

Commit 1865275 from Tilman Hausherr in branch 'pdfbox/trunk'
[ https://svn.apache.org/r1865275 ]

PDFBOX-4080: remove unused import

> Improve memory consumption of PDAbstractAppearanceHandler
> -
>
> Key: PDFBOX-4080
> URL: https://issues.apache.org/jira/browse/PDFBOX-4080
> Project: PDFBox
>  Issue Type: Improvement
>  Components: PDModel
>Affects Versions: 2.0.16, 3.0.0 PDFBox
>Reporter: Maruan Sahyoun
>Assignee: Maruan Sahyoun
>Priority: Major
>  Labels: Annotations
>
> PDAbstractAppearanceHandler calls new COSStream(), this has a huge memory 
> footprint (PDFBOX-3868 and PDFBOX-3852). We'd need to find a way to pass the 
> document, or the document scratch file, or there will be trouble for files 
> with many annotations, e.g. a long scientific document with many footnotes.



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

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



[jira] [Commented] (PDFBOX-4080) Improve memory consumption of PDAbstractAppearanceHandler

2019-08-16 Thread ASF subversion and git services (JIRA)


[ 
https://issues.apache.org/jira/browse/PDFBOX-4080?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16908785#comment-16908785
 ] 

ASF subversion and git services commented on PDFBOX-4080:
-

Commit 1865276 from Tilman Hausherr in branch 'pdfbox/branches/issue4569'
[ https://svn.apache.org/r1865276 ]

PDFBOX-4080: remove unused import

> Improve memory consumption of PDAbstractAppearanceHandler
> -
>
> Key: PDFBOX-4080
> URL: https://issues.apache.org/jira/browse/PDFBOX-4080
> Project: PDFBox
>  Issue Type: Improvement
>  Components: PDModel
>Affects Versions: 2.0.16, 3.0.0 PDFBox
>Reporter: Maruan Sahyoun
>Assignee: Maruan Sahyoun
>Priority: Major
>  Labels: Annotations
>
> PDAbstractAppearanceHandler calls new COSStream(), this has a huge memory 
> footprint (PDFBOX-3868 and PDFBOX-3852). We'd need to find a way to pass the 
> document, or the document scratch file, or there will be trouble for files 
> with many annotations, e.g. a long scientific document with many footnotes.



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

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



[jira] [Commented] (PDFBOX-4080) Improve memory consumption of PDAbstractAppearanceHandler

2019-08-16 Thread ASF subversion and git services (JIRA)


[ 
https://issues.apache.org/jira/browse/PDFBOX-4080?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16908783#comment-16908783
 ] 

ASF subversion and git services commented on PDFBOX-4080:
-

Commit 1865274 from Tilman Hausherr in branch 'pdfbox/branches/2.0'
[ https://svn.apache.org/r1865274 ]

PDFBOX-4080: remove unused import

> Improve memory consumption of PDAbstractAppearanceHandler
> -
>
> Key: PDFBOX-4080
> URL: https://issues.apache.org/jira/browse/PDFBOX-4080
> Project: PDFBox
>  Issue Type: Improvement
>  Components: PDModel
>Affects Versions: 2.0.16, 3.0.0 PDFBox
>Reporter: Maruan Sahyoun
>Assignee: Maruan Sahyoun
>Priority: Major
>  Labels: Annotations
>
> PDAbstractAppearanceHandler calls new COSStream(), this has a huge memory 
> footprint (PDFBOX-3868 and PDFBOX-3852). We'd need to find a way to pass the 
> document, or the document scratch file, or there will be trouble for files 
> with many annotations, e.g. a long scientific document with many footnotes.



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

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



[jira] [Commented] (PDFBOX-4631) NPE due to bounding box not being set on PDAppearanceStream

2019-08-16 Thread Tilman Hausherr (JIRA)


[ 
https://issues.apache.org/jira/browse/PDFBOX-4631?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16908795#comment-16908795
 ] 

Tilman Hausherr commented on PDFBOX-4631:
-

No, the change isn't what I was thinking, the check was meant to be at another 
place, near {{if (appearance != null && appearance.isStream())}}.

The other one can be solved similarly, i.e. add a check to {{if 
(!annotation.isInvisible() && !annotation.isHidden() && 
annotation.getNormalAppearanceStream() != null)}}. I'll test that later.

> NPE due to bounding box not being set on PDAppearanceStream
> ---
>
> Key: PDFBOX-4631
> URL: https://issues.apache.org/jira/browse/PDFBOX-4631
> Project: PDFBox
>  Issue Type: Bug
>  Components: AcroForm
>Affects Versions: 2.0.16
> Environment: Windows 10
>Reporter: sjoblomj
>Priority: Major
> Fix For: 2.0.17, 3.0.0 PDFBox
>
> Attachments: PdfBoxTest.java, bidragsoknad_strange-content.pdf
>
>
> PDFBox 2.0.16 as well as the current SNAPSNOT version crashes with a 
> NullPointerException. Attached is a small test that triggers the NPE, as well 
> as the PDF.
> The stack trace:
> {code:java}
> java.lang.NullPointerException
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelper.applyPadding(AppearanceGeneratorHelper.java:816)
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelper.insertGeneratedCombAppearance(AppearanceGeneratorHelper.java:611)
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelper.insertGeneratedAppearance(AppearanceGeneratorHelper.java:505)
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelper.setAppearanceContent(AppearanceGeneratorHelper.java:374)
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.AppearanceGeneratorHelper.setAppearanceValue(AppearanceGeneratorHelper.java:223)
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.PDTextField.constructAppearances(PDTextField.java:264)
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.PDTerminalField.applyChange(PDTerminalField.java:228)
>     at 
> org.apache.pdfbox.pdmodel.interactive.form.PDTextField.setValue(PDTextField.java:219)
>     at PdfBoxTest.reformatFields(PdfBoxTest.java:67)
>     at PdfBoxTest.flattenDocument(PdfBoxTest.java:52)
>     at PdfBoxTest.flatten(PdfBoxTest.java:42)
>     at PdfBoxTest.fileWithStrangeContent(PdfBoxTest.java:27){code}
>  
> The origin of the error seems to be in 
> {{AppearanceGeneratorHelper.setAppearanceValue()}}. A PDAppearanceStream is 
> created, but a bounding box is only set for it if this is false: {{if 
> (appearance != null && appearance.isStream())}}. In my case, the conditional 
> is true, and PDFBox takes a path where no bounding box gets set.
> The following could be a solution, but I'm not very fluent in the inner 
> workings of PDFs, and it's not directly obvious from looking at the code that 
> this is a good approach.
> {code:java}
> diff --git 
> a/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/AppearanceGeneratorHelper.java
>  
> b/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/AppearanceGeneratorHelper.java
> index dc2825d4c..a82236069 100644
> --- 
> a/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/AppearanceGeneratorHelper.java
> +++ 
> b/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/AppearanceGeneratorHelper.java
> @@ -201,6 +201,7 @@ class AppearanceGeneratorHelper
>  if (appearance != null && appearance.isStream())
>  {
>  appearanceStream = appearance.getAppearanceStream();
> +setBoundingBoxOnAppearanceStream(widget, 
> appearanceStream);
>  }
>  else
>  {
> @@ -235,15 +236,9 @@ class AppearanceGeneratorHelper
>  // Calculate the entries for the bounding box and the transformation 
> matrix
>  // settings for the appearance stream
> -int rotation = resolveRotation(widget);
> -PDRectangle rect = widget.getRectangle();
> -Matrix matrix = Matrix.getRotateInstance(Math.toRadians(rotation), 
> 0, 0);
> -Point2D.Float point2D = matrix.transformPoint(rect.getWidth(), 
> rect.getHeight());
> +setBoundingBoxOnAppearanceStream(widget, appearanceStream);
> -PDRectangle bbox = new PDRectangle(Math.abs((float) point2D.getX()), 
> Math.abs((float) point2D.getY()));
> -appearanceStream.setBBox(bbox);
> -
> -AffineTransform at = calculateMatrix(bbox, rotation);
> +AffineTransform at = calculateMatrix(appearanceStream.getBBox(), 
> resolveRotation(widget));
>  if (!at.isIdentity())
>  {
>  appearanceStream.setMatrix(at);
> @@ 

Build failed in Jenkins: PDFBox-Trunk-jdk13 #897

2019-08-16 Thread Apache Jenkins Server
See 


Changes:

[tilman] PDFBOX-4080: remove unused import

[tilman] PDFBOX-3353: try to get font from default resources

[tilman] PDFBOX-4071: use constants

[tilman] PDFBOX-4080: use new method to lessen memory footprint, as suggested 
by Ghenadii Batalski

[tilman] PDFBOX-4080: change new method name and return class

[tilman] PDFBOX-4080: pass PDDocument to construct appearances, as suggested by 
Ghenadii Batalski

--
[...truncated 946.08 KB...]
[INFO] skip non existing resourceDirectory 

[INFO] Copying 3 resources
[INFO] Copying 3 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.7.0:compile (default-compile) @ debugger-app 
---
[INFO] No sources to compile
[INFO] 
[INFO] --- maven-resources-plugin:3.1.0:testResources (default-testResources) @ 
debugger-app ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory 

[INFO] Copying 3 resources
[INFO] Copying 3 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.7.0:testCompile (default-testCompile) @ 
debugger-app ---
[INFO] No sources to compile
[INFO] 
[INFO] --- maven-surefire-plugin:2.22.0:test (default-test) @ debugger-app ---
[INFO] Skipping execution of surefire because it has already been run for this 
configuration
[JENKINS] Recording test results
[INFO] 
[INFO] --- animal-sniffer-maven-plugin:1.18:check (check-java-version) @ 
debugger-app ---
[INFO] Checking unresolved references to org.codehaus.mojo.signature:java17:1.0
[INFO] 
[INFO] >>> maven-bundle-plugin:2.5.4:bundle (default-bundle) > package @ 
debugger-app >>>
[INFO] 
[INFO] --- maven-enforcer-plugin:1.4.1:enforce (default) @ debugger-app ---
[INFO] 
[INFO] --- maven-enforcer-plugin:1.4.1:enforce (enforce-maven-version) @ 
debugger-app ---
[INFO] 
[INFO] --- maven-remote-resources-plugin:1.5:process (process-resource-bundles) 
@ debugger-app ---
[INFO] 
[INFO] --- maven-resources-plugin:3.1.0:resources (default-resources) @ 
debugger-app ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory 

[INFO] Copying 3 resources
[INFO] Copying 3 resources
[INFO] Copying 3 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.7.0:compile (default-compile) @ debugger-app 
---
[INFO] No sources to compile
[INFO] 
[INFO] --- maven-resources-plugin:3.1.0:testResources (default-testResources) @ 
debugger-app ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory 

[INFO] Copying 3 resources
[INFO] Copying 3 resources
[INFO] Copying 3 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.7.0:testCompile (default-testCompile) @ 
debugger-app ---
[INFO] No sources to compile
[INFO] 
[INFO] --- maven-surefire-plugin:2.22.0:test (default-test) @ debugger-app ---
[INFO] Skipping execution of surefire because it has already been run for this 
configuration
[JENKINS] Recording test results
[INFO] 
[INFO] --- animal-sniffer-maven-plugin:1.18:check (check-java-version) @ 
debugger-app ---
[INFO] Checking unresolved references to org.codehaus.mojo.signature:java17:1.0
[INFO] 
[INFO] --- maven-site-plugin:3.7.1:attach-descriptor (attach-descriptor) @ 
debugger-app ---
[INFO] Skipping because packaging 'bundle' is not pom.
[INFO] 
[INFO] >>> maven-source-plugin:3.0.1:jar (attach-sources) > generate-sources @ 
debugger-app >>>
[INFO] 
[INFO] --- maven-enforcer-plugin:1.4.1:enforce (default) @ debugger-app ---
[INFO] 
[INFO] --- maven-enforcer-plugin:1.4.1:enforce (enforce-maven-version) @ 
debugger-app ---
[WARNING] Failed to getClass for org.apache.maven.plugins.source.SourceJarMojo
[INFO] 
[INFO] <<< maven-source-plugin:3.0.1:jar (attach-sources) < generate-sources @ 
debugger-app <<<
[INFO] 
[INFO] 
[INFO] --- maven-source-plugin:3.0.1:jar (attach-sources) @ debugger-app ---
[INFO] Skipping source per configuration.
[WARNING] Failed to getClass for org.apache.felix.bundleplugin.BundlePlugin
[INFO] 
[INFO] <<< maven-bundle-plugin:2.5.4:bundle (default-bundle) < package @ 
debugger-app <<<
[INFO] 
[INFO] 
[INFO] --- maven-bundle-plugin:2.5.4:bundle (default-bundle) @ debugger-app ---
[WARNING] Bundle org.apache.pdfbox:debugger-app:bundle:3.0.0-SNAPSHOT : Unused 
Private-Package instructions, no such package(s) on the class path: [!*]
[WARNING] Bundle org.apache.pdfbox:debugger-app:bundle:3.0.0-SNAPSHOT : Export 
org.apache.pdfbox.debugger.ui,  has 1,  private references 
[org.apache.commons.logging], 
[WARNING] Bundle org.apache.pdfbox:debugger-app:bundle:3.0.0-SNAPSHOT : Export 

Build failed in Jenkins: PDFBox-Trunk-jdk13 » Apache PDFBox examples #897

2019-08-16 Thread Apache Jenkins Server
See 


--
[INFO] 
[INFO] -< org.apache.pdfbox:pdfbox-examples >--
[INFO] Building Apache PDFBox examples 3.0.0-SNAPSHOT   [11/12]
[INFO] [ jar ]-
[INFO] Downloading from central: 
https://repo.maven.apache.org/maven2/org/apache/lucene/lucene-core/5.5.4/lucene-core-5.5.4.pom
[INFO] Downloaded from central: 
https://repo.maven.apache.org/maven2/org/apache/lucene/lucene-core/5.5.4/lucene-core-5.5.4.pom
 (3.1 kB at 236 kB/s)
[INFO] Downloading from central: 
https://repo.maven.apache.org/maven2/org/apache/lucene/lucene-parent/5.5.4/lucene-parent-5.5.4.pom
[INFO] Downloaded from central: 
https://repo.maven.apache.org/maven2/org/apache/lucene/lucene-parent/5.5.4/lucene-parent-5.5.4.pom
 (4.8 kB at 440 kB/s)
[INFO] Downloading from central: 
https://repo.maven.apache.org/maven2/org/apache/lucene/lucene-solr-grandparent/5.5.4/lucene-solr-grandparent-5.5.4.pom
[INFO] Downloaded from central: 
https://repo.maven.apache.org/maven2/org/apache/lucene/lucene-solr-grandparent/5.5.4/lucene-solr-grandparent-5.5.4.pom
 (396 kB at 7.3 MB/s)
[INFO] Downloading from central: 
https://repo.maven.apache.org/maven2/org/apache/lucene/lucene-analyzers-common/5.5.4/lucene-analyzers-common-5.5.4.pom
[INFO] Downloaded from central: 
https://repo.maven.apache.org/maven2/org/apache/lucene/lucene-analyzers-common/5.5.4/lucene-analyzers-common-5.5.4.pom
 (3.0 kB at 272 kB/s)
[INFO] Downloading from central: 
https://repo.maven.apache.org/maven2/org/apache/ant/ant/1.10.6/ant-1.10.6.pom
[INFO] Downloaded from central: 
https://repo.maven.apache.org/maven2/org/apache/ant/ant/1.10.6/ant-1.10.6.pom 
(16 kB at 1.2 MB/s)
[INFO] Downloading from central: 
https://repo.maven.apache.org/maven2/org/apache/ant/ant-parent/1.10.6/ant-parent-1.10.6.pom
[INFO] Downloaded from central: 
https://repo.maven.apache.org/maven2/org/apache/ant/ant-parent/1.10.6/ant-parent-1.10.6.pom
 (6.5 kB at 542 kB/s)
[INFO] Downloading from central: 
https://repo.maven.apache.org/maven2/org/apache/ant/ant-launcher/1.10.6/ant-launcher-1.10.6.pom
[INFO] Downloaded from central: 
https://repo.maven.apache.org/maven2/org/apache/ant/ant-launcher/1.10.6/ant-launcher-1.10.6.pom
 (3.2 kB at 263 kB/s)
[INFO] Downloading from central: 
https://repo.maven.apache.org/maven2/javax/servlet/javax.servlet-api/4.0.1/javax.servlet-api-4.0.1.pom
[INFO] Downloaded from central: 
https://repo.maven.apache.org/maven2/javax/servlet/javax.servlet-api/4.0.1/javax.servlet-api-4.0.1.pom
 (16 kB at 1.4 MB/s)
[INFO] Downloading from central: 
https://repo.maven.apache.org/maven2/org/apache/geronimo/specs/geronimo-jaxrs_1.1_spec/1.0/geronimo-jaxrs_1.1_spec-1.0.pom
[INFO] Downloaded from central: 
https://repo.maven.apache.org/maven2/org/apache/geronimo/specs/geronimo-jaxrs_1.1_spec/1.0/geronimo-jaxrs_1.1_spec-1.0.pom
 (3.8 kB at 315 kB/s)
[INFO] Downloading from central: 
https://repo.maven.apache.org/maven2/org/apache/lucene/lucene-core/5.5.4/lucene-core-5.5.4.jar
[INFO] Downloading from central: 
https://repo.maven.apache.org/maven2/org/apache/lucene/lucene-analyzers-common/5.5.4/lucene-analyzers-common-5.5.4.jar
[INFO] Downloading from central: 
https://repo.maven.apache.org/maven2/org/apache/ant/ant/1.10.6/ant-1.10.6.jar
[INFO] Downloading from central: 
https://repo.maven.apache.org/maven2/org/apache/ant/ant-launcher/1.10.6/ant-launcher-1.10.6.jar
[INFO] Downloading from central: 
https://repo.maven.apache.org/maven2/javax/servlet/javax.servlet-api/4.0.1/javax.servlet-api-4.0.1.jar
[INFO] Downloading from central: 
https://repo.maven.apache.org/maven2/org/apache/geronimo/specs/geronimo-jaxrs_1.1_spec/1.0/geronimo-jaxrs_1.1_spec-1.0.jar
[INFO] Downloaded from central: 
https://repo.maven.apache.org/maven2/org/apache/ant/ant-launcher/1.10.6/ant-launcher-1.10.6.jar
 (19 kB at 1.2 MB/s)
[INFO] Downloaded from central: 
https://repo.maven.apache.org/maven2/org/apache/lucene/lucene-analyzers-common/5.5.4/lucene-analyzers-common-5.5.4.jar
 (1.6 MB at 27 MB/s)
[INFO] Downloaded from central: 
https://repo.maven.apache.org/maven2/org/apache/ant/ant/1.10.6/ant-1.10.6.jar 
(2.2 MB at 32 MB/s)
[INFO] Downloaded from central: 
https://repo.maven.apache.org/maven2/org/apache/geronimo/specs/geronimo-jaxrs_1.1_spec/1.0/geronimo-jaxrs_1.1_spec-1.0.jar
 (55 kB at 752 kB/s)
[INFO] Downloaded from central: 
https://repo.maven.apache.org/maven2/org/apache/lucene/lucene-core/5.5.4/lucene-core-5.5.4.jar
 (2.4 MB at 11 MB/s)
[INFO] 
[INFO] Reactor Summary for Apache PDFBox 3.0.0-SNAPSHOT:
[INFO] 
[INFO] PDFBox parent .. SUCCESS [05:53 min]
[INFO] Apache FontBox . SUCCESS [01:47 min]
[INFO] Apache XmpBox