[jira] [Commented] (PDFBOX-2852) Improve code quality (2)
[ https://issues.apache.org/jira/browse/PDFBOX-2852?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16323647#comment-16323647 ] ASF subversion and git services commented on PDFBOX-2852: - Commit 1820950 from [~tilman] in branch 'pdfbox/trunk' [ https://svn.apache.org/r1820950 ] PDFBOX-2852: add inspiration source > Improve code quality (2) > > > Key: PDFBOX-2852 > URL: https://issues.apache.org/jira/browse/PDFBOX-2852 > Project: PDFBox > Issue Type: Task >Affects Versions: 2.0.0 >Reporter: Tilman Hausherr > Attachments: PDNameTreeNode.java.patch, StringBuffer.patch, > XMPSchema.java.patch, explicit_array_creation.patch, fix_javadoc.patch, > foreach.patch, foreach2.patch, generic_type_arguments.patch, noarray.patch, > semicolon.patch, stringbuilder.patch, unnecessary_type_casting.patch, > unused_imports.patch, usestatic.patch, winansiencoding.patch, > winansiencoding2.patch > > > 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-2576, which was getting too long. -- This message was sent by Atlassian JIRA (v6.4.14#64029) - To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org
[jira] [Commented] (PDFBOX-3198) Visible Signature N2 layer
[ https://issues.apache.org/jira/browse/PDFBOX-3198?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16323648#comment-16323648 ] Tilman Hausherr commented on PDFBOX-3198: - My question was related to stackoverflow, I was wondering what answer had helped you. Was it this one? https://stackoverflow.com/questions/34012293/pdfbox-sign-landscape-file-error That one inspired me for the code in {{PDVisibleSignDesigner.adjustForRotation()}}. > Visible Signature N2 layer > -- > > Key: PDFBOX-3198 > URL: https://issues.apache.org/jira/browse/PDFBOX-3198 > Project: PDFBox > Issue Type: New Feature > Components: Signing >Affects Versions: 1.8.11 >Reporter: Frank Cornelis >Priority: Minor > Fix For: 2.0.9, 3.0.0 PDFBox > > Attachments: CreateVisibleSignature2.java, > CreateVisibleSignature2.java, CreateVisibleSignature2.java, > PDFBOX-3198-visible-signature.zip, PDFBOX-3198-work-5.5.2017.zip, > PDFBOX-3917_signed.pdf, helloworld_signed.pdf, pdfbox-n2-2.patch, signed.pdf > > > The patch adds N2 layer support to visible signatures. -- This message was sent by Atlassian JIRA (v6.4.14#64029) - To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org
[jira] [Commented] (PDFBOX-2852) Improve code quality (2)
[ https://issues.apache.org/jira/browse/PDFBOX-2852?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16323651#comment-16323651 ] ASF subversion and git services commented on PDFBOX-2852: - Commit 1820951 from [~tilman] in branch 'pdfbox/branches/2.0' [ https://svn.apache.org/r1820951 ] PDFBOX-2852: add inspiration source > Improve code quality (2) > > > Key: PDFBOX-2852 > URL: https://issues.apache.org/jira/browse/PDFBOX-2852 > Project: PDFBox > Issue Type: Task >Affects Versions: 2.0.0 >Reporter: Tilman Hausherr > Attachments: PDNameTreeNode.java.patch, StringBuffer.patch, > XMPSchema.java.patch, explicit_array_creation.patch, fix_javadoc.patch, > foreach.patch, foreach2.patch, generic_type_arguments.patch, noarray.patch, > semicolon.patch, stringbuilder.patch, unnecessary_type_casting.patch, > unused_imports.patch, usestatic.patch, winansiencoding.patch, > winansiencoding2.patch > > > 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-2576, which was getting too long. -- This message was sent by Atlassian JIRA (v6.4.14#64029) - To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org
[jira] [Issue Comment Deleted] (PDFBOX-3353) Create appearance streams for annotations
[ https://issues.apache.org/jira/browse/PDFBOX-3353?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Tilman Hausherr updated PDFBOX-3353: Comment: was deleted (was: So what you're really asking is how to place annotations in a similar way if the page is rotated. I had such a problem with signatures, {{PDVisibleSignDesigner.adjustForRotation()}} does this (PDFBOX-3671). However I don't know if this can easily be used for you because the code is not "general" enough. So I did it again (the trick is to move the cursor on the PDFDebugger rendering and see the status line coordinates changing), because the existing visual signature code is too complex, see recent code in PDFBOX-3198. The new code is simpler but didn't support rotated pages, and I will soon add some that does. If you wan to run that code, you need to use the keystore that is in "examples\src\test\resources\org\apache\pdfbox\examples\signature". You also need a small image.) > Create appearance streams for annotations > - > > Key: PDFBOX-3353 > URL: https://issues.apache.org/jira/browse/PDFBOX-3353 > Project: PDFBox > Issue Type: Task > Components: PDModel, Rendering >Affects Versions: 1.8.12, 2.0.0, 2.0.1, 2.0.2, 3.0.0 PDFBox >Reporter: Tilman Hausherr > Labels: Annotations > Attachments: 270_hl.png, 270_st.png, 270_ul.png, > PDFBOX-3353-highlight-noAP-001796-p1.pdf, PDFBOX-3353-highlight-noAP.pdf, > ShowAnnotation-4.java, SquareAnnotations.pdf, > line_dimension_appearance_stream-noAP.pdf, > line_dimension_appearance_stream.pdf, showAnnotation.java, > text_markup_ap_test.pdf > > > Create appearance streams for annotations when missing. > I'll start by replacing current code for Ink and Link annotations. > Good example PDFs: > http://www.pdfill.com/example/pdf_commenting_new.pdf > https://github.com/mozilla/pdf.js/issues/6810 -- This message was sent by Atlassian JIRA (v6.4.14#64029) - To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org
[jira] [Issue Comment Deleted] (PDFBOX-3353) Create appearance streams for annotations
[ https://issues.apache.org/jira/browse/PDFBOX-3353?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Tilman Hausherr updated PDFBOX-3353: Comment: was deleted (was: Yes the postings are probably off-topic... My suggestion is this: - [~chitgoks] looks at the code I created in the signature issue (PDFBOX-3198) and decides whether it is helpful or not - if the discussion from 2018 until now is off-topic (i.e. if [~chitgoks] thinks "yes this new code is helpful!"), then lets all delete our 2018 postings here - and yes, maybe we should create a completely new issue, to create some code (maybe just example for now) to create annotations that are independant from the page rotation. ) > Create appearance streams for annotations > - > > Key: PDFBOX-3353 > URL: https://issues.apache.org/jira/browse/PDFBOX-3353 > Project: PDFBox > Issue Type: Task > Components: PDModel, Rendering >Affects Versions: 1.8.12, 2.0.0, 2.0.1, 2.0.2, 3.0.0 PDFBox >Reporter: Tilman Hausherr > Labels: Annotations > Attachments: 270_hl.png, 270_st.png, 270_ul.png, > PDFBOX-3353-highlight-noAP-001796-p1.pdf, PDFBOX-3353-highlight-noAP.pdf, > ShowAnnotation-4.java, SquareAnnotations.pdf, > line_dimension_appearance_stream-noAP.pdf, > line_dimension_appearance_stream.pdf, showAnnotation.java, > text_markup_ap_test.pdf > > > Create appearance streams for annotations when missing. > I'll start by replacing current code for Ink and Link annotations. > Good example PDFs: > http://www.pdfill.com/example/pdf_commenting_new.pdf > https://github.com/mozilla/pdf.js/issues/6810 -- This message was sent by Atlassian JIRA (v6.4.14#64029) - To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org
[jira] [Issue Comment Deleted] (PDFBOX-3353) Create appearance streams for annotations
[ https://issues.apache.org/jira/browse/PDFBOX-3353?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Tilman Hausherr updated PDFBOX-3353: Comment: was deleted (was: Here the same without /AP entries. The rendering with PDFBox (with the uncommitted code) is the same than with Adobe Reader. The annotations that are missing are those that haven't been implemented.) > Create appearance streams for annotations > - > > Key: PDFBOX-3353 > URL: https://issues.apache.org/jira/browse/PDFBOX-3353 > Project: PDFBox > Issue Type: Task > Components: PDModel, Rendering >Affects Versions: 1.8.12, 2.0.0, 2.0.1, 2.0.2, 3.0.0 PDFBox >Reporter: Tilman Hausherr > Labels: Annotations > Attachments: 270_hl.png, 270_st.png, 270_ul.png, > PDFBOX-3353-highlight-noAP-001796-p1.pdf, PDFBOX-3353-highlight-noAP.pdf, > ShowAnnotation-4.java, SquareAnnotations.pdf, > line_dimension_appearance_stream-noAP.pdf, > line_dimension_appearance_stream.pdf, showAnnotation.java, > text_markup_ap_test.pdf > > > Create appearance streams for annotations when missing. > I'll start by replacing current code for Ink and Link annotations. > Good example PDFs: > http://www.pdfill.com/example/pdf_commenting_new.pdf > https://github.com/mozilla/pdf.js/issues/6810 -- This message was sent by Atlassian JIRA (v6.4.14#64029) - To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org
[jira] [Issue Comment Deleted] (PDFBOX-3353) Create appearance streams for annotations
[ https://issues.apache.org/jira/browse/PDFBOX-3353?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Tilman Hausherr updated PDFBOX-3353: Comment: was deleted (was: IIRC we already have square and circle in the trunk code. Some other are in the code attached to this issue. Of course any new code is welcome. I don't know of any problems with rendering landscape or rotated pages (except if the NoRotate flag is set). If you have files that are not rendering correctly by the code here, please attach them.) > Create appearance streams for annotations > - > > Key: PDFBOX-3353 > URL: https://issues.apache.org/jira/browse/PDFBOX-3353 > Project: PDFBox > Issue Type: Task > Components: PDModel, Rendering >Affects Versions: 1.8.12, 2.0.0, 2.0.1, 2.0.2, 3.0.0 PDFBox >Reporter: Tilman Hausherr > Labels: Annotations > Attachments: 270_hl.png, 270_st.png, 270_ul.png, > PDFBOX-3353-highlight-noAP-001796-p1.pdf, PDFBOX-3353-highlight-noAP.pdf, > ShowAnnotation-4.java, SquareAnnotations.pdf, > line_dimension_appearance_stream-noAP.pdf, > line_dimension_appearance_stream.pdf, showAnnotation.java, > text_markup_ap_test.pdf > > > Create appearance streams for annotations when missing. > I'll start by replacing current code for Ink and Link annotations. > Good example PDFs: > http://www.pdfill.com/example/pdf_commenting_new.pdf > https://github.com/mozilla/pdf.js/issues/6810 -- This message was sent by Atlassian JIRA (v6.4.14#64029) - To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org
[jira] [Issue Comment Deleted] (PDFBOX-3353) Create appearance streams for annotations
[ https://issues.apache.org/jira/browse/PDFBOX-3353?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Tilman Hausherr updated PDFBOX-3353: Comment: was deleted (was: I still don't understand the image. A PDF file would be more helpful.) > Create appearance streams for annotations > - > > Key: PDFBOX-3353 > URL: https://issues.apache.org/jira/browse/PDFBOX-3353 > Project: PDFBox > Issue Type: Task > Components: PDModel, Rendering >Affects Versions: 1.8.12, 2.0.0, 2.0.1, 2.0.2, 3.0.0 PDFBox >Reporter: Tilman Hausherr > Labels: Annotations > Attachments: 270_hl.png, 270_st.png, 270_ul.png, > PDFBOX-3353-highlight-noAP-001796-p1.pdf, PDFBOX-3353-highlight-noAP.pdf, > ShowAnnotation-4.java, SquareAnnotations.pdf, > line_dimension_appearance_stream-noAP.pdf, > line_dimension_appearance_stream.pdf, showAnnotation.java, > text_markup_ap_test.pdf > > > Create appearance streams for annotations when missing. > I'll start by replacing current code for Ink and Link annotations. > Good example PDFs: > http://www.pdfill.com/example/pdf_commenting_new.pdf > https://github.com/mozilla/pdf.js/issues/6810 -- This message was sent by Atlassian JIRA (v6.4.14#64029) - To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org
[jira] [Issue Comment Deleted] (PDFBOX-3353) Create appearance streams for annotations
[ https://issues.apache.org/jira/browse/PDFBOX-3353?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Tilman Hausherr updated PDFBOX-3353: Comment: was deleted (was: The image is so small that one can't understand anything from it. What was expected? To know whether the rendering is wrong - get a PDF with 270 rotation. Create an annotation with Adobe Reader. Remove the appearance stream with an editor. Then display it with Adobe Reader and PDFBox and see whether there are differences or not.) > Create appearance streams for annotations > - > > Key: PDFBOX-3353 > URL: https://issues.apache.org/jira/browse/PDFBOX-3353 > Project: PDFBox > Issue Type: Task > Components: PDModel, Rendering >Affects Versions: 1.8.12, 2.0.0, 2.0.1, 2.0.2, 3.0.0 PDFBox >Reporter: Tilman Hausherr > Labels: Annotations > Attachments: 270_hl.png, 270_st.png, 270_ul.png, > PDFBOX-3353-highlight-noAP-001796-p1.pdf, PDFBOX-3353-highlight-noAP.pdf, > ShowAnnotation-4.java, SquareAnnotations.pdf, > line_dimension_appearance_stream-noAP.pdf, > line_dimension_appearance_stream.pdf, showAnnotation.java, > text_markup_ap_test.pdf > > > Create appearance streams for annotations when missing. > I'll start by replacing current code for Ink and Link annotations. > Good example PDFs: > http://www.pdfill.com/example/pdf_commenting_new.pdf > https://github.com/mozilla/pdf.js/issues/6810 -- This message was sent by Atlassian JIRA (v6.4.14#64029) - To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org
[jira] [Updated] (PDFBOX-3353) Create appearance streams for annotations
[ https://issues.apache.org/jira/browse/PDFBOX-3353?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Tilman Hausherr updated PDFBOX-3353: Attachment: (was: result-NoAP.pdf) > Create appearance streams for annotations > - > > Key: PDFBOX-3353 > URL: https://issues.apache.org/jira/browse/PDFBOX-3353 > Project: PDFBox > Issue Type: Task > Components: PDModel, Rendering >Affects Versions: 1.8.12, 2.0.0, 2.0.1, 2.0.2, 3.0.0 PDFBox >Reporter: Tilman Hausherr > Labels: Annotations > Attachments: 270_hl.png, 270_st.png, 270_ul.png, > PDFBOX-3353-highlight-noAP-001796-p1.pdf, PDFBOX-3353-highlight-noAP.pdf, > ShowAnnotation-4.java, SquareAnnotations.pdf, > line_dimension_appearance_stream-noAP.pdf, > line_dimension_appearance_stream.pdf, showAnnotation.java, > text_markup_ap_test.pdf > > > Create appearance streams for annotations when missing. > I'll start by replacing current code for Ink and Link annotations. > Good example PDFs: > http://www.pdfill.com/example/pdf_commenting_new.pdf > https://github.com/mozilla/pdf.js/issues/6810 -- This message was sent by Atlassian JIRA (v6.4.14#64029) - To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org
[jira] [Comment Edited] (PDFBOX-3353) Create appearance streams for annotations
[ https://issues.apache.org/jira/browse/PDFBOX-3353?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16323593#comment-16323593 ] chitgoks edited comment on PDFBOX-3353 at 1/12/18 6:17 AM: --- hi all. i deleted my comments and unnecessary uploaded files. apologies. for the the recalculation of the coordinates, that was the solution as nothing in the appearance stream code needs to be modified except for free text. -the rectangle is recalculated but when the appearance stream text is drawn, it is pointing upwards. this is for 270 degrees. what i did was in the content stream, rotate the matrix in order for the text to be drawn correctly. cs.transform(Matrix.getRotateInstance(Math.toRadians(rotation), 0, 0)); cs.transform(Matrix.getTranslateInstance(-bbox.getHeight(), 0)); then text position is cs.newLineAtOffset(0, annotation.getRectangle().getHeight()); [~tilman] for text markup, highlight underline and strike-through, the appearance stream code does not draw correctly at 270 degrees page rotation. my quad rectangles are correct since the outline when selected in acrobat shows correctly. it's the highlight fill and underline/strike through not drawn right. the code especially for highlight are raw commands so i have no clue what they mean. was (Author: chitgoks): hi all. i deleted my comments and unnecessary uploaded files. apologies. for the the recalculation of the coordinates, that was the solution as nothing in the appearance stream code needs to be modified except for free text. -the rectangle is recalculated but when the appearance stream text is drawn, it is pointing upwards. this is for 270 degrees. what i did was in the content stream, rotate the matrix in order for the text to be drawn correctly. cs.transform(Matrix.getRotateInstance(Math.toRadians(rotation), 0, 0)); cs.transform(Matrix.getTranslateInstance(-bbox.getHeight(), 0)); then text position is cs.newLineAtOffset(0, annotation.getRectangle().getHeight()); [~tilman] for text markup, highlight underline and strike-through, the appearance stream code does not draw correctly at 270 degrees page rotation. my quad rectangles are correct since the outline when selected in acrobat shows correctly. it's the highlight fill and underline/strike through not drawn right. the code is especially for highlight are raw commands so i have no clue what they mean. > Create appearance streams for annotations > - > > Key: PDFBOX-3353 > URL: https://issues.apache.org/jira/browse/PDFBOX-3353 > Project: PDFBox > Issue Type: Task > Components: PDModel, Rendering >Affects Versions: 1.8.12, 2.0.0, 2.0.1, 2.0.2, 3.0.0 PDFBox >Reporter: Tilman Hausherr > Labels: Annotations > Attachments: 270_hl.png, 270_st.png, 270_ul.png, > PDFBOX-3353-highlight-noAP-001796-p1.pdf, PDFBOX-3353-highlight-noAP.pdf, > ShowAnnotation-4.java, SquareAnnotations.pdf, > line_dimension_appearance_stream-noAP.pdf, > line_dimension_appearance_stream.pdf, result-NoAP.pdf, showAnnotation.java, > text_markup_ap_test.pdf > > > Create appearance streams for annotations when missing. > I'll start by replacing current code for Ink and Link annotations. > Good example PDFs: > http://www.pdfill.com/example/pdf_commenting_new.pdf > https://github.com/mozilla/pdf.js/issues/6810 -- This message was sent by Atlassian JIRA (v6.4.14#64029) - To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org
[jira] [Updated] (PDFBOX-3353) Create appearance streams for annotations
[ https://issues.apache.org/jira/browse/PDFBOX-3353?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] chitgoks updated PDFBOX-3353: - Attachment: 270_hl.png 270_st.png 270_ul.png 270_ul.png - underline textmarkup 270_st.png - strike through textmarkup 270_hl.png - highlight textmarkup this is under a 270 degree page rotation and i used the same code in your appearance stream in showannotations-2.java > Create appearance streams for annotations > - > > Key: PDFBOX-3353 > URL: https://issues.apache.org/jira/browse/PDFBOX-3353 > Project: PDFBox > Issue Type: Task > Components: PDModel, Rendering >Affects Versions: 1.8.12, 2.0.0, 2.0.1, 2.0.2, 3.0.0 PDFBox >Reporter: Tilman Hausherr > Labels: Annotations > Attachments: 270_hl.png, 270_st.png, 270_ul.png, > PDFBOX-3353-highlight-noAP-001796-p1.pdf, PDFBOX-3353-highlight-noAP.pdf, > ShowAnnotation-4.java, SquareAnnotations.pdf, > line_dimension_appearance_stream-noAP.pdf, > line_dimension_appearance_stream.pdf, result-NoAP.pdf, showAnnotation.java, > text_markup_ap_test.pdf > > > Create appearance streams for annotations when missing. > I'll start by replacing current code for Ink and Link annotations. > Good example PDFs: > http://www.pdfill.com/example/pdf_commenting_new.pdf > https://github.com/mozilla/pdf.js/issues/6810 -- This message was sent by Atlassian JIRA (v6.4.14#64029) - To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org
[jira] [Updated] (PDFBOX-3353) Create appearance streams for annotations
[ https://issues.apache.org/jira/browse/PDFBOX-3353?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] chitgoks updated PDFBOX-3353: - Attachment: (was: result_layout.png) > Create appearance streams for annotations > - > > Key: PDFBOX-3353 > URL: https://issues.apache.org/jira/browse/PDFBOX-3353 > Project: PDFBox > Issue Type: Task > Components: PDModel, Rendering >Affects Versions: 1.8.12, 2.0.0, 2.0.1, 2.0.2, 3.0.0 PDFBox >Reporter: Tilman Hausherr > Labels: Annotations > Attachments: PDFBOX-3353-highlight-noAP-001796-p1.pdf, > PDFBOX-3353-highlight-noAP.pdf, ShowAnnotation-4.java, SquareAnnotations.pdf, > line_dimension_appearance_stream-noAP.pdf, > line_dimension_appearance_stream.pdf, result-NoAP.pdf, showAnnotation.java, > text_markup_ap_test.pdf > > > Create appearance streams for annotations when missing. > I'll start by replacing current code for Ink and Link annotations. > Good example PDFs: > http://www.pdfill.com/example/pdf_commenting_new.pdf > https://github.com/mozilla/pdf.js/issues/6810 -- This message was sent by Atlassian JIRA (v6.4.14#64029) - To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org
[jira] [Updated] (PDFBOX-3353) Create appearance streams for annotations
[ https://issues.apache.org/jira/browse/PDFBOX-3353?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] chitgoks updated PDFBOX-3353: - Attachment: (was: result.pdf) > Create appearance streams for annotations > - > > Key: PDFBOX-3353 > URL: https://issues.apache.org/jira/browse/PDFBOX-3353 > Project: PDFBox > Issue Type: Task > Components: PDModel, Rendering >Affects Versions: 1.8.12, 2.0.0, 2.0.1, 2.0.2, 3.0.0 PDFBox >Reporter: Tilman Hausherr > Labels: Annotations > Attachments: PDFBOX-3353-highlight-noAP-001796-p1.pdf, > PDFBOX-3353-highlight-noAP.pdf, ShowAnnotation-4.java, SquareAnnotations.pdf, > line_dimension_appearance_stream-noAP.pdf, > line_dimension_appearance_stream.pdf, result-NoAP.pdf, showAnnotation.java, > text_markup_ap_test.pdf > > > Create appearance streams for annotations when missing. > I'll start by replacing current code for Ink and Link annotations. > Good example PDFs: > http://www.pdfill.com/example/pdf_commenting_new.pdf > https://github.com/mozilla/pdf.js/issues/6810 -- This message was sent by Atlassian JIRA (v6.4.14#64029) - To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org
[jira] [Commented] (PDFBOX-3353) Create appearance streams for annotations
[ https://issues.apache.org/jira/browse/PDFBOX-3353?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16323593#comment-16323593 ] chitgoks commented on PDFBOX-3353: -- hi all. i deleted my comments and unnecessary uploaded files. apologies. for the the recalculation of the coordinates, that was the solution as nothing in the appearance stream code needs to be modified except for free text. -the rectangle is recalculated but when the appearance stream text is drawn, it is pointing upwards. this is for 270 degrees. what i did was in the content stream, rotate the matrix in order for the text to be drawn correctly. cs.transform(Matrix.getRotateInstance(Math.toRadians(rotation), 0, 0)); cs.transform(Matrix.getTranslateInstance(-bbox.getHeight(), 0)); then text position is cs.newLineAtOffset(0, annotation.getRectangle().getHeight()); [~tilman] for text markup, highlight underline and strike-through, the appearance stream code does not draw correctly at 270 degrees page rotation. my quad rectangles are correct since the outline when selected in acrobat shows correctly. it's the highlight fill and underline/strike through not drawn right. the code is especially for highlight are raw commands so i have no clue what they mean. > Create appearance streams for annotations > - > > Key: PDFBOX-3353 > URL: https://issues.apache.org/jira/browse/PDFBOX-3353 > Project: PDFBox > Issue Type: Task > Components: PDModel, Rendering >Affects Versions: 1.8.12, 2.0.0, 2.0.1, 2.0.2, 3.0.0 PDFBox >Reporter: Tilman Hausherr > Labels: Annotations > Attachments: PDFBOX-3353-highlight-noAP-001796-p1.pdf, > PDFBOX-3353-highlight-noAP.pdf, ShowAnnotation-4.java, SquareAnnotations.pdf, > line_dimension_appearance_stream-noAP.pdf, > line_dimension_appearance_stream.pdf, result-NoAP.pdf, result.pdf, > result_layout.png, showAnnotation.java, text_markup_ap_test.pdf > > > Create appearance streams for annotations when missing. > I'll start by replacing current code for Ink and Link annotations. > Good example PDFs: > http://www.pdfill.com/example/pdf_commenting_new.pdf > https://github.com/mozilla/pdf.js/issues/6810 -- This message was sent by Atlassian JIRA (v6.4.14#64029) - To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org
[jira] [Issue Comment Deleted] (PDFBOX-3353) Create appearance streams for annotations
[ https://issues.apache.org/jira/browse/PDFBOX-3353?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] chitgoks updated PDFBOX-3353: - Comment: was deleted (was: i went over the code to check if there are some appearance streams if in landscape i can contribute with a few. already got box,circle and free text working. pdfAppearance can be confusing. currently working out on drawing line and arrow in landscape 270 degrees.) > Create appearance streams for annotations > - > > Key: PDFBOX-3353 > URL: https://issues.apache.org/jira/browse/PDFBOX-3353 > Project: PDFBox > Issue Type: Task > Components: PDModel, Rendering >Affects Versions: 1.8.12, 2.0.0, 2.0.1, 2.0.2, 3.0.0 PDFBox >Reporter: Tilman Hausherr > Labels: Annotations > Attachments: PDFBOX-3353-highlight-noAP-001796-p1.pdf, > PDFBOX-3353-highlight-noAP.pdf, ShowAnnotation-4.java, SquareAnnotations.pdf, > line_dimension_appearance_stream-noAP.pdf, > line_dimension_appearance_stream.pdf, result-NoAP.pdf, result.pdf, > result_layout.png, showAnnotation.java, text_markup_ap_test.pdf > > > Create appearance streams for annotations when missing. > I'll start by replacing current code for Ink and Link annotations. > Good example PDFs: > http://www.pdfill.com/example/pdf_commenting_new.pdf > https://github.com/mozilla/pdf.js/issues/6810 -- This message was sent by Atlassian JIRA (v6.4.14#64029) - To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org
[jira] [Issue Comment Deleted] (PDFBOX-3353) Create appearance streams for annotations
[ https://issues.apache.org/jira/browse/PDFBOX-3353?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] chitgoks updated PDFBOX-3353: - Comment: was deleted (was: This is the result of the landscape page being 270 degrees. the annotations do not get rotated as well. please see result.pdf my coordinates are based in a real landscape bounding box. but pdf displays differently returning a portrait mediabox with rotation value 270. i used a landscape mediabox to place the annotations but this is the result. could it be possible to unrotate the pdf page then rotate it? so the annotations would also get rorated?) > Create appearance streams for annotations > - > > Key: PDFBOX-3353 > URL: https://issues.apache.org/jira/browse/PDFBOX-3353 > Project: PDFBox > Issue Type: Task > Components: PDModel, Rendering >Affects Versions: 1.8.12, 2.0.0, 2.0.1, 2.0.2, 3.0.0 PDFBox >Reporter: Tilman Hausherr > Labels: Annotations > Attachments: PDFBOX-3353-highlight-noAP-001796-p1.pdf, > PDFBOX-3353-highlight-noAP.pdf, ShowAnnotation-4.java, SquareAnnotations.pdf, > line_dimension_appearance_stream-noAP.pdf, > line_dimension_appearance_stream.pdf, result-NoAP.pdf, result.pdf, > result_layout.png, showAnnotation.java, text_markup_ap_test.pdf > > > Create appearance streams for annotations when missing. > I'll start by replacing current code for Ink and Link annotations. > Good example PDFs: > http://www.pdfill.com/example/pdf_commenting_new.pdf > https://github.com/mozilla/pdf.js/issues/6810 -- This message was sent by Atlassian JIRA (v6.4.14#64029) - To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org
[jira] [Issue Comment Deleted] (PDFBOX-3353) Create appearance streams for annotations
[ https://issues.apache.org/jira/browse/PDFBOX-3353?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] chitgoks updated PDFBOX-3353: - Comment: was deleted (was: Hi tilman, the annotations i create do not have the NoRotate flag. however, in landscape 270 degrees, the placements of the annotations are positioned like the pdf page is vertical [link title|https://imgur.com/a/QY6KO] maruan's suggestion is to recalculate the coordinates. i did just that. but the problem is within the appearance drawing. i didnt have luck even if i rotated the appearance so i could draw normally using same coordinates.) > Create appearance streams for annotations > - > > Key: PDFBOX-3353 > URL: https://issues.apache.org/jira/browse/PDFBOX-3353 > Project: PDFBox > Issue Type: Task > Components: PDModel, Rendering >Affects Versions: 1.8.12, 2.0.0, 2.0.1, 2.0.2, 3.0.0 PDFBox >Reporter: Tilman Hausherr > Labels: Annotations > Attachments: PDFBOX-3353-highlight-noAP-001796-p1.pdf, > PDFBOX-3353-highlight-noAP.pdf, ShowAnnotation-4.java, SquareAnnotations.pdf, > line_dimension_appearance_stream-noAP.pdf, > line_dimension_appearance_stream.pdf, result-NoAP.pdf, result.pdf, > result_layout.png, showAnnotation.java, text_markup_ap_test.pdf > > > Create appearance streams for annotations when missing. > I'll start by replacing current code for Ink and Link annotations. > Good example PDFs: > http://www.pdfill.com/example/pdf_commenting_new.pdf > https://github.com/mozilla/pdf.js/issues/6810 -- This message was sent by Atlassian JIRA (v6.4.14#64029) - To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org
[jira] [Issue Comment Deleted] (PDFBOX-3353) Create appearance streams for annotations
[ https://issues.apache.org/jira/browse/PDFBOX-3353?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] chitgoks updated PDFBOX-3353: - Comment: was deleted (was: Hi, the horizontal pdf page is the landscape one at 270 degrees. the drawn annotations's coordinates were based on a landscape page area but since the pdf page's dimension returned is portrait with a rotation value of 270, this is the result. [link title|https://imgur.com/a/imOu6] is this some sort of container where the annotations are placed? if so, it could be possible to just rotate this. and getting the page's mediabox, i created a new PDRectangle with width and height, opposite. new PDRectangle(0, 0, pdPage.getMediaBox().getHeight(), pdPage.getMediaBox().getWidth()); instead of the default page.getMediaBox().) > Create appearance streams for annotations > - > > Key: PDFBOX-3353 > URL: https://issues.apache.org/jira/browse/PDFBOX-3353 > Project: PDFBox > Issue Type: Task > Components: PDModel, Rendering >Affects Versions: 1.8.12, 2.0.0, 2.0.1, 2.0.2, 3.0.0 PDFBox >Reporter: Tilman Hausherr > Labels: Annotations > Attachments: PDFBOX-3353-highlight-noAP-001796-p1.pdf, > PDFBOX-3353-highlight-noAP.pdf, ShowAnnotation-4.java, SquareAnnotations.pdf, > line_dimension_appearance_stream-noAP.pdf, > line_dimension_appearance_stream.pdf, result-NoAP.pdf, result.pdf, > result_layout.png, showAnnotation.java, text_markup_ap_test.pdf > > > Create appearance streams for annotations when missing. > I'll start by replacing current code for Ink and Link annotations. > Good example PDFs: > http://www.pdfill.com/example/pdf_commenting_new.pdf > https://github.com/mozilla/pdf.js/issues/6810 -- This message was sent by Atlassian JIRA (v6.4.14#64029) - To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org
[jira] [Issue Comment Deleted] (PDFBOX-3353) Create appearance streams for annotations
[ https://issues.apache.org/jira/browse/PDFBOX-3353?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] chitgoks updated PDFBOX-3353: - Comment: was deleted (was: sorry, my issue is not with appearance streams but their positioning. not sure why they didnt appear. my annotations' appearance streams are all working (except cloud annotation, no appearance stream). please see result_layout.png this is how i would want once annotations are added. just that when i add the annotations the result is the same as in result.pdf. i think i posted in the wrong thread.) > Create appearance streams for annotations > - > > Key: PDFBOX-3353 > URL: https://issues.apache.org/jira/browse/PDFBOX-3353 > Project: PDFBox > Issue Type: Task > Components: PDModel, Rendering >Affects Versions: 1.8.12, 2.0.0, 2.0.1, 2.0.2, 3.0.0 PDFBox >Reporter: Tilman Hausherr > Labels: Annotations > Attachments: PDFBOX-3353-highlight-noAP-001796-p1.pdf, > PDFBOX-3353-highlight-noAP.pdf, ShowAnnotation-4.java, SquareAnnotations.pdf, > line_dimension_appearance_stream-noAP.pdf, > line_dimension_appearance_stream.pdf, result-NoAP.pdf, result.pdf, > result_layout.png, showAnnotation.java, text_markup_ap_test.pdf > > > Create appearance streams for annotations when missing. > I'll start by replacing current code for Ink and Link annotations. > Good example PDFs: > http://www.pdfill.com/example/pdf_commenting_new.pdf > https://github.com/mozilla/pdf.js/issues/6810 -- This message was sent by Atlassian JIRA (v6.4.14#64029) - To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org
[jira] [Commented] (PDFBOX-4062) Fetch Color of Text using PDFBox
[ https://issues.apache.org/jira/browse/PDFBOX-4062?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16323511#comment-16323511 ] Vimal Kumar commented on PDFBOX-4062: - In Jira Type Section we dont have any option of "How" , can you provide a details on where should i file this then. > Fetch Color of Text using PDFBox > > > Key: PDFBOX-4062 > URL: https://issues.apache.org/jira/browse/PDFBOX-4062 > Project: PDFBox > Issue Type: Bug >Affects Versions: 2.0.0 >Reporter: Vimal Kumar >Priority: Blocker > Attachments: b1.pdf > > > I Need to Fetch the Color of Text in a PDF using pdfbox 2.0.0 , for the same > i have written java code as > {code} > import java.io.ByteArrayOutputStream; > import java.io.File; > import java.io.IOException; > import java.io.OutputStreamWriter; > import java.io.Writer; > import org.apache.pdfbox.contentstream.operator.color.SetNonStrokingColor; > import org.apache.pdfbox.contentstream.operator.color.SetNonStrokingColorN; > import > org.apache.pdfbox.contentstream.operator.color.SetNonStrokingColorSpace; > import > org.apache.pdfbox.contentstream.operator.color.SetNonStrokingDeviceCMYKColor; > import > org.apache.pdfbox.contentstream.operator.color.SetNonStrokingDeviceGrayColor; > import > org.apache.pdfbox.contentstream.operator.color.SetNonStrokingDeviceRGBColor; > import org.apache.pdfbox.contentstream.operator.color.SetStrokingColor; > import org.apache.pdfbox.contentstream.operator.color.SetStrokingColorN; > import org.apache.pdfbox.contentstream.operator.color.SetStrokingColorSpace; > import > org.apache.pdfbox.contentstream.operator.color.SetStrokingDeviceCMYKColor; > import > org.apache.pdfbox.contentstream.operator.color.SetStrokingDeviceGrayColor; > import > org.apache.pdfbox.contentstream.operator.color.SetStrokingDeviceRGBColor; > import org.apache.pdfbox.pdmodel.PDDocument; > import org.apache.pdfbox.pdmodel.graphics.color.PDColor; > import org.apache.pdfbox.pdmodel.graphics.state.RenderingMode; > import org.apache.pdfbox.text.PDFTextStripper; > import org.apache.pdfbox.text.TextPosition; > /** > * This is an example on how to get the colors of text. Note that this will > not tell the background, > * and will only work properly if the text is not overwritten later, and only > if the text rendering > * modes are 0, 1 or 2. In the PDF 32000 specification, please read 9.3.6 > "Text Rendering Mode" to > * know more. Mode 0 (FILL) is the default. Mode 1 (STROKE) will make glyphs > look "hollow". Mode 2 > * (FILL_STROKE) will make glyphs look "fat". > * > * @author Ben Litchfield > * @author Tilman Hausherr > */ > public class PDF_Box_1 extends PDFTextStripper > { > /** > * Instantiate a new PDFTextStripper object. > * > * @throws IOException If there is an error loading the properties. > */ > public PDF_Box_1() throws IOException > { > addOperator(new SetStrokingColorSpace()); > addOperator(new SetNonStrokingColorSpace()); > addOperator(new SetStrokingDeviceCMYKColor()); > addOperator(new SetNonStrokingDeviceCMYKColor()); > addOperator(new SetNonStrokingDeviceRGBColor()); > addOperator(new SetStrokingDeviceRGBColor()); > addOperator(new SetNonStrokingDeviceGrayColor()); > addOperator(new SetStrokingDeviceGrayColor()); > addOperator(new SetStrokingColor()); > addOperator(new SetStrokingColorN()); > addOperator(new SetNonStrokingColor()); > addOperator(new SetNonStrokingColorN()); > } > /** > * This will print the documents data. > * > * @param args The command line arguments. > * > * @throws IOException If there is an error parsing the document. > */ > public static void main(String[] args) throws IOException > { > > try (PDDocument document = PDDocument.load(new > File("D://Vimal//New folder//ab.pdf"))) > { > PDFTextStripper stripper = new PDF_Box_1(); > stripper.setSortByPosition(true); > stripper.setStartPage(0); > stripper.setEndPage(document.getNumberOfPages()); > stripper.getText(document); > } > > } > @Override > protected void processTextPosition(TextPosition text) > { > super.processTextPosition(text); > PDColor strokingColor = getGraphicsState().getStrokingColor(); > PDColor nonStrokingColor = getGraphicsState().getNonStrokingColor(); > String unicode = text.getUnicode(); > RenderingMode renderingMode = > getGraphicsState().getTextState().getRenderingMode(); > System.out.println("Unicode:" + unicode); > System.out.println("Rendering mode: " + renderingMode); >
[jira] [Commented] (PDFBOX-3198) Visible Signature N2 layer
[ https://issues.apache.org/jira/browse/PDFBOX-3198?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16323487#comment-16323487 ] chitgoks commented on PDFBOX-3198: -- CreateSignature2. java in createSignatureRectangle() it has code for 90 and 180 degrees too so yours is better. this worked well because i did not have to re-code my appearance stream code. only the coordinates had to be changed. this worked the same way for point based annotations. thank you very much! > Visible Signature N2 layer > -- > > Key: PDFBOX-3198 > URL: https://issues.apache.org/jira/browse/PDFBOX-3198 > Project: PDFBox > Issue Type: New Feature > Components: Signing >Affects Versions: 1.8.11 >Reporter: Frank Cornelis >Priority: Minor > Fix For: 2.0.9, 3.0.0 PDFBox > > Attachments: CreateVisibleSignature2.java, > CreateVisibleSignature2.java, CreateVisibleSignature2.java, > PDFBOX-3198-visible-signature.zip, PDFBOX-3198-work-5.5.2017.zip, > PDFBOX-3917_signed.pdf, helloworld_signed.pdf, pdfbox-n2-2.patch, signed.pdf > > > The patch adds N2 layer support to visible signatures. -- This message was sent by Atlassian JIRA (v6.4.14#64029) - To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org
[jira] [Commented] (PDFBOX-3198) Visible Signature N2 layer
[ https://issues.apache.org/jira/browse/PDFBOX-3198?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16323482#comment-16323482 ] Tilman Hausherr commented on PDFBOX-3198: - Which one? > Visible Signature N2 layer > -- > > Key: PDFBOX-3198 > URL: https://issues.apache.org/jira/browse/PDFBOX-3198 > Project: PDFBox > Issue Type: New Feature > Components: Signing >Affects Versions: 1.8.11 >Reporter: Frank Cornelis >Priority: Minor > Fix For: 2.0.9, 3.0.0 PDFBox > > Attachments: CreateVisibleSignature2.java, > CreateVisibleSignature2.java, CreateVisibleSignature2.java, > PDFBOX-3198-visible-signature.zip, PDFBOX-3198-work-5.5.2017.zip, > PDFBOX-3917_signed.pdf, helloworld_signed.pdf, pdfbox-n2-2.patch, signed.pdf > > > The patch adds N2 layer support to visible signatures. -- This message was sent by Atlassian JIRA (v6.4.14#64029) - To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org
[jira] [Commented] (PDFBOX-3198) Visible Signature N2 layer
[ https://issues.apache.org/jira/browse/PDFBOX-3198?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16323196#comment-16323196 ] chitgoks commented on PDFBOX-3198: -- hi tilman i was lucky i came across a post in stackoverflow and got it to work (took me 3 days to find the right one). but your code is better as it shows for 90 and 180 degrees. thank you very much! > Visible Signature N2 layer > -- > > Key: PDFBOX-3198 > URL: https://issues.apache.org/jira/browse/PDFBOX-3198 > Project: PDFBox > Issue Type: New Feature > Components: Signing >Affects Versions: 1.8.11 >Reporter: Frank Cornelis >Priority: Minor > Fix For: 2.0.9, 3.0.0 PDFBox > > Attachments: CreateVisibleSignature2.java, > CreateVisibleSignature2.java, CreateVisibleSignature2.java, > PDFBOX-3198-visible-signature.zip, PDFBOX-3198-work-5.5.2017.zip, > PDFBOX-3917_signed.pdf, helloworld_signed.pdf, pdfbox-n2-2.patch, signed.pdf > > > The patch adds N2 layer support to visible signatures. -- This message was sent by Atlassian JIRA (v6.4.14#64029) - To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org
[jira] [Commented] (PDFBOX-4062) Fetch Color of Text using PDFBox
[ https://issues.apache.org/jira/browse/PDFBOX-4062?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16322729#comment-16322729 ] Tilman Hausherr commented on PDFBOX-4062: - I intend to close this because I think this is a "how to" question. You selected this as a "bug". How is this a bug? > Fetch Color of Text using PDFBox > > > Key: PDFBOX-4062 > URL: https://issues.apache.org/jira/browse/PDFBOX-4062 > Project: PDFBox > Issue Type: Bug >Affects Versions: 2.0.0 >Reporter: Vimal Kumar >Priority: Blocker > Attachments: b1.pdf > > > I Need to Fetch the Color of Text in a PDF using pdfbox 2.0.0 , for the same > i have written java code as > {code} > import java.io.ByteArrayOutputStream; > import java.io.File; > import java.io.IOException; > import java.io.OutputStreamWriter; > import java.io.Writer; > import org.apache.pdfbox.contentstream.operator.color.SetNonStrokingColor; > import org.apache.pdfbox.contentstream.operator.color.SetNonStrokingColorN; > import > org.apache.pdfbox.contentstream.operator.color.SetNonStrokingColorSpace; > import > org.apache.pdfbox.contentstream.operator.color.SetNonStrokingDeviceCMYKColor; > import > org.apache.pdfbox.contentstream.operator.color.SetNonStrokingDeviceGrayColor; > import > org.apache.pdfbox.contentstream.operator.color.SetNonStrokingDeviceRGBColor; > import org.apache.pdfbox.contentstream.operator.color.SetStrokingColor; > import org.apache.pdfbox.contentstream.operator.color.SetStrokingColorN; > import org.apache.pdfbox.contentstream.operator.color.SetStrokingColorSpace; > import > org.apache.pdfbox.contentstream.operator.color.SetStrokingDeviceCMYKColor; > import > org.apache.pdfbox.contentstream.operator.color.SetStrokingDeviceGrayColor; > import > org.apache.pdfbox.contentstream.operator.color.SetStrokingDeviceRGBColor; > import org.apache.pdfbox.pdmodel.PDDocument; > import org.apache.pdfbox.pdmodel.graphics.color.PDColor; > import org.apache.pdfbox.pdmodel.graphics.state.RenderingMode; > import org.apache.pdfbox.text.PDFTextStripper; > import org.apache.pdfbox.text.TextPosition; > /** > * This is an example on how to get the colors of text. Note that this will > not tell the background, > * and will only work properly if the text is not overwritten later, and only > if the text rendering > * modes are 0, 1 or 2. In the PDF 32000 specification, please read 9.3.6 > "Text Rendering Mode" to > * know more. Mode 0 (FILL) is the default. Mode 1 (STROKE) will make glyphs > look "hollow". Mode 2 > * (FILL_STROKE) will make glyphs look "fat". > * > * @author Ben Litchfield > * @author Tilman Hausherr > */ > public class PDF_Box_1 extends PDFTextStripper > { > /** > * Instantiate a new PDFTextStripper object. > * > * @throws IOException If there is an error loading the properties. > */ > public PDF_Box_1() throws IOException > { > addOperator(new SetStrokingColorSpace()); > addOperator(new SetNonStrokingColorSpace()); > addOperator(new SetStrokingDeviceCMYKColor()); > addOperator(new SetNonStrokingDeviceCMYKColor()); > addOperator(new SetNonStrokingDeviceRGBColor()); > addOperator(new SetStrokingDeviceRGBColor()); > addOperator(new SetNonStrokingDeviceGrayColor()); > addOperator(new SetStrokingDeviceGrayColor()); > addOperator(new SetStrokingColor()); > addOperator(new SetStrokingColorN()); > addOperator(new SetNonStrokingColor()); > addOperator(new SetNonStrokingColorN()); > } > /** > * This will print the documents data. > * > * @param args The command line arguments. > * > * @throws IOException If there is an error parsing the document. > */ > public static void main(String[] args) throws IOException > { > > try (PDDocument document = PDDocument.load(new > File("D://Vimal//New folder//ab.pdf"))) > { > PDFTextStripper stripper = new PDF_Box_1(); > stripper.setSortByPosition(true); > stripper.setStartPage(0); > stripper.setEndPage(document.getNumberOfPages()); > stripper.getText(document); > } > > } > @Override > protected void processTextPosition(TextPosition text) > { > super.processTextPosition(text); > PDColor strokingColor = getGraphicsState().getStrokingColor(); > PDColor nonStrokingColor = getGraphicsState().getNonStrokingColor(); > String unicode = text.getUnicode(); > RenderingMode renderingMode = > getGraphicsState().getTextState().getRenderingMode(); > System.out.println("Unicode:" + unicode); > System.out.println("Rendering mode: " + renderingMode); >
[jira] [Updated] (PDFBOX-4062) Fetch Color of Text using PDFBox
[ https://issues.apache.org/jira/browse/PDFBOX-4062?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Tilman Hausherr updated PDFBOX-4062: Description: I Need to Fetch the Color of Text in a PDF using pdfbox 2.0.0 , for the same i have written java code as {code} import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException; import java.io.OutputStreamWriter; import java.io.Writer; import org.apache.pdfbox.contentstream.operator.color.SetNonStrokingColor; import org.apache.pdfbox.contentstream.operator.color.SetNonStrokingColorN; import org.apache.pdfbox.contentstream.operator.color.SetNonStrokingColorSpace; import org.apache.pdfbox.contentstream.operator.color.SetNonStrokingDeviceCMYKColor; import org.apache.pdfbox.contentstream.operator.color.SetNonStrokingDeviceGrayColor; import org.apache.pdfbox.contentstream.operator.color.SetNonStrokingDeviceRGBColor; import org.apache.pdfbox.contentstream.operator.color.SetStrokingColor; import org.apache.pdfbox.contentstream.operator.color.SetStrokingColorN; import org.apache.pdfbox.contentstream.operator.color.SetStrokingColorSpace; import org.apache.pdfbox.contentstream.operator.color.SetStrokingDeviceCMYKColor; import org.apache.pdfbox.contentstream.operator.color.SetStrokingDeviceGrayColor; import org.apache.pdfbox.contentstream.operator.color.SetStrokingDeviceRGBColor; import org.apache.pdfbox.pdmodel.PDDocument; import org.apache.pdfbox.pdmodel.graphics.color.PDColor; import org.apache.pdfbox.pdmodel.graphics.state.RenderingMode; import org.apache.pdfbox.text.PDFTextStripper; import org.apache.pdfbox.text.TextPosition; /** * This is an example on how to get the colors of text. Note that this will not tell the background, * and will only work properly if the text is not overwritten later, and only if the text rendering * modes are 0, 1 or 2. In the PDF 32000 specification, please read 9.3.6 "Text Rendering Mode" to * know more. Mode 0 (FILL) is the default. Mode 1 (STROKE) will make glyphs look "hollow". Mode 2 * (FILL_STROKE) will make glyphs look "fat". * * @author Ben Litchfield * @author Tilman Hausherr */ public class PDF_Box_1 extends PDFTextStripper { /** * Instantiate a new PDFTextStripper object. * * @throws IOException If there is an error loading the properties. */ public PDF_Box_1() throws IOException { addOperator(new SetStrokingColorSpace()); addOperator(new SetNonStrokingColorSpace()); addOperator(new SetStrokingDeviceCMYKColor()); addOperator(new SetNonStrokingDeviceCMYKColor()); addOperator(new SetNonStrokingDeviceRGBColor()); addOperator(new SetStrokingDeviceRGBColor()); addOperator(new SetNonStrokingDeviceGrayColor()); addOperator(new SetStrokingDeviceGrayColor()); addOperator(new SetStrokingColor()); addOperator(new SetStrokingColorN()); addOperator(new SetNonStrokingColor()); addOperator(new SetNonStrokingColorN()); } /** * This will print the documents data. * * @param args The command line arguments. * * @throws IOException If there is an error parsing the document. */ public static void main(String[] args) throws IOException { try (PDDocument document = PDDocument.load(new File("D://Vimal//New folder//ab.pdf"))) { PDFTextStripper stripper = new PDF_Box_1(); stripper.setSortByPosition(true); stripper.setStartPage(0); stripper.setEndPage(document.getNumberOfPages()); stripper.getText(document); } } @Override protected void processTextPosition(TextPosition text) { super.processTextPosition(text); PDColor strokingColor = getGraphicsState().getStrokingColor(); PDColor nonStrokingColor = getGraphicsState().getNonStrokingColor(); String unicode = text.getUnicode(); RenderingMode renderingMode = getGraphicsState().getTextState().getRenderingMode(); System.out.println("Unicode:" + unicode); System.out.println("Rendering mode: " + renderingMode); System.out.println("Stroking color: " + strokingColor); System.out.println("Non-Stroking color: " + nonStrokingColor); System.out.println("Non-Stroking color: " + nonStrokingColor); System.out.println(); // See the PrintTextLocations for more attributes } /** * This will print the usage for this document. */ /*private static void usage() { System.err.println("Usage: java " + PDF_Box_1.class.getName() + "D://Vimal//New folder//b1.pdf"); }*/ } {code} But by using this I am getting Text of a Byte , but i want it for the word . Can you please help me in how to do this. was: I Need to Fetch the Color of Text in a
[jira] [Commented] (PDFBOX-3353) Create appearance streams for annotations
[ https://issues.apache.org/jira/browse/PDFBOX-3353?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16322721#comment-16322721 ] Tilman Hausherr commented on PDFBOX-3353: - Yes the postings are probably off-topic... My suggestion is this: - [~chitgoks] looks at the code I created in the signature issue (PDFBOX-3198) and decides whether it is helpful or not - if the discussion from 2018 until now is off-topic (i.e. if [~chitgoks] thinks "yes this new code is helpful!"), then lets all delete our 2018 postings here - and yes, maybe we should create a completely new issue, to create some code (maybe just example for now) to create annotations that are independant from the page rotation. > Create appearance streams for annotations > - > > Key: PDFBOX-3353 > URL: https://issues.apache.org/jira/browse/PDFBOX-3353 > Project: PDFBox > Issue Type: Task > Components: PDModel, Rendering >Affects Versions: 1.8.12, 2.0.0, 2.0.1, 2.0.2, 3.0.0 PDFBox >Reporter: Tilman Hausherr > Labels: Annotations > Attachments: PDFBOX-3353-highlight-noAP-001796-p1.pdf, > PDFBOX-3353-highlight-noAP.pdf, ShowAnnotation-4.java, SquareAnnotations.pdf, > line_dimension_appearance_stream-noAP.pdf, > line_dimension_appearance_stream.pdf, result-NoAP.pdf, result.pdf, > result_layout.png, showAnnotation.java, text_markup_ap_test.pdf > > > Create appearance streams for annotations when missing. > I'll start by replacing current code for Ink and Link annotations. > Good example PDFs: > http://www.pdfill.com/example/pdf_commenting_new.pdf > https://github.com/mozilla/pdf.js/issues/6810 -- This message was sent by Atlassian JIRA (v6.4.14#64029) - To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org
[jira] [Commented] (PDFBOX-3353) Create appearance streams for annotations
[ https://issues.apache.org/jira/browse/PDFBOX-3353?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16322697#comment-16322697 ] Maruan Sahyoun commented on PDFBOX-3353: [~tilman] there are two issues being dealt with / talked about in this ticket. One is the creation of the appearance streams the other one about being able to create content streams for different types of objects. Shouldn't we create a new issue for the later one? > Create appearance streams for annotations > - > > Key: PDFBOX-3353 > URL: https://issues.apache.org/jira/browse/PDFBOX-3353 > Project: PDFBox > Issue Type: Task > Components: PDModel, Rendering >Affects Versions: 1.8.12, 2.0.0, 2.0.1, 2.0.2, 3.0.0 PDFBox >Reporter: Tilman Hausherr > Labels: Annotations > Attachments: PDFBOX-3353-highlight-noAP-001796-p1.pdf, > PDFBOX-3353-highlight-noAP.pdf, ShowAnnotation-4.java, SquareAnnotations.pdf, > line_dimension_appearance_stream-noAP.pdf, > line_dimension_appearance_stream.pdf, result-NoAP.pdf, result.pdf, > result_layout.png, showAnnotation.java, text_markup_ap_test.pdf > > > Create appearance streams for annotations when missing. > I'll start by replacing current code for Ink and Link annotations. > Good example PDFs: > http://www.pdfill.com/example/pdf_commenting_new.pdf > https://github.com/mozilla/pdf.js/issues/6810 -- This message was sent by Atlassian JIRA (v6.4.14#64029) - To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org
[jira] [Commented] (PDFBOX-3353) Create appearance streams for annotations
[ https://issues.apache.org/jira/browse/PDFBOX-3353?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16322685#comment-16322685 ] Maruan Sahyoun commented on PDFBOX-3353: [~chitgoks] I'm not sure I understand what you are trying to achieve. Would you like to have the annotation 'respect' the page rotation so that if the page is rotated let's say by 90 degrees to the right an annotation which has been place in the upper left corner with it's width going from left to right is now placed in the upper right corner with it's width going from top to bottom? If you are patient I could come up with a little sample over the weekend to place a rectangular annotation with some text within it in the upper right corner of an A4 portrait page and the same annotation rotated together with the page. If there is some other "quick start" you'd like to see please let me know and I can see if I'm able to help you with that. > Create appearance streams for annotations > - > > Key: PDFBOX-3353 > URL: https://issues.apache.org/jira/browse/PDFBOX-3353 > Project: PDFBox > Issue Type: Task > Components: PDModel, Rendering >Affects Versions: 1.8.12, 2.0.0, 2.0.1, 2.0.2, 3.0.0 PDFBox >Reporter: Tilman Hausherr > Labels: Annotations > Attachments: PDFBOX-3353-highlight-noAP-001796-p1.pdf, > PDFBOX-3353-highlight-noAP.pdf, ShowAnnotation-4.java, SquareAnnotations.pdf, > line_dimension_appearance_stream-noAP.pdf, > line_dimension_appearance_stream.pdf, result-NoAP.pdf, result.pdf, > result_layout.png, showAnnotation.java, text_markup_ap_test.pdf > > > Create appearance streams for annotations when missing. > I'll start by replacing current code for Ink and Link annotations. > Good example PDFs: > http://www.pdfill.com/example/pdf_commenting_new.pdf > https://github.com/mozilla/pdf.js/issues/6810 -- This message was sent by Atlassian JIRA (v6.4.14#64029) - To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org
[jira] [Updated] (PDFBOX-3198) Visible Signature N2 layer
[ https://issues.apache.org/jira/browse/PDFBOX-3198?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Tilman Hausherr updated PDFBOX-3198: Attachment: CreateVisibleSignature2.java Latest version of CreateVisibleSignature2.java puts the signature at the same place regardless of rotation. (inspired by wish by [~chitgoks]) > Visible Signature N2 layer > -- > > Key: PDFBOX-3198 > URL: https://issues.apache.org/jira/browse/PDFBOX-3198 > Project: PDFBox > Issue Type: New Feature > Components: Signing >Affects Versions: 1.8.11 >Reporter: Frank Cornelis >Priority: Minor > Fix For: 2.0.9, 3.0.0 PDFBox > > Attachments: CreateVisibleSignature2.java, > CreateVisibleSignature2.java, CreateVisibleSignature2.java, > PDFBOX-3198-visible-signature.zip, PDFBOX-3198-work-5.5.2017.zip, > PDFBOX-3917_signed.pdf, helloworld_signed.pdf, pdfbox-n2-2.patch, signed.pdf > > > The patch adds N2 layer support to visible signatures. -- This message was sent by Atlassian JIRA (v6.4.14#64029) - To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org
[jira] [Commented] (PDFBOX-4058) High memory consumption when extracting image from PDF file
[ https://issues.apache.org/jira/browse/PDFBOX-4058?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16322600#comment-16322600 ] Tilman Hausherr commented on PDFBOX-4058: - The 2.0.9 release is planned for some time this month. I'd rather expect the end of the month. If we find regressions then it could take longer. No info about 3.0. I understand that you find it upsetting that this seemingly small file has such a huge memory footprint. The patterns images (for the logos) created at 300dpi are so huge. The pattern tile dimensions are larger than the PDF dimensions. To see this, have a look at TilingPaint.getImage() and save the image that is returned at the end of the method. The pattern classes do not have a knowledge of the PDF bounds so they can't create a smaller one. An alternative would be to render directly on the target image but this isn't the way it is being done. (I suspect that Adobe Reader does both, depending on the size of the pattern). No there isn't an easy way to find out whether a page has a huge memory footprint. > High memory consumption when extracting image from PDF file > --- > > Key: PDFBOX-4058 > URL: https://issues.apache.org/jira/browse/PDFBOX-4058 > Project: PDFBox > Issue Type: Bug > Components: Rendering >Affects Versions: 2.0.5, 2.0.6, 2.0.7, 2.0.8 > Environment: windows 10 / Linux >Reporter: Bjorn Misseghers >Assignee: Tilman Hausherr > Labels: regression > Fix For: 2.0.9, 3.0.0 PDFBox > > Attachments: HighMemoryFootprint.pdf > > > When rendering an image at 300 dpi from the included PDF, my java process > uses a huge amount of memory. > The document is only 45 Kb in size and contains 2 pages, my JVM is unable to > extract even 1 page with 3G of memory. Setting Xmx to 4G works but is not the > solution I want. > The error occurs when calling PDFRenderer.renderImageWithDPI() > I already tried tweaking the memory usage in my application to use a scratch > file while loading the document as well as avoiding caching of XObjects as > described here: https://pdfbox.apache.org/2.0/faq.html#outofmemoryerror > These didn't work. > The issue can be reproduced using the pdfbox-app utility: > java -Xmx3G -jar pdfbox-app-2.0.8.jar PDFToImage > HighMemoryFootprint.pdf -dpi 300 -color RGB -page 1 > What can not be changed? > * 300 dpi will not be decreased. > * Max Java memory will not be increased: 3GB is ridiculous for a 45kb PDF > file. -- This message was sent by Atlassian JIRA (v6.4.14#64029) - To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org
[jira] [Commented] (PDFBOX-3353) Create appearance streams for annotations
[ https://issues.apache.org/jira/browse/PDFBOX-3353?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16322578#comment-16322578 ] Tilman Hausherr commented on PDFBOX-3353: - So what you're really asking is how to place annotations in a similar way if the page is rotated. I had such a problem with signatures, {{PDVisibleSignDesigner.adjustForRotation()}} does this (PDFBOX-3671). However I don't know if this can easily be used for you because the code is not "general" enough. So I did it again (the trick is to move the cursor on the PDFDebugger rendering and see the status line coordinates changing), because the existing visual signature code is too complex, see recent code in PDFBOX-3198. The new code is simpler but didn't support rotated pages, and I will soon add some that does. If you wan to run that code, you need to use the keystore that is in "examples\src\test\resources\org\apache\pdfbox\examples\signature". You also need a small image. > Create appearance streams for annotations > - > > Key: PDFBOX-3353 > URL: https://issues.apache.org/jira/browse/PDFBOX-3353 > Project: PDFBox > Issue Type: Task > Components: PDModel, Rendering >Affects Versions: 1.8.12, 2.0.0, 2.0.1, 2.0.2, 3.0.0 PDFBox >Reporter: Tilman Hausherr > Labels: Annotations > Attachments: PDFBOX-3353-highlight-noAP-001796-p1.pdf, > PDFBOX-3353-highlight-noAP.pdf, ShowAnnotation-4.java, SquareAnnotations.pdf, > line_dimension_appearance_stream-noAP.pdf, > line_dimension_appearance_stream.pdf, result-NoAP.pdf, result.pdf, > result_layout.png, showAnnotation.java, text_markup_ap_test.pdf > > > Create appearance streams for annotations when missing. > I'll start by replacing current code for Ink and Link annotations. > Good example PDFs: > http://www.pdfill.com/example/pdf_commenting_new.pdf > https://github.com/mozilla/pdf.js/issues/6810 -- This message was sent by Atlassian JIRA (v6.4.14#64029) - To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org
[jira] [Updated] (PDFBOX-4063) NPE at PageIterator.enqueueKids
[ https://issues.apache.org/jira/browse/PDFBOX-4063?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Jorge Spinsanti updated PDFBOX-4063: Description: I got NullPointerException to merge PDF files (can not be attached because they are sensible information): {code} java.lang.NullPointerException at java.util.ArrayDeque.addLast(ArrayDeque.java:242) at java.util.ArrayDeque.add(ArrayDeque.java:408) at org.apache.pdfbox.pdmodel.PDPageTree$PageIterator.enqueueKids(PDPageTree.java:174) at org.apache.pdfbox.pdmodel.PDPageTree$PageIterator.enqueueKids(PDPageTree.java:169) at org.apache.pdfbox.pdmodel.PDPageTree$PageIterator.(PDPageTree.java:159) at org.apache.pdfbox.pdmodel.PDPageTree$PageIterator.(PDPageTree.java:153) at org.apache.pdfbox.pdmodel.PDPageTree.iterator(PDPageTree.java:123) at org.apache.pdfbox.multipdf.PDFMergerUtility.appendDocument(PDFMergerUtility.java:585) at org.apache.pdfbox.multipdf.PDFMergerUtility.mergeDocuments(PDFMergerUtility.java:266) {code} was: I got NullPointerException to merge PDF files (can not be attached because they are sensible information): {code} java.lang.NullPointerException at java.util.ArrayDeque.addLast(ArrayDeque.java:242) at java.util.ArrayDeque.add(ArrayDeque.java:408) at org.apache.pdfbox.pdmodel.PDPageTree$PageIterator.enqueueKids(PDPageTree.java:174) at org.apache.pdfbox.pdmodel.PDPageTree$PageIterator.enqueueKids(PDPageTree.java:169) at org.apache.pdfbox.pdmodel.PDPageTree$PageIterator.(PDPageTree.java:159) at org.apache.pdfbox.pdmodel.PDPageTree$PageIterator.(PDPageTree.java:153) at org.apache.pdfbox.pdmodel.PDPageTree.iterator(PDPageTree.java:123) at org.apache.pdfbox.multipdf.PDFMergerUtility.appendDocument(PDFMergerUtility.java:585) at org.apache.pdfbox.multipdf.PDFMergerUtility.mergeDocuments(PDFMergerUtility.java:266) {code] > NPE at PageIterator.enqueueKids > --- > > Key: PDFBOX-4063 > URL: https://issues.apache.org/jira/browse/PDFBOX-4063 > Project: PDFBox > Issue Type: Bug > Components: PDModel >Affects Versions: 2.0.8 >Reporter: Jorge Spinsanti > > I got NullPointerException to merge PDF files (can not be attached because > they are sensible information): > {code} > java.lang.NullPointerException > at java.util.ArrayDeque.addLast(ArrayDeque.java:242) > at java.util.ArrayDeque.add(ArrayDeque.java:408) > at > org.apache.pdfbox.pdmodel.PDPageTree$PageIterator.enqueueKids(PDPageTree.java:174) > at > org.apache.pdfbox.pdmodel.PDPageTree$PageIterator.enqueueKids(PDPageTree.java:169) > at > org.apache.pdfbox.pdmodel.PDPageTree$PageIterator.(PDPageTree.java:159) > at > org.apache.pdfbox.pdmodel.PDPageTree$PageIterator.(PDPageTree.java:153) > at org.apache.pdfbox.pdmodel.PDPageTree.iterator(PDPageTree.java:123) > at > org.apache.pdfbox.multipdf.PDFMergerUtility.appendDocument(PDFMergerUtility.java:585) > at > org.apache.pdfbox.multipdf.PDFMergerUtility.mergeDocuments(PDFMergerUtility.java:266) > {code} -- This message was sent by Atlassian JIRA (v6.4.14#64029) - To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org
[jira] [Created] (PDFBOX-4063) NPE at PageIterator.enqueueKids
Jorge Spinsanti created PDFBOX-4063: --- Summary: NPE at PageIterator.enqueueKids Key: PDFBOX-4063 URL: https://issues.apache.org/jira/browse/PDFBOX-4063 Project: PDFBox Issue Type: Bug Components: PDModel Affects Versions: 2.0.8 Reporter: Jorge Spinsanti I got NullPointerException to merge PDF files (can not be attached because they are sensible information): {code} java.lang.NullPointerException at java.util.ArrayDeque.addLast(ArrayDeque.java:242) at java.util.ArrayDeque.add(ArrayDeque.java:408) at org.apache.pdfbox.pdmodel.PDPageTree$PageIterator.enqueueKids(PDPageTree.java:174) at org.apache.pdfbox.pdmodel.PDPageTree$PageIterator.enqueueKids(PDPageTree.java:169) at org.apache.pdfbox.pdmodel.PDPageTree$PageIterator.(PDPageTree.java:159) at org.apache.pdfbox.pdmodel.PDPageTree$PageIterator.(PDPageTree.java:153) at org.apache.pdfbox.pdmodel.PDPageTree.iterator(PDPageTree.java:123) at org.apache.pdfbox.multipdf.PDFMergerUtility.appendDocument(PDFMergerUtility.java:585) at org.apache.pdfbox.multipdf.PDFMergerUtility.mergeDocuments(PDFMergerUtility.java:266) {code] -- This message was sent by Atlassian JIRA (v6.4.14#64029) - To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org
[jira] [Updated] (PDFBOX-4061) ClassCastException PDActionJavaScript cannot be cast to PDDestination
[ https://issues.apache.org/jira/browse/PDFBOX-4061?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Jorge Spinsanti updated PDFBOX-4061: Description: I got the following stacktrace merging PDFs. PDF files can not be attached because they have confidential information. {code} java.lang.ClassCastException: org.apache.pdfbox.pdmodel.interactive.action.PDActionJavaScript cannot be cast to org.apache.pdfbox.pdmodel.interactive.documentnavigation.destination.PDDestination at org.apache.pdfbox.multipdf.PDFMergerUtility.appendDocument(PDFMergerUtility.java:359) at org.apache.pdfbox.multipdf.PDFMergerUtility.mergeDocuments(PDFMergerUtility.java:266) {code} was: I got the following stacktrace merging PDFs. PDF files can not be attached because they have confidential information. {code} java.lang.ClassCastException: org.apache.pdfbox.pdmodel.interactive.action.PDActionJavaScript cannot be cast to org.apache.pdfbox.pdmodel.interactive.documentnavigation.destination.PDDestination at org.apache.pdfbox.multipdf.PDFMergerUtility.appendDocument(PDFMergerUtility.java:359) at org.apache.pdfbox.multipdf.PDFMergerUtility.mergeDocuments(PDFMergerUtility.java:266) > ClassCastException PDActionJavaScript cannot be cast to PDDestination > - > > Key: PDFBOX-4061 > URL: https://issues.apache.org/jira/browse/PDFBOX-4061 > Project: PDFBox > Issue Type: Bug > Components: PDModel >Affects Versions: 2.0.8 >Reporter: Jorge Spinsanti >Assignee: Tilman Hausherr > Fix For: 2.0.9, 3.0.0 PDFBox > > > I got the following stacktrace merging PDFs. PDF files can not be attached > because they have confidential information. > {code} > java.lang.ClassCastException: > org.apache.pdfbox.pdmodel.interactive.action.PDActionJavaScript cannot be > cast to > org.apache.pdfbox.pdmodel.interactive.documentnavigation.destination.PDDestination > at > org.apache.pdfbox.multipdf.PDFMergerUtility.appendDocument(PDFMergerUtility.java:359) > at > org.apache.pdfbox.multipdf.PDFMergerUtility.mergeDocuments(PDFMergerUtility.java:266) > {code} -- This message was sent by Atlassian JIRA (v6.4.14#64029) - To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org
[jira] [Comment Edited] (PDFBOX-4058) High memory consumption when extracting image from PDF file
[ https://issues.apache.org/jira/browse/PDFBOX-4058?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16322037#comment-16322037 ] Bjorn Misseghers edited comment on PDFBOX-4058 at 1/11/18 10:53 AM: First of all many thanks for the quick response! It is highly appreciated. Do you have any idea when 2.0.9 will be released? And what about 3.0? For now, I duplicated your fix in the 2.0.8 sources and made my own build, which works. However, I still can't get my head around the fact that we need close to 3G to extract what seems a very basic image. Is there maybe a way we can use PDFBox to detect PDF pages with high-memory consuming objects (objects with multiple layers?) without actually having to render them? was (Author: bjorn.misseghers): First of all many thanks for the quick response! It is highly appreciated. Do you have any idea when 2.0.9 will be released? And what about 3.0? For now, I duplicated your fix in the 2.0.8 sources and made my own build, which works. However, I still can't get my head around the fact that we need close to 3G to extract what seems a very basic image. Is there maybe a way we can use PDFBox to detect PDF pages with high-memory consuming objects without actually having to render them? > High memory consumption when extracting image from PDF file > --- > > Key: PDFBOX-4058 > URL: https://issues.apache.org/jira/browse/PDFBOX-4058 > Project: PDFBox > Issue Type: Bug > Components: Rendering >Affects Versions: 2.0.5, 2.0.6, 2.0.7, 2.0.8 > Environment: windows 10 / Linux >Reporter: Bjorn Misseghers >Assignee: Tilman Hausherr > Labels: regression > Fix For: 2.0.9, 3.0.0 PDFBox > > Attachments: HighMemoryFootprint.pdf > > > When rendering an image at 300 dpi from the included PDF, my java process > uses a huge amount of memory. > The document is only 45 Kb in size and contains 2 pages, my JVM is unable to > extract even 1 page with 3G of memory. Setting Xmx to 4G works but is not the > solution I want. > The error occurs when calling PDFRenderer.renderImageWithDPI() > I already tried tweaking the memory usage in my application to use a scratch > file while loading the document as well as avoiding caching of XObjects as > described here: https://pdfbox.apache.org/2.0/faq.html#outofmemoryerror > These didn't work. > The issue can be reproduced using the pdfbox-app utility: > java -Xmx3G -jar pdfbox-app-2.0.8.jar PDFToImage > HighMemoryFootprint.pdf -dpi 300 -color RGB -page 1 > What can not be changed? > * 300 dpi will not be decreased. > * Max Java memory will not be increased: 3GB is ridiculous for a 45kb PDF > file. -- This message was sent by Atlassian JIRA (v6.4.14#64029) - To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org
[jira] [Commented] (PDFBOX-4058) High memory consumption when extracting image from PDF file
[ https://issues.apache.org/jira/browse/PDFBOX-4058?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16322037#comment-16322037 ] Bjorn Misseghers commented on PDFBOX-4058: -- First of all many thanks for the quick response! It is highly appreciated. Do you have any idea when 2.0.9 will be released? And what about 3.0? For now, I duplicated your fix in the 2.0.8 sources and made my own build, which works. However, I still can't get my head around the fact that we need close to 3G to extract what seems a very basic image. Is there maybe a way we can use PDFBox to detect PDF pages with high-memory consuming objects without actually having to render them? > High memory consumption when extracting image from PDF file > --- > > Key: PDFBOX-4058 > URL: https://issues.apache.org/jira/browse/PDFBOX-4058 > Project: PDFBox > Issue Type: Bug > Components: Rendering >Affects Versions: 2.0.5, 2.0.6, 2.0.7, 2.0.8 > Environment: windows 10 / Linux >Reporter: Bjorn Misseghers >Assignee: Tilman Hausherr > Labels: regression > Fix For: 2.0.9, 3.0.0 PDFBox > > Attachments: HighMemoryFootprint.pdf > > > When rendering an image at 300 dpi from the included PDF, my java process > uses a huge amount of memory. > The document is only 45 Kb in size and contains 2 pages, my JVM is unable to > extract even 1 page with 3G of memory. Setting Xmx to 4G works but is not the > solution I want. > The error occurs when calling PDFRenderer.renderImageWithDPI() > I already tried tweaking the memory usage in my application to use a scratch > file while loading the document as well as avoiding caching of XObjects as > described here: https://pdfbox.apache.org/2.0/faq.html#outofmemoryerror > These didn't work. > The issue can be reproduced using the pdfbox-app utility: > java -Xmx3G -jar pdfbox-app-2.0.8.jar PDFToImage > HighMemoryFootprint.pdf -dpi 300 -color RGB -page 1 > What can not be changed? > * 300 dpi will not be decreased. > * Max Java memory will not be increased: 3GB is ridiculous for a 45kb PDF > file. -- This message was sent by Atlassian JIRA (v6.4.14#64029) - To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org
[jira] [Updated] (PDFBOX-4062) Fetch Color of Text using PDFBox
[ https://issues.apache.org/jira/browse/PDFBOX-4062?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Vimal Kumar updated PDFBOX-4062: Affects Version/s: 2.0.0 > Fetch Color of Text using PDFBox > > > Key: PDFBOX-4062 > URL: https://issues.apache.org/jira/browse/PDFBOX-4062 > Project: PDFBox > Issue Type: Bug >Affects Versions: 2.0.0 >Reporter: Vimal Kumar >Priority: Blocker > Attachments: b1.pdf > > > I Need to Fetch the Color of Text in a PDF using pdfbox 2.0.0 , for the same > i have written java code as > import java.io.ByteArrayOutputStream; > import java.io.File; > import java.io.IOException; > import java.io.OutputStreamWriter; > import java.io.Writer; > import org.apache.pdfbox.contentstream.operator.color.SetNonStrokingColor; > import org.apache.pdfbox.contentstream.operator.color.SetNonStrokingColorN; > import > org.apache.pdfbox.contentstream.operator.color.SetNonStrokingColorSpace; > import > org.apache.pdfbox.contentstream.operator.color.SetNonStrokingDeviceCMYKColor; > import > org.apache.pdfbox.contentstream.operator.color.SetNonStrokingDeviceGrayColor; > import > org.apache.pdfbox.contentstream.operator.color.SetNonStrokingDeviceRGBColor; > import org.apache.pdfbox.contentstream.operator.color.SetStrokingColor; > import org.apache.pdfbox.contentstream.operator.color.SetStrokingColorN; > import org.apache.pdfbox.contentstream.operator.color.SetStrokingColorSpace; > import > org.apache.pdfbox.contentstream.operator.color.SetStrokingDeviceCMYKColor; > import > org.apache.pdfbox.contentstream.operator.color.SetStrokingDeviceGrayColor; > import > org.apache.pdfbox.contentstream.operator.color.SetStrokingDeviceRGBColor; > import org.apache.pdfbox.pdmodel.PDDocument; > import org.apache.pdfbox.pdmodel.graphics.color.PDColor; > import org.apache.pdfbox.pdmodel.graphics.state.RenderingMode; > import org.apache.pdfbox.text.PDFTextStripper; > import org.apache.pdfbox.text.TextPosition; > /** > * This is an example on how to get the colors of text. Note that this will > not tell the background, > * and will only work properly if the text is not overwritten later, and only > if the text rendering > * modes are 0, 1 or 2. In the PDF 32000 specification, please read 9.3.6 > "Text Rendering Mode" to > * know more. Mode 0 (FILL) is the default. Mode 1 (STROKE) will make glyphs > look "hollow". Mode 2 > * (FILL_STROKE) will make glyphs look "fat". > * > * @author Ben Litchfield > * @author Tilman Hausherr > */ > public class PDF_Box_1 extends PDFTextStripper > { > /** > * Instantiate a new PDFTextStripper object. > * > * @throws IOException If there is an error loading the properties. > */ > public PDF_Box_1() throws IOException > { > addOperator(new SetStrokingColorSpace()); > addOperator(new SetNonStrokingColorSpace()); > addOperator(new SetStrokingDeviceCMYKColor()); > addOperator(new SetNonStrokingDeviceCMYKColor()); > addOperator(new SetNonStrokingDeviceRGBColor()); > addOperator(new SetStrokingDeviceRGBColor()); > addOperator(new SetNonStrokingDeviceGrayColor()); > addOperator(new SetStrokingDeviceGrayColor()); > addOperator(new SetStrokingColor()); > addOperator(new SetStrokingColorN()); > addOperator(new SetNonStrokingColor()); > addOperator(new SetNonStrokingColorN()); > } > /** > * This will print the documents data. > * > * @param args The command line arguments. > * > * @throws IOException If there is an error parsing the document. > */ > public static void main(String[] args) throws IOException > { > > try (PDDocument document = PDDocument.load(new > File("D://Vimal//New folder//ab.pdf"))) > { > PDFTextStripper stripper = new PDF_Box_1(); > stripper.setSortByPosition(true); > stripper.setStartPage(0); > stripper.setEndPage(document.getNumberOfPages()); > stripper.getText(document); > } > > } > @Override > protected void processTextPosition(TextPosition text) > { > super.processTextPosition(text); > PDColor strokingColor = getGraphicsState().getStrokingColor(); > PDColor nonStrokingColor = getGraphicsState().getNonStrokingColor(); > String unicode = text.getUnicode(); > RenderingMode renderingMode = > getGraphicsState().getTextState().getRenderingMode(); > System.out.println("Unicode:" + unicode); > System.out.println("Rendering mode: " + renderingMode); > System.out.println("Stroking color: " + strokingColor); > System.out.println("Non-Stroking color: " + nonStrokingColor); >
[jira] [Updated] (PDFBOX-4062) Fetch Color of Text using PDFBox
[ https://issues.apache.org/jira/browse/PDFBOX-4062?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Vimal Kumar updated PDFBOX-4062: Attachment: b1.pdf > Fetch Color of Text using PDFBox > > > Key: PDFBOX-4062 > URL: https://issues.apache.org/jira/browse/PDFBOX-4062 > Project: PDFBox > Issue Type: Bug >Reporter: Vimal Kumar >Priority: Blocker > Attachments: b1.pdf > > > I Need to Fetch the Color of Text in a PDF using pdfbox 2.0.0 , for the same > i have written java code as > import java.io.ByteArrayOutputStream; > import java.io.File; > import java.io.IOException; > import java.io.OutputStreamWriter; > import java.io.Writer; > import org.apache.pdfbox.contentstream.operator.color.SetNonStrokingColor; > import org.apache.pdfbox.contentstream.operator.color.SetNonStrokingColorN; > import > org.apache.pdfbox.contentstream.operator.color.SetNonStrokingColorSpace; > import > org.apache.pdfbox.contentstream.operator.color.SetNonStrokingDeviceCMYKColor; > import > org.apache.pdfbox.contentstream.operator.color.SetNonStrokingDeviceGrayColor; > import > org.apache.pdfbox.contentstream.operator.color.SetNonStrokingDeviceRGBColor; > import org.apache.pdfbox.contentstream.operator.color.SetStrokingColor; > import org.apache.pdfbox.contentstream.operator.color.SetStrokingColorN; > import org.apache.pdfbox.contentstream.operator.color.SetStrokingColorSpace; > import > org.apache.pdfbox.contentstream.operator.color.SetStrokingDeviceCMYKColor; > import > org.apache.pdfbox.contentstream.operator.color.SetStrokingDeviceGrayColor; > import > org.apache.pdfbox.contentstream.operator.color.SetStrokingDeviceRGBColor; > import org.apache.pdfbox.pdmodel.PDDocument; > import org.apache.pdfbox.pdmodel.graphics.color.PDColor; > import org.apache.pdfbox.pdmodel.graphics.state.RenderingMode; > import org.apache.pdfbox.text.PDFTextStripper; > import org.apache.pdfbox.text.TextPosition; > /** > * This is an example on how to get the colors of text. Note that this will > not tell the background, > * and will only work properly if the text is not overwritten later, and only > if the text rendering > * modes are 0, 1 or 2. In the PDF 32000 specification, please read 9.3.6 > "Text Rendering Mode" to > * know more. Mode 0 (FILL) is the default. Mode 1 (STROKE) will make glyphs > look "hollow". Mode 2 > * (FILL_STROKE) will make glyphs look "fat". > * > * @author Ben Litchfield > * @author Tilman Hausherr > */ > public class PDF_Box_1 extends PDFTextStripper > { > /** > * Instantiate a new PDFTextStripper object. > * > * @throws IOException If there is an error loading the properties. > */ > public PDF_Box_1() throws IOException > { > addOperator(new SetStrokingColorSpace()); > addOperator(new SetNonStrokingColorSpace()); > addOperator(new SetStrokingDeviceCMYKColor()); > addOperator(new SetNonStrokingDeviceCMYKColor()); > addOperator(new SetNonStrokingDeviceRGBColor()); > addOperator(new SetStrokingDeviceRGBColor()); > addOperator(new SetNonStrokingDeviceGrayColor()); > addOperator(new SetStrokingDeviceGrayColor()); > addOperator(new SetStrokingColor()); > addOperator(new SetStrokingColorN()); > addOperator(new SetNonStrokingColor()); > addOperator(new SetNonStrokingColorN()); > } > /** > * This will print the documents data. > * > * @param args The command line arguments. > * > * @throws IOException If there is an error parsing the document. > */ > public static void main(String[] args) throws IOException > { > > try (PDDocument document = PDDocument.load(new > File("D://Vimal//New folder//ab.pdf"))) > { > PDFTextStripper stripper = new PDF_Box_1(); > stripper.setSortByPosition(true); > stripper.setStartPage(0); > stripper.setEndPage(document.getNumberOfPages()); > stripper.getText(document); > } > > } > @Override > protected void processTextPosition(TextPosition text) > { > super.processTextPosition(text); > PDColor strokingColor = getGraphicsState().getStrokingColor(); > PDColor nonStrokingColor = getGraphicsState().getNonStrokingColor(); > String unicode = text.getUnicode(); > RenderingMode renderingMode = > getGraphicsState().getTextState().getRenderingMode(); > System.out.println("Unicode:" + unicode); > System.out.println("Rendering mode: " + renderingMode); > System.out.println("Stroking color: " + strokingColor); > System.out.println("Non-Stroking color: " + nonStrokingColor); >
[jira] [Updated] (PDFBOX-4062) Fetch Color of Text using PDFBox
[ https://issues.apache.org/jira/browse/PDFBOX-4062?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Vimal Kumar updated PDFBOX-4062: Description: I Need to Fetch the Color of Text in a PDF using pdfbox 2.0.0 , for the same i have written java code as import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException; import java.io.OutputStreamWriter; import java.io.Writer; import org.apache.pdfbox.contentstream.operator.color.SetNonStrokingColor; import org.apache.pdfbox.contentstream.operator.color.SetNonStrokingColorN; import org.apache.pdfbox.contentstream.operator.color.SetNonStrokingColorSpace; import org.apache.pdfbox.contentstream.operator.color.SetNonStrokingDeviceCMYKColor; import org.apache.pdfbox.contentstream.operator.color.SetNonStrokingDeviceGrayColor; import org.apache.pdfbox.contentstream.operator.color.SetNonStrokingDeviceRGBColor; import org.apache.pdfbox.contentstream.operator.color.SetStrokingColor; import org.apache.pdfbox.contentstream.operator.color.SetStrokingColorN; import org.apache.pdfbox.contentstream.operator.color.SetStrokingColorSpace; import org.apache.pdfbox.contentstream.operator.color.SetStrokingDeviceCMYKColor; import org.apache.pdfbox.contentstream.operator.color.SetStrokingDeviceGrayColor; import org.apache.pdfbox.contentstream.operator.color.SetStrokingDeviceRGBColor; import org.apache.pdfbox.pdmodel.PDDocument; import org.apache.pdfbox.pdmodel.graphics.color.PDColor; import org.apache.pdfbox.pdmodel.graphics.state.RenderingMode; import org.apache.pdfbox.text.PDFTextStripper; import org.apache.pdfbox.text.TextPosition; /** * This is an example on how to get the colors of text. Note that this will not tell the background, * and will only work properly if the text is not overwritten later, and only if the text rendering * modes are 0, 1 or 2. In the PDF 32000 specification, please read 9.3.6 "Text Rendering Mode" to * know more. Mode 0 (FILL) is the default. Mode 1 (STROKE) will make glyphs look "hollow". Mode 2 * (FILL_STROKE) will make glyphs look "fat". * * @author Ben Litchfield * @author Tilman Hausherr */ public class PDF_Box_1 extends PDFTextStripper { /** * Instantiate a new PDFTextStripper object. * * @throws IOException If there is an error loading the properties. */ public PDF_Box_1() throws IOException { addOperator(new SetStrokingColorSpace()); addOperator(new SetNonStrokingColorSpace()); addOperator(new SetStrokingDeviceCMYKColor()); addOperator(new SetNonStrokingDeviceCMYKColor()); addOperator(new SetNonStrokingDeviceRGBColor()); addOperator(new SetStrokingDeviceRGBColor()); addOperator(new SetNonStrokingDeviceGrayColor()); addOperator(new SetStrokingDeviceGrayColor()); addOperator(new SetStrokingColor()); addOperator(new SetStrokingColorN()); addOperator(new SetNonStrokingColor()); addOperator(new SetNonStrokingColorN()); } /** * This will print the documents data. * * @param args The command line arguments. * * @throws IOException If there is an error parsing the document. */ public static void main(String[] args) throws IOException { try (PDDocument document = PDDocument.load(new File("D://Vimal//New folder//ab.pdf"))) { PDFTextStripper stripper = new PDF_Box_1(); stripper.setSortByPosition(true); stripper.setStartPage(0); stripper.setEndPage(document.getNumberOfPages()); stripper.getText(document); } } @Override protected void processTextPosition(TextPosition text) { super.processTextPosition(text); PDColor strokingColor = getGraphicsState().getStrokingColor(); PDColor nonStrokingColor = getGraphicsState().getNonStrokingColor(); String unicode = text.getUnicode(); RenderingMode renderingMode = getGraphicsState().getTextState().getRenderingMode(); System.out.println("Unicode:" + unicode); System.out.println("Rendering mode: " + renderingMode); System.out.println("Stroking color: " + strokingColor); System.out.println("Non-Stroking color: " + nonStrokingColor); System.out.println("Non-Stroking color: " + nonStrokingColor); System.out.println(); // See the PrintTextLocations for more attributes } /** * This will print the usage for this document. */ /*private static void usage() { System.err.println("Usage: java " + PDF_Box_1.class.getName() + "D://Vimal//New folder//b1.pdf"); }*/ } But by using this I am getting Text of a Byte , but i want it for the word . Can you please help me in how to do this. was: I Need to Fetch the Color of Text in a PDF using pdfbox
[jira] [Created] (PDFBOX-4062) Fetch Color of Text using PDFBox
Vimal Kumar created PDFBOX-4062: --- Summary: Fetch Color of Text using PDFBox Key: PDFBOX-4062 URL: https://issues.apache.org/jira/browse/PDFBOX-4062 Project: PDFBox Issue Type: Bug Reporter: Vimal Kumar Priority: Blocker I Need to Fetch the Color of Text in a PDF using pdfbox 2.0.0 , for the same i have written java code as import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException; import java.io.OutputStreamWriter; import java.io.Writer; import org.apache.pdfbox.contentstream.operator.color.SetNonStrokingColor; import org.apache.pdfbox.contentstream.operator.color.SetNonStrokingColorN; import org.apache.pdfbox.contentstream.operator.color.SetNonStrokingColorSpace; import org.apache.pdfbox.contentstream.operator.color.SetNonStrokingDeviceCMYKColor; import org.apache.pdfbox.contentstream.operator.color.SetNonStrokingDeviceGrayColor; import org.apache.pdfbox.contentstream.operator.color.SetNonStrokingDeviceRGBColor; import org.apache.pdfbox.contentstream.operator.color.SetStrokingColor; import org.apache.pdfbox.contentstream.operator.color.SetStrokingColorN; import org.apache.pdfbox.contentstream.operator.color.SetStrokingColorSpace; import org.apache.pdfbox.contentstream.operator.color.SetStrokingDeviceCMYKColor; import org.apache.pdfbox.contentstream.operator.color.SetStrokingDeviceGrayColor; import org.apache.pdfbox.contentstream.operator.color.SetStrokingDeviceRGBColor; import org.apache.pdfbox.pdmodel.PDDocument; import org.apache.pdfbox.pdmodel.graphics.color.PDColor; import org.apache.pdfbox.pdmodel.graphics.state.RenderingMode; import org.apache.pdfbox.text.PDFTextStripper; import org.apache.pdfbox.text.TextPosition; /** * This is an example on how to get the colors of text. Note that this will not tell the background, * and will only work properly if the text is not overwritten later, and only if the text rendering * modes are 0, 1 or 2. In the PDF 32000 specification, please read 9.3.6 "Text Rendering Mode" to * know more. Mode 0 (FILL) is the default. Mode 1 (STROKE) will make glyphs look "hollow". Mode 2 * (FILL_STROKE) will make glyphs look "fat". * * @author Ben Litchfield * @author Tilman Hausherr */ public class PDF_Box_1 extends PDFTextStripper { /** * Instantiate a new PDFTextStripper object. * * @throws IOException If there is an error loading the properties. */ public PDF_Box_1() throws IOException { addOperator(new SetStrokingColorSpace()); addOperator(new SetNonStrokingColorSpace()); addOperator(new SetStrokingDeviceCMYKColor()); addOperator(new SetNonStrokingDeviceCMYKColor()); addOperator(new SetNonStrokingDeviceRGBColor()); addOperator(new SetStrokingDeviceRGBColor()); addOperator(new SetNonStrokingDeviceGrayColor()); addOperator(new SetStrokingDeviceGrayColor()); addOperator(new SetStrokingColor()); addOperator(new SetStrokingColorN()); addOperator(new SetNonStrokingColor()); addOperator(new SetNonStrokingColorN()); } /** * This will print the documents data. * * @param args The command line arguments. * * @throws IOException If there is an error parsing the document. */ public static void main(String[] args) throws IOException { try (PDDocument document = PDDocument.load(new File("D://Vimal//New folder//ab.pdf"))) { PDFTextStripper stripper = new PDF_Box_1(); stripper.setSortByPosition(true); stripper.setStartPage(0); stripper.setEndPage(document.getNumberOfPages()); Writer dummy = new OutputStreamWriter(new ByteArrayOutputStream()); stripper.writeText(document, dummy); } } @Override protected void processTextPosition(TextPosition text) { super.processTextPosition(text); PDColor strokingColor = getGraphicsState().getStrokingColor(); PDColor nonStrokingColor = getGraphicsState().getNonStrokingColor(); String unicode = text.getUnicode(); RenderingMode renderingMode = getGraphicsState().getTextState().getRenderingMode(); System.out.println("Unicode:" + unicode); System.out.println("Rendering mode: " + renderingMode); System.out.println("Stroking color: " + strokingColor); System.out.println("Non-Stroking color: " + nonStrokingColor); System.out.println("Non-Stroking color: " + nonStrokingColor); System.out.println(); // See the PrintTextLocations for more attributes } /** * This will print the usage for this document. */ /*private static void usage() { System.err.println("Usage: java " +
[jira] [Commented] (PDFBOX-4058) High memory consumption when extracting image from PDF file
[ https://issues.apache.org/jira/browse/PDFBOX-4058?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16321862#comment-16321862 ] Timo Boehme commented on PDFBOX-4058: - I would say that putting the values in weak-references is the correct solution if you look at how WeakHashMap works: only the keys are weak and may be garbage collected at any time but the values are not. The table entries are cleared only if you run a method (get/put/size/...) on the table. Without accessing the table all entries remain (especially the values). Thus in order to allow also the values to be garbage collected if needed it is required to put them into a WeakReference as you have done. > High memory consumption when extracting image from PDF file > --- > > Key: PDFBOX-4058 > URL: https://issues.apache.org/jira/browse/PDFBOX-4058 > Project: PDFBox > Issue Type: Bug > Components: Rendering >Affects Versions: 2.0.5, 2.0.6, 2.0.7, 2.0.8 > Environment: windows 10 / Linux >Reporter: Bjorn Misseghers >Assignee: Tilman Hausherr > Labels: regression > Fix For: 2.0.9, 3.0.0 PDFBox > > Attachments: HighMemoryFootprint.pdf > > > When rendering an image at 300 dpi from the included PDF, my java process > uses a huge amount of memory. > The document is only 45 Kb in size and contains 2 pages, my JVM is unable to > extract even 1 page with 3G of memory. Setting Xmx to 4G works but is not the > solution I want. > The error occurs when calling PDFRenderer.renderImageWithDPI() > I already tried tweaking the memory usage in my application to use a scratch > file while loading the document as well as avoiding caching of XObjects as > described here: https://pdfbox.apache.org/2.0/faq.html#outofmemoryerror > These didn't work. > The issue can be reproduced using the pdfbox-app utility: > java -Xmx3G -jar pdfbox-app-2.0.8.jar PDFToImage > HighMemoryFootprint.pdf -dpi 300 -color RGB -page 1 > What can not be changed? > * 300 dpi will not be decreased. > * Max Java memory will not be increased: 3GB is ridiculous for a 45kb PDF > file. -- This message was sent by Atlassian JIRA (v6.4.14#64029) - To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org
[jira] [Comment Edited] (PDFBOX-3353) Create appearance streams for annotations
[ https://issues.apache.org/jira/browse/PDFBOX-3353?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16321835#comment-16321835 ] chitgoks edited comment on PDFBOX-3353 at 1/11/18 8:10 AM: --- sorry, my issue is not with appearance streams but their positioning. not sure why they didnt appear. my annotations' appearance streams are all working (except cloud annotation, no appearance stream). please see result_layout.png this is how i would want once annotations are added. just that when i add the annotations the result is the same as in result.pdf. i think i posted in the wrong thread. was (Author: chitgoks): sorry, my issue is not with appearance streams but their positioning. not sure why they didnt appear. my annotations' appearance streams are all working (except cloud annotation, no appearance stream). please see result_layout.png this is how i would want once annotations are added. just that when i add the annotations the result is the same as in result.pdf. > Create appearance streams for annotations > - > > Key: PDFBOX-3353 > URL: https://issues.apache.org/jira/browse/PDFBOX-3353 > Project: PDFBox > Issue Type: Task > Components: PDModel, Rendering >Affects Versions: 1.8.12, 2.0.0, 2.0.1, 2.0.2, 3.0.0 PDFBox >Reporter: Tilman Hausherr > Labels: Annotations > Attachments: PDFBOX-3353-highlight-noAP-001796-p1.pdf, > PDFBOX-3353-highlight-noAP.pdf, ShowAnnotation-4.java, SquareAnnotations.pdf, > line_dimension_appearance_stream-noAP.pdf, > line_dimension_appearance_stream.pdf, result-NoAP.pdf, result.pdf, > result_layout.png, showAnnotation.java, text_markup_ap_test.pdf > > > Create appearance streams for annotations when missing. > I'll start by replacing current code for Ink and Link annotations. > Good example PDFs: > http://www.pdfill.com/example/pdf_commenting_new.pdf > https://github.com/mozilla/pdf.js/issues/6810 -- This message was sent by Atlassian JIRA (v6.4.14#64029) - To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org