[jira] [Commented] (PDFBOX-4583) Drawing only a portion of a PDF (Graphics.clip is ignored/overwritten)

2019-07-12 Thread Tilman Hausherr (JIRA)


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

Tilman Hausherr commented on PDFBOX-4583:
-

I did work a bit on this and my thought was: I can get the delta by inverting 
the initial transform and multiplying that one with the current graphics 
transform. However the code doesn't work when transforming the clip with the 
inverse of this delta, or with this delta. I must have missed something. 
Because of that I reverted the change in setClip() and we're mostly back at 
square one. I'm keeping the changes that save the settings, but somebody else 
will have to finish this.

> Drawing only a portion of a PDF (Graphics.clip is ignored/overwritten)
> --
>
> Key: PDFBOX-4583
> URL: https://issues.apache.org/jira/browse/PDFBOX-4583
> Project: PDFBox
>  Issue Type: Bug
>  Components: Rendering
>Affects Versions: 2.0.15
>Reporter: Jan Buschtöns
>Assignee: Tilman Hausherr
>Priority: Major
> Fix For: 2.0.17, 3.0.0 PDFBox
>
> Attachments: clip_PDFBox_FORMGEN-2184-master.zip
>
>
> I want to use PDFBox to draw PDFs in a swing application.
> I want to draw only a portion of the PDF. As far as I know, the way to do 
> this in swing is with the "clip"-method on the Graphics object. However, no 
> matter what clip I set, the whole PDF is drawn.
> PDFRenderer calls "setClip", when it probably should use "clip". The latter 
> sets the current clip to the intersection of the old current clip and the 
> provided shape, whereas the former resets the current clip
> I've attached an example maven project, but the gist is:
> {code:java}
>   @Override 
>   public void paint(final Graphics g) { 
>  
>   final Graphics2D g2 = (Graphics2D) g; 
>   try { 
>   PDDocument pdDocument = 
> DDocument.load(App.class.getResourceAsStream("somepdf.pdf")); 
>   g2.clip(new Rectangle(20, 20)); 
>   final PDFRenderer pdfRenderer = new 
> org.apache.pdfbox.rendering.PDFRenderer(pdDocument); 
>   pdfRenderer.renderPageToGraphics(0, g2); 
>   } catch (final IOException e) { 
>   throw new RuntimeException(e); 
>   } 
>   }
>   {code}



--
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-4583) Drawing only a portion of a PDF (Graphics.clip is ignored/overwritten)

2019-07-12 Thread ASF subversion and git services (JIRA)


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

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

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

PDFBOX-4581, PDFBOX-4583: improve javadoc

> Drawing only a portion of a PDF (Graphics.clip is ignored/overwritten)
> --
>
> Key: PDFBOX-4583
> URL: https://issues.apache.org/jira/browse/PDFBOX-4583
> Project: PDFBox
>  Issue Type: Bug
>  Components: Rendering
>Affects Versions: 2.0.15
>Reporter: Jan Buschtöns
>Assignee: Tilman Hausherr
>Priority: Major
> Fix For: 2.0.17, 3.0.0 PDFBox
>
> Attachments: clip_PDFBox_FORMGEN-2184-master.zip
>
>
> I want to use PDFBox to draw PDFs in a swing application.
> I want to draw only a portion of the PDF. As far as I know, the way to do 
> this in swing is with the "clip"-method on the Graphics object. However, no 
> matter what clip I set, the whole PDF is drawn.
> PDFRenderer calls "setClip", when it probably should use "clip". The latter 
> sets the current clip to the intersection of the old current clip and the 
> provided shape, whereas the former resets the current clip
> I've attached an example maven project, but the gist is:
> {code:java}
>   @Override 
>   public void paint(final Graphics g) { 
>  
>   final Graphics2D g2 = (Graphics2D) g; 
>   try { 
>   PDDocument pdDocument = 
> DDocument.load(App.class.getResourceAsStream("somepdf.pdf")); 
>   g2.clip(new Rectangle(20, 20)); 
>   final PDFRenderer pdfRenderer = new 
> org.apache.pdfbox.rendering.PDFRenderer(pdDocument); 
>   pdfRenderer.renderPageToGraphics(0, g2); 
>   } catch (final IOException e) { 
>   throw new RuntimeException(e); 
>   } 
>   }
>   {code}



--
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-4583) Drawing only a portion of a PDF (Graphics.clip is ignored/overwritten)

2019-07-12 Thread ASF subversion and git services (JIRA)


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

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

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

PDFBOX-4581, PDFBOX-4583: improve javadoc

> Drawing only a portion of a PDF (Graphics.clip is ignored/overwritten)
> --
>
> Key: PDFBOX-4583
> URL: https://issues.apache.org/jira/browse/PDFBOX-4583
> Project: PDFBox
>  Issue Type: Bug
>  Components: Rendering
>Affects Versions: 2.0.15
>Reporter: Jan Buschtöns
>Assignee: Tilman Hausherr
>Priority: Major
> Fix For: 2.0.17, 3.0.0 PDFBox
>
> Attachments: clip_PDFBox_FORMGEN-2184-master.zip
>
>
> I want to use PDFBox to draw PDFs in a swing application.
> I want to draw only a portion of the PDF. As far as I know, the way to do 
> this in swing is with the "clip"-method on the Graphics object. However, no 
> matter what clip I set, the whole PDF is drawn.
> PDFRenderer calls "setClip", when it probably should use "clip". The latter 
> sets the current clip to the intersection of the old current clip and the 
> provided shape, whereas the former resets the current clip
> I've attached an example maven project, but the gist is:
> {code:java}
>   @Override 
>   public void paint(final Graphics g) { 
>  
>   final Graphics2D g2 = (Graphics2D) g; 
>   try { 
>   PDDocument pdDocument = 
> DDocument.load(App.class.getResourceAsStream("somepdf.pdf")); 
>   g2.clip(new Rectangle(20, 20)); 
>   final PDFRenderer pdfRenderer = new 
> org.apache.pdfbox.rendering.PDFRenderer(pdDocument); 
>   pdfRenderer.renderPageToGraphics(0, g2); 
>   } catch (final IOException e) { 
>   throw new RuntimeException(e); 
>   } 
>   }
>   {code}



