[jira] [Comment Edited] (PDFBOX-4094) Add support for a flag disabling the rendering of PDF annotations in PDFRenderer

2018-02-15 Thread Tilman Hausherr (JIRA)

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

Tilman Hausherr edited comment on PDFBOX-4094 at 2/15/18 8:12 PM:
--

javadoc build fails because of
{code}
@param annotationsFilter the AnnotationFilter
{code}
in PageDrawer


was (Author: tilman):
javadoc build fails because of
{code}
@param annotationsFilter the AnnotationFilter
{code}


> Add support for a flag disabling the rendering of PDF annotations in 
> PDFRenderer
> 
>
> Key: PDFBOX-4094
> URL: https://issues.apache.org/jira/browse/PDFBOX-4094
> Project: PDFBox
>  Issue Type: Wish
>  Components: Rendering
>Affects Versions: 2.0.8
>Reporter: Maxime Veron
>Assignee: Maruan Sahyoun
>Priority: Minor
> Fix For: 2.0.9, 3.0.0 PDFBox
>
> Attachments: 
> 0001-PDFBOX-4094-comment-Modify-PDFRenderer-in-order-to-a.patch, 
> TestPDPageAnnotationsFiltering.java
>
>
> Regardless if annotations are supposed to be printed or not on the PDF, would 
> it not be interesting to possess a flag allowing to choose if annotations 
> should be printed on top of the document pages?
>  
> Here is a diff of a very rough implementation of it : 
>  
> {code:java}
> diff --git 
> a/pdfbox/src/main/java/org/apache/pdfbox/rendering/PDFRenderer.java 
> b/pdfbox/src/main/java/org/apache/pdfbox/rendering/PDFRenderer.java
> --- a/pdfbox/src/main/java/org/apache/pdfbox/rendering/PDFRenderer.java
> +++ b/pdfbox/src/main/java/org/apache/pdfbox/rendering/PDFRenderer.java
> @@ -35,6 +35,9 @@ public class PDFRenderer
>  protected final PDDocument document;
>  // TODO keep rendering state such as caches here
>  
> +// parameter used to know if the rendering should include annotations 
> +private boolean renderAnnotations = true;
> +
>  /**
>   * Creates a new PDFRenderer.
>   * @param document the document to render
> @@ -224,4 +227,14 @@ public class PDFRenderer
>  {
>  return new PageDrawer(parameters);
>  }
> +
> +public void setRenderAnnotations(boolean render) 
> +{
> +this.renderAnnotations = render;
> +}
> +
> +public boolean renderAnnotations() 
> +{
> +return renderAnnotations;
> +}
>  }
> diff --git a/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java 
> b/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java
> --- a/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java
> +++ b/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java
> @@ -195,11 +195,13 @@ public class PageDrawer extends PDFGraphicsStreamEngine
>  
>  processPage(getPage());
>  
> -for (PDAnnotation annotation : getPage().getAnnotations())
> -{
> -showAnnotation(annotation);
> +if (getRenderer().renderAnnotations()) 
> +{ 
> +for (PDAnnotation annotation : getPage().getAnnotations())
> +{
> +showAnnotation(annotation);
> +}
>  }
> -
>  graphics = null;
>  }
>  
> {code}
> And an exemple of a use case: 
> {code:java}
> PDDocument doc = getPDDocument(); 
> PDFRenderer pdfRenderer = new PDFRenderer(doc);
> pdfRenderer.setRenderAnnotations(false);
> pdfRenderer.renderImage(page);
>  
> {code}
> By default, this would be keeping the same behavior as it used to (aka : 
> print the annotations) but possess an opt-out feature.
>  
> Best regards,
> M.Veron



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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



[jira] [Comment Edited] (PDFBOX-4094) Add support for a flag disabling the rendering of PDF annotations in PDFRenderer

2018-02-14 Thread Maruan Sahyoun (JIRA)

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

Maruan Sahyoun edited comment on PDFBOX-4094 at 2/14/18 6:16 PM:
-

[~lehmi] are we fine with taking that patch without an ICLA? IMHO it's small 
enough.

[~mveron] thanks for the contribution. I'll apply it later tomorrow with some 
minor changes.
- the {{AnnotationsFilter}} shouldn't be part of the 
{{org.apache.pdfbox.filter}} package as this is related to io. I'll put it in 
the {{.interactive.annotation}} package
- I'll add the setter/getter to {{PageDrawer}} too as the line {{for 
(PDAnnotation annotation : 
getPage().getAnnotations(getRenderer().getAnnotationsFilter()))}} introduces a 
dependency on {{PageRenderer}}. Given the comment in the source code of 
{{PageDrawer}} we might be removing the {{PageRenderer}} at some point in time 
as a member in {{PageDrawer}}.

Again thank you very much for your help


was (Author: msahyoun):
[~lehmi] are we fine with taking that patch without an ICLA? IMHO it's small 
enough.

[~mveron] thanks for the contribution. I'll apply it later tomorrow with some 
minor changes.
- the {{AnnotationsFilter}} shouldn't be part of the 
{{org.apache.pdfbox.filter}} package as this is related to io. I'll put it in 
the {{.interactive.annotation}} package
- I'll add the setter/getter to {{PageDrawer}} too as the line {{for 
(PDAnnotation annotation : 
getPage().getAnnotations(getRenderer().getAnnotationsFilter()))}} introduces a 
dependency on {{PageRenderer}}. Given the comment in the source code of 
{{PageDrawer}} we might be removing the {{PageRenderer}} at some point in time 
as a member on {{PageDrawer}}.

Again thank you very much for your help

> Add support for a flag disabling the rendering of PDF annotations in 
> PDFRenderer
> 
>
> Key: PDFBOX-4094
> URL: https://issues.apache.org/jira/browse/PDFBOX-4094
> Project: PDFBox
>  Issue Type: Wish
>  Components: Rendering
>Affects Versions: 2.0.8
>Reporter: Maxime Veron
>Assignee: Maruan Sahyoun
>Priority: Minor
> Fix For: 2.0.9, 3.0.0 PDFBox
>
> Attachments: 
> 0001-PDFBOX-4094-comment-Modify-PDFRenderer-in-order-to-a.patch
>
>
> Regardless if annotations are supposed to be printed or not on the PDF, would 
> it not be interesting to possess a flag allowing to choose if annotations 
> should be printed on top of the document pages?
>  
> Here is a diff of a very rough implementation of it : 
>  
> {code:java}
> diff --git 
> a/pdfbox/src/main/java/org/apache/pdfbox/rendering/PDFRenderer.java 
> b/pdfbox/src/main/java/org/apache/pdfbox/rendering/PDFRenderer.java
> --- a/pdfbox/src/main/java/org/apache/pdfbox/rendering/PDFRenderer.java
> +++ b/pdfbox/src/main/java/org/apache/pdfbox/rendering/PDFRenderer.java
> @@ -35,6 +35,9 @@ public class PDFRenderer
>  protected final PDDocument document;
>  // TODO keep rendering state such as caches here
>  
> +// parameter used to know if the rendering should include annotations 
> +private boolean renderAnnotations = true;
> +
>  /**
>   * Creates a new PDFRenderer.
>   * @param document the document to render
> @@ -224,4 +227,14 @@ public class PDFRenderer
>  {
>  return new PageDrawer(parameters);
>  }
> +
> +public void setRenderAnnotations(boolean render) 
> +{
> +this.renderAnnotations = render;
> +}
> +
> +public boolean renderAnnotations() 
> +{
> +return renderAnnotations;
> +}
>  }
> diff --git a/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java 
> b/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java
> --- a/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java
> +++ b/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java
> @@ -195,11 +195,13 @@ public class PageDrawer extends PDFGraphicsStreamEngine
>  
>  processPage(getPage());
>  
> -for (PDAnnotation annotation : getPage().getAnnotations())
> -{
> -showAnnotation(annotation);
> +if (getRenderer().renderAnnotations()) 
> +{ 
> +for (PDAnnotation annotation : getPage().getAnnotations())
> +{
> +showAnnotation(annotation);
> +}
>  }
> -
>  graphics = null;
>  }
>  
> {code}
> And an exemple of a use case: 
> {code:java}
> PDDocument doc = getPDDocument(); 
> PDFRenderer pdfRenderer = new PDFRenderer(doc);
> pdfRenderer.setRenderAnnotations(false);
> pdfRenderer.renderImage(page);
>  
> {code}
> By default, this would be keeping the same behavior as it used to (aka : 
> print the annotations) but possess an opt-out feature.
>  
> Best regards,
> 

[jira] [Comment Edited] (PDFBOX-4094) Add support for a flag disabling the rendering of PDF annotations in PDFRenderer

2018-02-12 Thread Maxime Veron (JIRA)

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

Maxime Veron edited comment on PDFBOX-4094 at 2/12/18 10:45 AM:


[~msahyoun] I am not quite sure as to if PDFBox in its current shape of the 
PDFRendering Engine supports or not automatic rendering of stamp, does it? 

In my memory while browsing the Code I saw only specific lines of code 
dedicated to PDAnnotationLink and some other, but far from all. 

The behavior as it is right now is already a bit unexcepted as I am only asking 
PDFBox to render a page of its document, not a page with Annotations "burnt" 
in. I think it would be at least clearer if the choice was available if not in 
a flag but two different methods :

 

renderImage

renderImageWithAnnotationsBurntIn

 


was (Author: mveron):
[~msahyoun] I am not quite sure as to if PDFBox in its current shape of the 
PDFRendering Engine supports or not automatic rendering of stamp, does it? 

In my memory while browsing the Code I saw only specific lines of code 
dedicated to PDAnnotationLink and some other, but far from all. 

The behavior as it is right now is already a bit unexcepted as I am only asking 
PDFBox to render a page of its document, not a page with Annotations "burned" 
in. I think it would be at least clearer if the choice was available if not in 
a flag but two different methods :

 

renderImage

renderImageWithAnnotationsBurnedIn

 

> Add support for a flag disabling the rendering of PDF annotations in 
> PDFRenderer
> 
>
> Key: PDFBOX-4094
> URL: https://issues.apache.org/jira/browse/PDFBOX-4094
> Project: PDFBox
>  Issue Type: Wish
>  Components: Rendering
>Affects Versions: 2.0.8
>Reporter: Maxime Veron
>Priority: Minor
>
> Regardless if annotations are supposed to be printed or not on the PDF, would 
> it not be interesting to possess a flag allowing to choose if annotations 
> should be printed on top of the document pages?
>  
> Here is a diff of a very rough implementation of it : 
>  
> {code:java}
> diff --git 
> a/pdfbox/src/main/java/org/apache/pdfbox/rendering/PDFRenderer.java 
> b/pdfbox/src/main/java/org/apache/pdfbox/rendering/PDFRenderer.java
> --- a/pdfbox/src/main/java/org/apache/pdfbox/rendering/PDFRenderer.java
> +++ b/pdfbox/src/main/java/org/apache/pdfbox/rendering/PDFRenderer.java
> @@ -35,6 +35,9 @@ public class PDFRenderer
>  protected final PDDocument document;
>  // TODO keep rendering state such as caches here
>  
> +// parameter used to know if the rendering should include annotations 
> +private boolean renderAnnotations = true;
> +
>  /**
>   * Creates a new PDFRenderer.
>   * @param document the document to render
> @@ -224,4 +227,14 @@ public class PDFRenderer
>  {
>  return new PageDrawer(parameters);
>  }
> +
> +public void setRenderAnnotations(boolean render) 
> +{
> +this.renderAnnotations = render;
> +}
> +
> +public boolean renderAnnotations() 
> +{
> +return renderAnnotations;
> +}
>  }
> diff --git a/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java 
> b/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java
> --- a/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java
> +++ b/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java
> @@ -195,11 +195,13 @@ public class PageDrawer extends PDFGraphicsStreamEngine
>  
>  processPage(getPage());
>  
> -for (PDAnnotation annotation : getPage().getAnnotations())
> -{
> -showAnnotation(annotation);
> +if (getRenderer().renderAnnotations()) 
> +{ 
> +for (PDAnnotation annotation : getPage().getAnnotations())
> +{
> +showAnnotation(annotation);
> +}
>  }
> -
>  graphics = null;
>  }
>  
> {code}
> And an exemple of a use case: 
> {code:java}
> PDDocument doc = getPDDocument(); 
> PDFRenderer pdfRenderer = new PDFRenderer(doc);
> pdfRenderer.setRenderAnnotations(false);
> pdfRenderer.renderImage(page);
>  
> {code}
> By default, this would be keeping the same behavior as it used to (aka : 
> print the annotations) but possess an opt-out feature.
>  
> Best regards,
> M.Veron



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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



[jira] [Comment Edited] (PDFBOX-4094) Add support for a flag disabling the rendering of PDF annotations in PDFRenderer

2018-02-12 Thread Maxime Veron (JIRA)

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

Maxime Veron edited comment on PDFBOX-4094 at 2/12/18 10:45 AM:


[~msahyoun] I am not quite sure as to if PDFBox in its current shape of the 
PDFRendering Engine supports or not automatic rendering of stamp, does it? 

In my memory while browsing the Code I saw only specific lines of code 
dedicated to PDAnnotationLink and some other, but far from all. 

The behavior as it is right now is already a bit unexcepted as I am only asking 
PDFBox to render a page of its document, not a page with Annotations "burned" 
in. I think it would be at least clearer if the choice was available if not in 
a flag but two different methods :

 

renderImage

renderImageWithAnnotationsBurnedIn

 

Edit: Monday grammar...

 


was (Author: mveron):
[~msahyoun] I am not quite sure as to if PDFBox in its current shape of the 
PDFRendering Engine supports or not automatic rendering of stamp, does it? 

In my memory while browsing the Code I saw only specific lines of code 
dedicated to PDAnnotationLink and some other, but far from all. 

The behavior as it is right now is already a bit unexcepted as I am only asking 
PDFBox to render a page of its document, not a page with Annotations "burnt" 
in. I think it would be at least clearer if the choice was available if not in 
a flag but two different methods :

 

renderImage

renderImageWithAnnotationsBurntIn

 

> Add support for a flag disabling the rendering of PDF annotations in 
> PDFRenderer
> 
>
> Key: PDFBOX-4094
> URL: https://issues.apache.org/jira/browse/PDFBOX-4094
> Project: PDFBox
>  Issue Type: Wish
>  Components: Rendering
>Affects Versions: 2.0.8
>Reporter: Maxime Veron
>Priority: Minor
>
> Regardless if annotations are supposed to be printed or not on the PDF, would 
> it not be interesting to possess a flag allowing to choose if annotations 
> should be printed on top of the document pages?
>  
> Here is a diff of a very rough implementation of it : 
>  
> {code:java}
> diff --git 
> a/pdfbox/src/main/java/org/apache/pdfbox/rendering/PDFRenderer.java 
> b/pdfbox/src/main/java/org/apache/pdfbox/rendering/PDFRenderer.java
> --- a/pdfbox/src/main/java/org/apache/pdfbox/rendering/PDFRenderer.java
> +++ b/pdfbox/src/main/java/org/apache/pdfbox/rendering/PDFRenderer.java
> @@ -35,6 +35,9 @@ public class PDFRenderer
>  protected final PDDocument document;
>  // TODO keep rendering state such as caches here
>  
> +// parameter used to know if the rendering should include annotations 
> +private boolean renderAnnotations = true;
> +
>  /**
>   * Creates a new PDFRenderer.
>   * @param document the document to render
> @@ -224,4 +227,14 @@ public class PDFRenderer
>  {
>  return new PageDrawer(parameters);
>  }
> +
> +public void setRenderAnnotations(boolean render) 
> +{
> +this.renderAnnotations = render;
> +}
> +
> +public boolean renderAnnotations() 
> +{
> +return renderAnnotations;
> +}
>  }
> diff --git a/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java 
> b/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java
> --- a/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java
> +++ b/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java
> @@ -195,11 +195,13 @@ public class PageDrawer extends PDFGraphicsStreamEngine
>  
>  processPage(getPage());
>  
> -for (PDAnnotation annotation : getPage().getAnnotations())
> -{
> -showAnnotation(annotation);
> +if (getRenderer().renderAnnotations()) 
> +{ 
> +for (PDAnnotation annotation : getPage().getAnnotations())
> +{
> +showAnnotation(annotation);
> +}
>  }
> -
>  graphics = null;
>  }
>  
> {code}
> And an exemple of a use case: 
> {code:java}
> PDDocument doc = getPDDocument(); 
> PDFRenderer pdfRenderer = new PDFRenderer(doc);
> pdfRenderer.setRenderAnnotations(false);
> pdfRenderer.renderImage(page);
>  
> {code}
> By default, this would be keeping the same behavior as it used to (aka : 
> print the annotations) but possess an opt-out feature.
>  
> Best regards,
> M.Veron



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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



[jira] [Comment Edited] (PDFBOX-4094) Add support for a flag disabling the rendering of PDF annotations in PDFRenderer

2018-02-12 Thread Maruan Sahyoun (JIRA)

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

Maruan Sahyoun edited comment on PDFBOX-4094 at 2/12/18 9:17 AM:
-

Reader/Acrobat allow to exclude annotations from printing. That does not 
include form fields. We'd need to test what is/is not included/excluded. IMHO 
it doesn't makes sense to excluded everything as urls etc. might be gone.


was (Author: msahyoun):
Reader/Acrobat allow to exclude annotations from printing. That does not 
include form fields. 

> Add support for a flag disabling the rendering of PDF annotations in 
> PDFRenderer
> 
>
> Key: PDFBOX-4094
> URL: https://issues.apache.org/jira/browse/PDFBOX-4094
> Project: PDFBox
>  Issue Type: Wish
>  Components: Rendering
>Affects Versions: 2.0.8
>Reporter: Maxime Veron
>Priority: Minor
>
> Regardless if annotations are supposed to be printed or not on the PDF, would 
> it not be interesting to possess a flag allowing to choose if annotations 
> should be printed on top of the document pages?
>  
> Here is a diff of a very rough implementation of it : 
>  
> {code:java}
> diff --git 
> a/pdfbox/src/main/java/org/apache/pdfbox/rendering/PDFRenderer.java 
> b/pdfbox/src/main/java/org/apache/pdfbox/rendering/PDFRenderer.java
> --- a/pdfbox/src/main/java/org/apache/pdfbox/rendering/PDFRenderer.java
> +++ b/pdfbox/src/main/java/org/apache/pdfbox/rendering/PDFRenderer.java
> @@ -35,6 +35,9 @@ public class PDFRenderer
>  protected final PDDocument document;
>  // TODO keep rendering state such as caches here
>  
> +// parameter used to know if the rendering should include annotations 
> +private boolean renderAnnotations = true;
> +
>  /**
>   * Creates a new PDFRenderer.
>   * @param document the document to render
> @@ -224,4 +227,14 @@ public class PDFRenderer
>  {
>  return new PageDrawer(parameters);
>  }
> +
> +public void setRenderAnnotations(boolean render) 
> +{
> +this.renderAnnotations = render;
> +}
> +
> +public boolean renderAnnotations() 
> +{
> +return renderAnnotations;
> +}
>  }
> diff --git a/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java 
> b/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java
> --- a/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java
> +++ b/pdfbox/src/main/java/org/apache/pdfbox/rendering/PageDrawer.java
> @@ -195,11 +195,13 @@ public class PageDrawer extends PDFGraphicsStreamEngine
>  
>  processPage(getPage());
>  
> -for (PDAnnotation annotation : getPage().getAnnotations())
> -{
> -showAnnotation(annotation);
> +if (getRenderer().renderAnnotations()) 
> +{ 
> +for (PDAnnotation annotation : getPage().getAnnotations())
> +{
> +showAnnotation(annotation);
> +}
>  }
> -
>  graphics = null;
>  }
>  
> {code}
> And an exemple of a use case: 
> {code:java}
> PDDocument doc = getPDDocument(); 
> PDFRenderer pdfRenderer = new PDFRenderer(doc);
> pdfRenderer.setRenderAnnotations(false);
> pdfRenderer.renderImage(page);
>  
> {code}
> By default, this would be keeping the same behavior as it used to (aka : 
> print the annotations) but possess an opt-out feature.
>  
> Best regards,
> M.Veron



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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