--
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-4583) Drawing only a portion of a PDF (Graphics.clip is ignored/overwritten)

2019-07-12 Thread ASF subversion and git services (JIRA)


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

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

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

PDFBOX-4581, PDFBOX-4583: improve javadoc

> Drawing only a portion of a PDF (Graphics.clip is ignored/overwritten)
> --
>
> Key: PDFBOX-4583
> URL: https://issues.apache.org/jira/browse/PDFBOX-4583
> Project: PDFBox
>  Issue Type: Bug
>  Components: Rendering
>Affects Versions: 2.0.15
>Reporter: Jan Buschtöns
>Assignee: Tilman Hausherr
>Priority: Major
> Fix For: 2.0.17, 3.0.0 PDFBox
>
> Attachments: clip_PDFBox_FORMGEN-2184-master.zip
>
>
> I want to use PDFBox to draw PDFs in a swing application.
> I want to draw only a portion of the PDF. As far as I know, the way to do 
> this in swing is with the "clip"-method on the Graphics object. However, no 
> matter what clip I set, the whole PDF is drawn.
> PDFRenderer calls "setClip", when it probably should use "clip". The latter 
> sets the current clip to the intersection of the old current clip and the 
> provided shape, whereas the former resets the current clip
> I've attached an example maven project, but the gist is:
> {code:java}
>   @Override 
>   public void paint(final Graphics g) { 
>  
>   final Graphics2D g2 = (Graphics2D) g; 
>   try { 
>   PDDocument pdDocument = 
> DDocument.load(App.class.getResourceAsStream("somepdf.pdf")); 
>   g2.clip(new Rectangle(20, 20)); 
>   final PDFRenderer pdfRenderer = new 
> org.apache.pdfbox.rendering.PDFRenderer(pdDocument); 
>   pdfRenderer.renderPageToGraphics(0, g2); 
>   } catch (final IOException e) { 
>   throw new RuntimeException(e); 
>   } 
>   }
>   {code}



--
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-4583) Drawing only a portion of a PDF (Graphics.clip is ignored/overwritten)

2019-07-12 Thread ASF subversion and git services (JIRA)


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

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

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

PDFBOX-4581, PDFBOX-4583: improve javadoc

> Drawing only a portion of a PDF (Graphics.clip is ignored/overwritten)
> --
>
> Key: PDFBOX-4583
> URL: https://issues.apache.org/jira/browse/PDFBOX-4583
> Project: PDFBox
>  Issue Type: Bug
>  Components: Rendering
>Affects Versions: 2.0.15
>Reporter: Jan Buschtöns
>Assignee: Tilman Hausherr
>Priority: Major
> Fix For: 2.0.17, 3.0.0 PDFBox
>
> Attachments: clip_PDFBox_FORMGEN-2184-master.zip
>
>
> I want to use PDFBox to draw PDFs in a swing application.
> I want to draw only a portion of the PDF. As far as I know, the way to do 
> this in swing is with the "clip"-method on the Graphics object. However, no 
> matter what clip I set, the whole PDF is drawn.
> PDFRenderer calls "setClip", when it probably should use "clip". The latter 
> sets the current clip to the intersection of the old current clip and the 
> provided shape, whereas the former resets the current clip
> I've attached an example maven project, but the gist is:
> {code:java}
>   @Override 
>   public void paint(final Graphics g) { 
>  
>   final Graphics2D g2 = (Graphics2D) g; 
>   try { 
>   PDDocument pdDocument = 
> DDocument.load(App.class.getResourceAsStream("somepdf.pdf")); 
>   g2.clip(new Rectangle(20, 20)); 
>   final PDFRenderer pdfRenderer = new 
> org.apache.pdfbox.rendering.PDFRenderer(pdDocument); 
>   pdfRenderer.renderPageToGraphics(0, g2); 
>   } catch (final IOException e) { 
>   throw new RuntimeException(e); 
>   } 
>   }
>   {code}



--
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-4583) Drawing only a portion of a PDF (Graphics.clip is ignored/overwritten)

2019-07-12 Thread ASF subversion and git services (JIRA)


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

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

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

PDFBOX-4583: revert clipping intersection, didn't work

> Drawing only a portion of a PDF (Graphics.clip is ignored/overwritten)
> --
>
> Key: PDFBOX-4583
> URL: https://issues.apache.org/jira/browse/PDFBOX-4583
> Project: PDFBox
>  Issue Type: Bug
>  Components: Rendering
>Affects Versions: 2.0.15
>Reporter: Jan Buschtöns
>Assignee: Tilman Hausherr
>Priority: Major
> Fix For: 2.0.17, 3.0.0 PDFBox
>
> Attachments: clip_PDFBox_FORMGEN-2184-master.zip
>
>
> I want to use PDFBox to draw PDFs in a swing application.
> I want to draw only a portion of the PDF. As far as I know, the way to do 
> this in swing is with the "clip"-method on the Graphics object. However, no 
> matter what clip I set, the whole PDF is drawn.
> PDFRenderer calls "setClip", when it probably should use "clip". The latter 
> sets the current clip to the intersection of the old current clip and the 
> provided shape, whereas the former resets the current clip
> I've attached an example maven project, but the gist is:
> {code:java}
>   @Override 
>   public void paint(final Graphics g) { 
>  
>   final Graphics2D g2 = (Graphics2D) g; 
>   try { 
>   PDDocument pdDocument = 
> DDocument.load(App.class.getResourceAsStream("somepdf.pdf")); 
>   g2.clip(new Rectangle(20, 20)); 
>   final PDFRenderer pdfRenderer = new 
> org.apache.pdfbox.rendering.PDFRenderer(pdDocument); 
>   pdfRenderer.renderPageToGraphics(0, g2); 
>   } catch (final IOException e) { 
>   throw new RuntimeException(e); 
>   } 
>   }
>   {code}



--
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-4583) Drawing only a portion of a PDF (Graphics.clip is ignored/overwritten)

2019-07-12 Thread ASF subversion and git services (JIRA)


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

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

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

PDFBOX-4583: revert clipping intersection, didn't work

> Drawing only a portion of a PDF (Graphics.clip is ignored/overwritten)
> --
>
> Key: PDFBOX-4583
> URL: https://issues.apache.org/jira/browse/PDFBOX-4583
> Project: PDFBox
>  Issue Type: Bug
>  Components: Rendering
>Affects Versions: 2.0.15
>Reporter: Jan Buschtöns
>Assignee: Tilman Hausherr
>Priority: Major
> Fix For: 2.0.17, 3.0.0 PDFBox
>
> Attachments: clip_PDFBox_FORMGEN-2184-master.zip
>
>
> I want to use PDFBox to draw PDFs in a swing application.
> I want to draw only a portion of the PDF. As far as I know, the way to do 
> this in swing is with the "clip"-method on the Graphics object. However, no 
> matter what clip I set, the whole PDF is drawn.
> PDFRenderer calls "setClip", when it probably should use "clip". The latter 
> sets the current clip to the intersection of the old current clip and the 
> provided shape, whereas the former resets the current clip
> I've attached an example maven project, but the gist is:
> {code:java}
>   @Override 
>   public void paint(final Graphics g) { 
>  
>   final Graphics2D g2 = (Graphics2D) g; 
>   try { 
>   PDDocument pdDocument = 
> DDocument.load(App.class.getResourceAsStream("somepdf.pdf")); 
>   g2.clip(new Rectangle(20, 20)); 
>   final PDFRenderer pdfRenderer = new 
> org.apache.pdfbox.rendering.PDFRenderer(pdDocument); 
>   pdfRenderer.renderPageToGraphics(0, g2); 
>   } catch (final IOException e) { 
>   throw new RuntimeException(e); 
>   } 
>   }
>   {code}



--
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-4583) Drawing only a portion of a PDF (Graphics.clip is ignored/overwritten)

2019-07-12 Thread ASF subversion and git services (JIRA)


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

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

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

PDFBOX-4583: revert clipping intersection, didn't work

> Drawing only a portion of a PDF (Graphics.clip is ignored/overwritten)
> --
>
> Key: PDFBOX-4583
> URL: https://issues.apache.org/jira/browse/PDFBOX-4583
> Project: PDFBox
>  Issue Type: Bug
>  Components: Rendering
>Affects Versions: 2.0.15
>Reporter: Jan Buschtöns
>Assignee: Tilman Hausherr
>Priority: Major
> Fix For: 2.0.17, 3.0.0 PDFBox
>
> Attachments: clip_PDFBox_FORMGEN-2184-master.zip
>
>
> I want to use PDFBox to draw PDFs in a swing application.
> I want to draw only a portion of the PDF. As far as I know, the way to do 
> this in swing is with the "clip"-method on the Graphics object. However, no 
> matter what clip I set, the whole PDF is drawn.
> PDFRenderer calls "setClip", when it probably should use "clip". The latter 
> sets the current clip to the intersection of the old current clip and the 
> provided shape, whereas the former resets the current clip
> I've attached an example maven project, but the gist is:
> {code:java}
>   @Override 
>   public void paint(final Graphics g) { 
>  
>   final Graphics2D g2 = (Graphics2D) g; 
>   try { 
>   PDDocument pdDocument = 
> DDocument.load(App.class.getResourceAsStream("somepdf.pdf")); 
>   g2.clip(new Rectangle(20, 20)); 
>   final PDFRenderer pdfRenderer = new 
> org.apache.pdfbox.rendering.PDFRenderer(pdDocument); 
>   pdfRenderer.renderPageToGraphics(0, g2); 
>   } catch (final IOException e) { 
>   throw new RuntimeException(e); 
>   } 
>   }
>   {code}



--
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-4583) Drawing only a portion of a PDF (Graphics.clip is ignored/overwritten)

2019-07-12 Thread ASF subversion and git services (JIRA)


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

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

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

PDFBOX-4583: revert clipping intersection, didn't work

> Drawing only a portion of a PDF (Graphics.clip is ignored/overwritten)
> --
>
> Key: PDFBOX-4583
> URL: https://issues.apache.org/jira/browse/PDFBOX-4583
> Project: PDFBox
>  Issue Type: Bug
>  Components: Rendering
>Affects Versions: 2.0.15
>Reporter: Jan Buschtöns
>Assignee: Tilman Hausherr
>Priority: Major
> Fix For: 2.0.17, 3.0.0 PDFBox
>
> Attachments: clip_PDFBox_FORMGEN-2184-master.zip
>
>
> I want to use PDFBox to draw PDFs in a swing application.
> I want to draw only a portion of the PDF. As far as I know, the way to do 
> this in swing is with the "clip"-method on the Graphics object. However, no 
> matter what clip I set, the whole PDF is drawn.
> PDFRenderer calls "setClip", when it probably should use "clip". The latter 
> sets the current clip to the intersection of the old current clip and the 
> provided shape, whereas the former resets the current clip
> I've attached an example maven project, but the gist is:
> {code:java}
>   @Override 
>   public void paint(final Graphics g) { 
>  
>   final Graphics2D g2 = (Graphics2D) g; 
>   try { 
>   PDDocument pdDocument = 
> DDocument.load(App.class.getResourceAsStream("somepdf.pdf")); 
>   g2.clip(new Rectangle(20, 20)); 
>   final PDFRenderer pdfRenderer = new 
> org.apache.pdfbox.rendering.PDFRenderer(pdDocument); 
>   pdfRenderer.renderPageToGraphics(0, g2); 
>   } catch (final IOException e) { 
>   throw new RuntimeException(e); 
>   } 
>   }
>   {code}



--
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-4583) Drawing only a portion of a PDF (Graphics.clip is ignored/overwritten)

2019-07-03 Thread Tilman Hausherr (JIRA)


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

Tilman Hausherr commented on PDFBOX-4583:
-

I realize this is more complex than I thought: if I set a clip to 100x100, then 
do a scale(2,2), and then ask for the clip size, the result is a 50x50 
rectangle. So the reverse transform should be applied. The next problem is that 
this won't work properly if there was already a transform at the beginning. I 
think one should apply the reverse of the transform "delta" between the initial 
transform and "now" (i.e. the time where {{PageDrawer.setClip()}}).

So either I need a way to extract the delta from two transforms, or I need to 
apply all transforms not just to graphics but to another transform that follows 
the graphics device and starts at identity.

> Drawing only a portion of a PDF (Graphics.clip is ignored/overwritten)
> --
>
> Key: PDFBOX-4583
> URL: https://issues.apache.org/jira/browse/PDFBOX-4583
> Project: PDFBox
>  Issue Type: Bug
>  Components: Rendering
>Affects Versions: 2.0.15
>Reporter: Jan Buschtöns
>Assignee: Tilman Hausherr
>Priority: Major
> Fix For: 2.0.17, 3.0.0 PDFBox
>
> Attachments: clip_PDFBox_FORMGEN-2184-master.zip
>
>
> I want to use PDFBox to draw PDFs in a swing application.
> I want to draw only a portion of the PDF. As far as I know, the way to do 
> this in swing is with the "clip"-method on the Graphics object. However, no 
> matter what clip I set, the whole PDF is drawn.
> PDFRenderer calls "setClip", when it probably should use "clip". The latter 
> sets the current clip to the intersection of the old current clip and the 
> provided shape, whereas the former resets the current clip
> I've attached an example maven project, but the gist is:
> {code:java}
>   @Override 
>   public void paint(final Graphics g) { 
>  
>   final Graphics2D g2 = (Graphics2D) g; 
>   try { 
>   PDDocument pdDocument = 
> DDocument.load(App.class.getResourceAsStream("somepdf.pdf")); 
>   g2.clip(new Rectangle(20, 20)); 
>   final PDFRenderer pdfRenderer = new 
> org.apache.pdfbox.rendering.PDFRenderer(pdDocument); 
>   pdfRenderer.renderPageToGraphics(0, g2); 
>   } catch (final IOException e) { 
>   throw new RuntimeException(e); 
>   } 
>   }
>   {code}



--
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] [Commented] (PDFBOX-4583) Drawing only a portion of a PDF (Graphics.clip is ignored/overwritten)

2019-07-03 Thread JIRA


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

Jan Buschtöns commented on PDFBOX-4583:
---

Okay. 

{code:java}
final int r = 20;

// Additional Transformation
final double scale = 1.01;
g2.transform(AffineTransform.getScaleInstance(scale, scale));

final AffineTransform transform = g2.getTransform();

final Stroke stroke = g2.getStroke();
final Composite composite = g2.getComposite();
final RenderingHints renderingHints = g2.getRenderingHints();
final Color background = g2.getBackground();
final Paint paint = g2.getPaint();
g2.clip(new Rectangle(r, r));
final Shape clip = g2.getClip();
final PDDocument pdDocument = 
PDDocument.load(App.class.getResourceAsStream("/de/abm/bug/x.pdf")); // I did a 
direct loading here because I didn't set up an extra project
final PDFRenderer pdfRenderer = new 
org.apache.pdfbox.rendering.PDFRenderer(pdDocument);
pdfRenderer.renderPageToGraphics(0, g2);

g2.setTransform(transform);
g2.setStroke(stroke);
g2.setComposite(composite);
g2.setRenderingHints(renderingHints);
g2.setClip(clip);
g2.setBackground(background);
g2.setPaint(paint);

g2.setColor(Color.black);
g2.drawRect(0, 0, r-1, r-1); // -1 is important or it won't be 
seen
{code}

Now its the same code you posted, but with an additional scaling transform. I 
would expect the black rectangle to be filled with the PDF. But that's only the 
case for scale = 1;

> Drawing only a portion of a PDF (Graphics.clip is ignored/overwritten)
> --
>
> Key: PDFBOX-4583
> URL: https://issues.apache.org/jira/browse/PDFBOX-4583
> Project: PDFBox
>  Issue Type: Bug
>  Components: Rendering
>Affects Versions: 2.0.15
>Reporter: Jan Buschtöns
>Assignee: Tilman Hausherr
>Priority: Major
> Fix For: 2.0.17, 3.0.0 PDFBox
>
> Attachments: clip_PDFBox_FORMGEN-2184-master.zip
>
>
> I want to use PDFBox to draw PDFs in a swing application.
> I want to draw only a portion of the PDF. As far as I know, the way to do 
> this in swing is with the "clip"-method on the Graphics object. However, no 
> matter what clip I set, the whole PDF is drawn.
> PDFRenderer calls "setClip", when it probably should use "clip". The latter 
> sets the current clip to the intersection of the old current clip and the 
> provided shape, whereas the former resets the current clip
> I've attached an example maven project, but the gist is:
> {code:java}
>   @Override 
>   public void paint(final Graphics g) { 
>  
>   final Graphics2D g2 = (Graphics2D) g; 
>   try { 
>   PDDocument pdDocument = 
> DDocument.load(App.class.getResourceAsStream("somepdf.pdf")); 
>   g2.clip(new Rectangle(20, 20)); 
>   final PDFRenderer pdfRenderer = new 
> org.apache.pdfbox.rendering.PDFRenderer(pdDocument); 
>   pdfRenderer.renderPageToGraphics(0, g2); 
>   } catch (final IOException e) { 
>   throw new RuntimeException(e); 
>   } 
>   }
>   {code}



--
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] [Commented] (PDFBOX-4583) Drawing only a portion of a PDF (Graphics.clip is ignored/overwritten)

2019-07-02 Thread Tilman Hausherr (JIRA)


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

Tilman Hausherr commented on PDFBOX-4583:
-

But you didn''t save/restore the clip in that code. I did it in the code I 
posted yesterday.

> Drawing only a portion of a PDF (Graphics.clip is ignored/overwritten)
> --
>
> Key: PDFBOX-4583
> URL: https://issues.apache.org/jira/browse/PDFBOX-4583
> Project: PDFBox
>  Issue Type: Bug
>  Components: Rendering
>Affects Versions: 2.0.15
>Reporter: Jan Buschtöns
>Assignee: Tilman Hausherr
>Priority: Major
> Fix For: 2.0.17, 3.0.0 PDFBox
>
> Attachments: clip_PDFBox_FORMGEN-2184-master.zip
>
>
> I want to use PDFBox to draw PDFs in a swing application.
> I want to draw only a portion of the PDF. As far as I know, the way to do 
> this in swing is with the "clip"-method on the Graphics object. However, no 
> matter what clip I set, the whole PDF is drawn.
> PDFRenderer calls "setClip", when it probably should use "clip". The latter 
> sets the current clip to the intersection of the old current clip and the 
> provided shape, whereas the former resets the current clip
> I've attached an example maven project, but the gist is:
> {code:java}
>   @Override 
>   public void paint(final Graphics g) { 
>  
>   final Graphics2D g2 = (Graphics2D) g; 
>   try { 
>   PDDocument pdDocument = 
> DDocument.load(App.class.getResourceAsStream("somepdf.pdf")); 
>   g2.clip(new Rectangle(20, 20)); 
>   final PDFRenderer pdfRenderer = new 
> org.apache.pdfbox.rendering.PDFRenderer(pdDocument); 
>   pdfRenderer.renderPageToGraphics(0, g2); 
>   } catch (final IOException e) { 
>   throw new RuntimeException(e); 
>   } 
>   }
>   {code}



--
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] [Commented] (PDFBOX-4583) Drawing only a portion of a PDF (Graphics.clip is ignored/overwritten)

2019-07-02 Thread JIRA


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

Jan Buschtöns commented on PDFBOX-4583:
---

{code:java}

public void paint(final Graphics g) {

final Graphics2D g2 = (Graphics2D) g;
try {

final int r = 20;
final double scale = 1.1;
final AffineTransform transform = g2.getTransform();
transform.scale(scale, scale);
g2.setTransform(transform);
final Rectangle rectangle = new Rectangle(r, r);
g2.clip(rectangle);
g2.setColor(Color.WHITE);
g2.fill(rectangle);
final PDDocument pdDocument = 
PDDocument.load(App.class.getResourceAsStream("/de/abm/bug/x.pdf"));
final PDFRenderer pdfRenderer = new 
org.apache.pdfbox.rendering.PDFRenderer(pdDocument);
pdfRenderer.renderPageToGraphics(0, g2);
g2.setTransform(transform);
g2.setColor(Color.black);
g2.drawRect(0, 0, r, r);
} catch (final IOException e) {
throw new RuntimeException(e);
}
}
}

{code}

I added a transformation that scales. For scale 1.001 I an see the sqare, for 
1.01 I see half a square, for 1.1 I see nothing.

> Drawing only a portion of a PDF (Graphics.clip is ignored/overwritten)
> --
>
> Key: PDFBOX-4583
> URL: https://issues.apache.org/jira/browse/PDFBOX-4583
> Project: PDFBox
>  Issue Type: Bug
>  Components: Rendering
>Affects Versions: 2.0.15
>Reporter: Jan Buschtöns
>Assignee: Tilman Hausherr
>Priority: Major
> Fix For: 2.0.17, 3.0.0 PDFBox
>
> Attachments: clip_PDFBox_FORMGEN-2184-master.zip
>
>
> I want to use PDFBox to draw PDFs in a swing application.
> I want to draw only a portion of the PDF. As far as I know, the way to do 
> this in swing is with the "clip"-method on the Graphics object. However, no 
> matter what clip I set, the whole PDF is drawn.
> PDFRenderer calls "setClip", when it probably should use "clip". The latter 
> sets the current clip to the intersection of the old current clip and the 
> provided shape, whereas the former resets the current clip
> I've attached an example maven project, but the gist is:
> {code:java}
>   @Override 
>   public void paint(final Graphics g) { 
>  
>   final Graphics2D g2 = (Graphics2D) g; 
>   try { 
>   PDDocument pdDocument = 
> DDocument.load(App.class.getResourceAsStream("somepdf.pdf")); 
>   g2.clip(new Rectangle(20, 20)); 
>   final PDFRenderer pdfRenderer = new 
> org.apache.pdfbox.rendering.PDFRenderer(pdDocument); 
>   pdfRenderer.renderPageToGraphics(0, g2); 
>   } catch (final IOException e) { 
>   throw new RuntimeException(e); 
>   } 
>   }
>   {code}



--
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] [Commented] (PDFBOX-4583) Drawing only a portion of a PDF (Graphics.clip is ignored/overwritten)

2019-07-01 Thread Tilman Hausherr (JIRA)


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

Tilman Hausherr commented on PDFBOX-4583:
-

Then we need some new "simple" code that reproduces the effect.

> Drawing only a portion of a PDF (Graphics.clip is ignored/overwritten)
> --
>
> Key: PDFBOX-4583
> URL: https://issues.apache.org/jira/browse/PDFBOX-4583
> Project: PDFBox
>  Issue Type: Bug
>  Components: Rendering
>Affects Versions: 2.0.15
>Reporter: Jan Buschtöns
>Assignee: Tilman Hausherr
>Priority: Major
> Fix For: 2.0.17, 3.0.0 PDFBox
>
> Attachments: clip_PDFBox_FORMGEN-2184-master.zip
>
>
> I want to use PDFBox to draw PDFs in a swing application.
> I want to draw only a portion of the PDF. As far as I know, the way to do 
> this in swing is with the "clip"-method on the Graphics object. However, no 
> matter what clip I set, the whole PDF is drawn.
> PDFRenderer calls "setClip", when it probably should use "clip". The latter 
> sets the current clip to the intersection of the old current clip and the 
> provided shape, whereas the former resets the current clip
> I've attached an example maven project, but the gist is:
> {code:java}
>   @Override 
>   public void paint(final Graphics g) { 
>  
>   final Graphics2D g2 = (Graphics2D) g; 
>   try { 
>   PDDocument pdDocument = 
> DDocument.load(App.class.getResourceAsStream("somepdf.pdf")); 
>   g2.clip(new Rectangle(20, 20)); 
>   final PDFRenderer pdfRenderer = new 
> org.apache.pdfbox.rendering.PDFRenderer(pdDocument); 
>   pdfRenderer.renderPageToGraphics(0, g2); 
>   } catch (final IOException e) { 
>   throw new RuntimeException(e); 
>   } 
>   }
>   {code}



--
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] [Commented] (PDFBOX-4583) Drawing only a portion of a PDF (Graphics.clip is ignored/overwritten)

2019-07-01 Thread JIRA


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

Jan Buschtöns commented on PDFBOX-4583:
---

Hmm. The example code works. It's just that the PDF I was drawing simply was 
transparent on the upper left corner I was drawing...

But my original application just draws white instead of a pdf now. I've also 
changed the code to remember and then restore all those settings. That doesn't 
help, either. It works with 2.0.16 but not with 2.0.17-SNAPSHOT

> Drawing only a portion of a PDF (Graphics.clip is ignored/overwritten)
> --
>
> Key: PDFBOX-4583
> URL: https://issues.apache.org/jira/browse/PDFBOX-4583
> Project: PDFBox
>  Issue Type: Bug
>  Components: Rendering
>Affects Versions: 2.0.15
>Reporter: Jan Buschtöns
>Assignee: Tilman Hausherr
>Priority: Major
> Fix For: 2.0.17, 3.0.0 PDFBox
>
> Attachments: clip_PDFBox_FORMGEN-2184-master.zip
>
>
> I want to use PDFBox to draw PDFs in a swing application.
> I want to draw only a portion of the PDF. As far as I know, the way to do 
> this in swing is with the "clip"-method on the Graphics object. However, no 
> matter what clip I set, the whole PDF is drawn.
> PDFRenderer calls "setClip", when it probably should use "clip". The latter 
> sets the current clip to the intersection of the old current clip and the 
> provided shape, whereas the former resets the current clip
> I've attached an example maven project, but the gist is:
> {code:java}
>   @Override 
>   public void paint(final Graphics g) { 
>  
>   final Graphics2D g2 = (Graphics2D) g; 
>   try { 
>   PDDocument pdDocument = 
> DDocument.load(App.class.getResourceAsStream("somepdf.pdf")); 
>   g2.clip(new Rectangle(20, 20)); 
>   final PDFRenderer pdfRenderer = new 
> org.apache.pdfbox.rendering.PDFRenderer(pdDocument); 
>   pdfRenderer.renderPageToGraphics(0, g2); 
>   } catch (final IOException e) { 
>   throw new RuntimeException(e); 
>   } 
>   }
>   {code}



--
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] [Commented] (PDFBOX-4583) Drawing only a portion of a PDF (Graphics.clip is ignored/overwritten)

2019-07-01 Thread Tilman Hausherr (JIRA)


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

Tilman Hausherr commented on PDFBOX-4583:
-

It works for me. However I noticed that you restore the transform. I think we 
violated some rule by not restoring this (and many other things) ourselves. So 
I changed the code to this:

{code}
final int r = 20;
final AffineTransform transform = g2.getTransform();
Stroke stroke = g2.getStroke();
Composite composite = g2.getComposite();
RenderingHints renderingHints = g2.getRenderingHints();
Color background = g2.getBackground();
Paint paint = g2.getPaint();
g2.clip(new Rectangle(r, r));
Shape clip = g2.getClip();
final PDDocument pdDocument = 
PDDocument.load(PDFBox4583Clip2.class.getResourceAsStream("/de/abm/bug/good.pdf"));
 // I did a direct loading here because I didn't set up an extra project
final PDFRenderer pdfRenderer = new 
org.apache.pdfbox.rendering.PDFRenderer(pdDocument);
pdfRenderer.renderPageToGraphics(0, g2);
g2.setTransform(transform);
g2.setStroke(stroke);
g2.setComposite(composite);
g2.setRenderingHints(renderingHints);
g2.setClip(clip);
g2.setBackground(background);
g2.setPaint(paint);
g2.setColor(Color.black);
g2.drawRect(0, 0, r-1, r-1); // -1 is important or it won't be seen
{code}


> Drawing only a portion of a PDF (Graphics.clip is ignored/overwritten)
> --
>
> Key: PDFBOX-4583
> URL: https://issues.apache.org/jira/browse/PDFBOX-4583
> Project: PDFBox
>  Issue Type: Bug
>  Components: Rendering
>Affects Versions: 2.0.15
>Reporter: Jan Buschtöns
>Assignee: Tilman Hausherr
>Priority: Major
> Fix For: 2.0.17, 3.0.0 PDFBox
>
> Attachments: clip_PDFBox_FORMGEN-2184-master.zip
>
>
> I want to use PDFBox to draw PDFs in a swing application.
> I want to draw only a portion of the PDF. As far as I know, the way to do 
> this in swing is with the "clip"-method on the Graphics object. However, no 
> matter what clip I set, the whole PDF is drawn.
> PDFRenderer calls "setClip", when it probably should use "clip". The latter 
> sets the current clip to the intersection of the old current clip and the 
> provided shape, whereas the former resets the current clip
> I've attached an example maven project, but the gist is:
> {code:java}
>   @Override 
>   public void paint(final Graphics g) { 
>  
>   final Graphics2D g2 = (Graphics2D) g; 
>   try { 
>   PDDocument pdDocument = 
> DDocument.load(App.class.getResourceAsStream("somepdf.pdf")); 
>   g2.clip(new Rectangle(20, 20)); 
>   final PDFRenderer pdfRenderer = new 
> org.apache.pdfbox.rendering.PDFRenderer(pdDocument); 
>   pdfRenderer.renderPageToGraphics(0, g2); 
>   } catch (final IOException e) { 
>   throw new RuntimeException(e); 
>   } 
>   }
>   {code}



--
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] [Commented] (PDFBOX-4583) Drawing only a portion of a PDF (Graphics.clip is ignored/overwritten)

2019-07-01 Thread JIRA


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

Jan Buschtöns commented on PDFBOX-4583:
---

No, now nothing gets drawn. Both in my original application and in the 
reproducing project I attached to this issue.

> Drawing only a portion of a PDF (Graphics.clip is ignored/overwritten)
> --
>
> Key: PDFBOX-4583
> URL: https://issues.apache.org/jira/browse/PDFBOX-4583
> Project: PDFBox
>  Issue Type: Bug
>  Components: Rendering
>Affects Versions: 2.0.15
>Reporter: Jan Buschtöns
>Assignee: Tilman Hausherr
>Priority: Major
> Fix For: 2.0.17, 3.0.0 PDFBox
>
> Attachments: clip_PDFBox_FORMGEN-2184-master.zip
>
>
> I want to use PDFBox to draw PDFs in a swing application.
> I want to draw only a portion of the PDF. As far as I know, the way to do 
> this in swing is with the "clip"-method on the Graphics object. However, no 
> matter what clip I set, the whole PDF is drawn.
> PDFRenderer calls "setClip", when it probably should use "clip". The latter 
> sets the current clip to the intersection of the old current clip and the 
> provided shape, whereas the former resets the current clip
> I've attached an example maven project, but the gist is:
> {code:java}
>   @Override 
>   public void paint(final Graphics g) { 
>  
>   final Graphics2D g2 = (Graphics2D) g; 
>   try { 
>   PDDocument pdDocument = 
> DDocument.load(App.class.getResourceAsStream("somepdf.pdf")); 
>   g2.clip(new Rectangle(20, 20)); 
>   final PDFRenderer pdfRenderer = new 
> org.apache.pdfbox.rendering.PDFRenderer(pdDocument); 
>   pdfRenderer.renderPageToGraphics(0, g2); 
>   } catch (final IOException e) { 
>   throw new RuntimeException(e); 
>   } 
>   }
>   {code}



--
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] [Commented] (PDFBOX-4583) Drawing only a portion of a PDF (Graphics.clip is ignored/overwritten)

2019-06-30 Thread Tilman Hausherr (JIRA)


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

Tilman Hausherr commented on PDFBOX-4583:
-

Snapshot is available here:

[https://repository.apache.org/content/groups/snapshots/org/apache/pdfbox/pdfbox-app/2.0.17-SNAPSHOT/]

Please give feedback whether it worked properly.

> Drawing only a portion of a PDF (Graphics.clip is ignored/overwritten)
> --
>
> Key: PDFBOX-4583
> URL: https://issues.apache.org/jira/browse/PDFBOX-4583
> Project: PDFBox
>  Issue Type: Bug
>Affects Versions: 2.0.15
>Reporter: Jan Buschtöns
>Priority: Major
> Fix For: 2.0.17, 3.0.0 PDFBox
>
> Attachments: clip_PDFBox_FORMGEN-2184-master.zip
>
>
> I want to use PDFBox to draw PDFs in a swing application.
> I want to draw only a portion of the PDF. As far as I know, the way to do 
> this in swing is with the "clip"-method on the Graphics object. However, no 
> matter what clip I set, the whole PDF is drawn.
> PDFRenderer calls "setClip", when it probably should use "clip". The latter 
> sets the current clip to the intersection of the old current clip and the 
> provided shape, whereas the former resets the current clip
> I've attached an example maven project, but the gist is:
> {code:java}
>   @Override 
>   public void paint(final Graphics g) { 
>  
>   final Graphics2D g2 = (Graphics2D) g; 
>   try { 
>   PDDocument pdDocument = 
> DDocument.load(App.class.getResourceAsStream("somepdf.pdf")); 
>   g2.clip(new Rectangle(20, 20)); 
>   final PDFRenderer pdfRenderer = new 
> org.apache.pdfbox.rendering.PDFRenderer(pdDocument); 
>   pdfRenderer.renderPageToGraphics(0, g2); 
>   } catch (final IOException e) { 
>   throw new RuntimeException(e); 
>   } 
>   }
>   {code}



--
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] [Commented] (PDFBOX-4583) Drawing only a portion of a PDF (Graphics.clip is ignored/overwritten)

2019-06-29 Thread ASF subversion and git services (JIRA)


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

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

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

PDFBOX-4583: remember and apply initial clip of a graphics device

> Drawing only a portion of a PDF (Graphics.clip is ignored/overwritten)
> --
>
> Key: PDFBOX-4583
> URL: https://issues.apache.org/jira/browse/PDFBOX-4583
> Project: PDFBox
>  Issue Type: Bug
>Affects Versions: 2.0.15
>Reporter: Jan Buschtöns
>Priority: Major
> Fix For: 2.0.17, 3.0.0 PDFBox
>
> Attachments: clip_PDFBox_FORMGEN-2184-master.zip
>
>
> I want to use PDFBox to draw PDFs in a swing application.
> I want to draw only a portion of the PDF. As far as I know, the way to do 
> this in swing is with the "clip"-method on the Graphics object. However, no 
> matter what clip I set, the whole PDF is drawn.
> PDFRenderer calls "setClip", when it probably should use "clip". The latter 
> sets the current clip to the intersection of the old current clip and the 
> provided shape, whereas the former resets the current clip
> I've attached an example maven project, but the gist is:
> {code:java}
>   @Override 
>   public void paint(final Graphics g) { 
>  
>   final Graphics2D g2 = (Graphics2D) g; 
>   try { 
>   PDDocument pdDocument = 
> DDocument.load(App.class.getResourceAsStream("somepdf.pdf")); 
>   g2.clip(new Rectangle(20, 20)); 
>   final PDFRenderer pdfRenderer = new 
> org.apache.pdfbox.rendering.PDFRenderer(pdDocument); 
>   pdfRenderer.renderPageToGraphics(0, g2); 
>   } catch (final IOException e) { 
>   throw new RuntimeException(e); 
>   } 
>   }
>   {code}



--
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] [Commented] (PDFBOX-4583) Drawing only a portion of a PDF (Graphics.clip is ignored/overwritten)

2019-06-29 Thread ASF subversion and git services (JIRA)


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

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

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

PDFBOX-4583: remember and apply initial clip of a graphics device

> Drawing only a portion of a PDF (Graphics.clip is ignored/overwritten)
> --
>
> Key: PDFBOX-4583
> URL: https://issues.apache.org/jira/browse/PDFBOX-4583
> Project: PDFBox
>  Issue Type: Bug
>Affects Versions: 2.0.15
>Reporter: Jan Buschtöns
>Priority: Major
> Fix For: 2.0.17, 3.0.0 PDFBox
>
> Attachments: clip_PDFBox_FORMGEN-2184-master.zip
>
>
> I want to use PDFBox to draw PDFs in a swing application.
> I want to draw only a portion of the PDF. As far as I know, the way to do 
> this in swing is with the "clip"-method on the Graphics object. However, no 
> matter what clip I set, the whole PDF is drawn.
> PDFRenderer calls "setClip", when it probably should use "clip". The latter 
> sets the current clip to the intersection of the old current clip and the 
> provided shape, whereas the former resets the current clip
> I've attached an example maven project, but the gist is:
> {code:java}
>   @Override 
>   public void paint(final Graphics g) { 
>  
>   final Graphics2D g2 = (Graphics2D) g; 
>   try { 
>   PDDocument pdDocument = 
> DDocument.load(App.class.getResourceAsStream("somepdf.pdf")); 
>   g2.clip(new Rectangle(20, 20)); 
>   final PDFRenderer pdfRenderer = new 
> org.apache.pdfbox.rendering.PDFRenderer(pdDocument); 
>   pdfRenderer.renderPageToGraphics(0, g2); 
>   } catch (final IOException e) { 
>   throw new RuntimeException(e); 
>   } 
>   }
>   {code}



--
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] [Commented] (PDFBOX-4583) Drawing only a portion of a PDF (Graphics.clip is ignored/overwritten)

2019-06-29 Thread ASF subversion and git services (JIRA)


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

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

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

PDFBOX-4583: remember and apply initial clip of a graphics device

> Drawing only a portion of a PDF (Graphics.clip is ignored/overwritten)
> --
>
> Key: PDFBOX-4583
> URL: https://issues.apache.org/jira/browse/PDFBOX-4583
> Project: PDFBox
>  Issue Type: Bug
>Affects Versions: 2.0.15
>Reporter: Jan Buschtöns
>Priority: Major
> Fix For: 2.0.17, 3.0.0 PDFBox
>
> Attachments: clip_PDFBox_FORMGEN-2184-master.zip
>
>
> I want to use PDFBox to draw PDFs in a swing application.
> I want to draw only a portion of the PDF. As far as I know, the way to do 
> this in swing is with the "clip"-method on the Graphics object. However, no 
> matter what clip I set, the whole PDF is drawn.
> PDFRenderer calls "setClip", when it probably should use "clip". The latter 
> sets the current clip to the intersection of the old current clip and the 
> provided shape, whereas the former resets the current clip
> I've attached an example maven project, but the gist is:
> {code:java}
>   @Override 
>   public void paint(final Graphics g) { 
>  
>   final Graphics2D g2 = (Graphics2D) g; 
>   try { 
>   PDDocument pdDocument = 
> DDocument.load(App.class.getResourceAsStream("somepdf.pdf")); 
>   g2.clip(new Rectangle(20, 20)); 
>   final PDFRenderer pdfRenderer = new 
> org.apache.pdfbox.rendering.PDFRenderer(pdDocument); 
>   pdfRenderer.renderPageToGraphics(0, g2); 
>   } catch (final IOException e) { 
>   throw new RuntimeException(e); 
>   } 
>   }
>   {code}



--
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] [Commented] (PDFBOX-4583) Drawing only a portion of a PDF (Graphics.clip is ignored/overwritten)

2019-06-29 Thread ASF subversion and git services (JIRA)


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

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

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

PDFBOX-4583: remember and apply initial clip of a graphics device

> Drawing only a portion of a PDF (Graphics.clip is ignored/overwritten)
> --
>
> Key: PDFBOX-4583
> URL: https://issues.apache.org/jira/browse/PDFBOX-4583
> Project: PDFBox
>  Issue Type: Bug
>Affects Versions: 2.0.15
>Reporter: Jan Buschtöns
>Priority: Major
> Fix For: 2.0.17, 3.0.0 PDFBox
>
> Attachments: clip_PDFBox_FORMGEN-2184-master.zip
>
>
> I want to use PDFBox to draw PDFs in a swing application.
> I want to draw only a portion of the PDF. As far as I know, the way to do 
> this in swing is with the "clip"-method on the Graphics object. However, no 
> matter what clip I set, the whole PDF is drawn.
> PDFRenderer calls "setClip", when it probably should use "clip". The latter 
> sets the current clip to the intersection of the old current clip and the 
> provided shape, whereas the former resets the current clip
> I've attached an example maven project, but the gist is:
> {code:java}
>   @Override 
>   public void paint(final Graphics g) { 
>  
>   final Graphics2D g2 = (Graphics2D) g; 
>   try { 
>   PDDocument pdDocument = 
> DDocument.load(App.class.getResourceAsStream("somepdf.pdf")); 
>   g2.clip(new Rectangle(20, 20)); 
>   final PDFRenderer pdfRenderer = new 
> org.apache.pdfbox.rendering.PDFRenderer(pdDocument); 
>   pdfRenderer.renderPageToGraphics(0, g2); 
>   } catch (final IOException e) { 
>   throw new RuntimeException(e); 
>   } 
>   }
>   {code}



--
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] [Commented] (PDFBOX-4583) Drawing only a portion of a PDF (Graphics.clip is ignored/overwritten)

2019-06-27 Thread Tilman Hausherr (JIRA)


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

Tilman Hausherr commented on PDFBOX-4583:
-

It turns out that it is more tricky than I thought. Just applying the clip 
isn't enough, because the current transform changes all the time. So the 
initial clip has to be transformed as well. And the initial clip has to be 
saved / restored when we temporarily replace the graphics object (for 
transparencies or patterns). I'll try to do that this WE.

> Drawing only a portion of a PDF (Graphics.clip is ignored/overwritten)
> --
>
> Key: PDFBOX-4583
> URL: https://issues.apache.org/jira/browse/PDFBOX-4583
> Project: PDFBox
>  Issue Type: Bug
>Reporter: Jan Buschtöns
>Priority: Major
> Attachments: clip_PDFBox_FORMGEN-2184-master.zip
>
>
> I want to use PDFBox to draw PDFs in a swing application.
> I want to draw only a portion of the PDF. As far as I know, the way to do 
> this in swing is with the "clip"-method on the Graphics object. However, no 
> matter what clip I set, the whole PDF is drawn.
> PDFRenderer calls "setClip", when it probably should use "clip". The latter 
> sets the current clip to the intersection of the old current clip and the 
> provided shape, whereas the former resets the current clip
> I've attached an example maven project, but the gist is:
> {code:java}
>   @Override 
>   public void paint(final Graphics g) { 
>  
>   final Graphics2D g2 = (Graphics2D) g; 
>   try { 
>   PDDocument pdDocument = 
> DDocument.load(App.class.getResourceAsStream("somepdf.pdf")); 
>   g2.clip(new Rectangle(20, 20)); 
>   final PDFRenderer pdfRenderer = new 
> org.apache.pdfbox.rendering.PDFRenderer(pdDocument); 
>   pdfRenderer.renderPageToGraphics(0, g2); 
>   } catch (final IOException e) { 
>   throw new RuntimeException(e); 
>   } 
>   }
>   {code}



--
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