[jira] [Commented] (PDFBOX-4669) Ensure proper functionality of COSArrayList
[ https://issues.apache.org/jira/browse/PDFBOX-4669?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17003605#comment-17003605 ] Tilman Hausherr commented on PDFBOX-4669: - I wonder what could go wrong for the few cases where we have a map with a COSDictionary as key. This is done in PDFMergerUtility and PDAcroForm. Also, the string representation might bring trouble when it is very nested, e.g. with COSStreams etc. > Ensure proper functionality of COSArrayList > --- > > Key: PDFBOX-4669 > URL: https://issues.apache.org/jira/browse/PDFBOX-4669 > Project: PDFBox > Issue Type: Sub-task > Components: PDModel >Affects Versions: 2.0.17, 3.0.0 PDFBox >Reporter: Maruan Sahyoun >Assignee: Maruan Sahyoun >Priority: Major > > The current COSArrayList implementation has some glitches as pointed out at > https://stackoverflow.com/questions/45812696/ > In addition when working with {{AnnotationFilter}} as the > adding/update/removal is index based the wron index of the underlying > {{COSArray}} is affected. -- This message was sent by Atlassian Jira (v8.3.4#803005) - To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org
[jira] [Commented] (PDFBOX-4669) Ensure proper functionality of COSArrayList
[ https://issues.apache.org/jira/browse/PDFBOX-4669?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17003519#comment-17003519 ] Maruan Sahyoun commented on PDFBOX-4669: Ok - let me describe in more detail what happens in current code when I create a list of annotations like this {code:java} ArrayList pageAnnots = new ArrayList<>(); PDAnnotationHighlight txtMark = new PDAnnotationHighlight(); PDAnnotationLink txtLink = new PDAnnotationLink(); pageAnnots.add(txtMark); pageAnnots.add(txtMark); pageAnnots.add(txtMark); pageAnnots.add(txtLink); {code} the number of entries is 4 Removing entries from the list {code:java} pageAnnots.removeAll(Collections.singleton(pageAnnots.get(0))); {code} the number of entries is now 1 as txtMark is the same object Adding the original list to the page and retrieving that {code:java} page.setAnnotations(pageAnnots); List annotsFromPage = page.getAnnotations(); {code} the number of entries is 4 as one would expect. Removing from that list similar to above code {code:java} PDAnnotation toBeRemoved = (PDAnnotation) annotsFromPage.get(0); annotsFromPage.removeAll(Collections.singletonList(toBeRemoved)); {code} The number of entries is 3 as theses are newly created instances from the COSArray entries and they are treated independently. **but** {code:java} PDAnnotation instance0 = (PDAnnotation) annotsFromPage.get(0); PDAnnotation instance1 = (PDAnnotation) annotsFromPage.get(1); instance0.setRectangle(new PDRectangle(10f, 10f)); System.out.println(instance1.getRectangle()); {code} prints {{[0.0,0.0,10.0,10.0]}} for {{instance2}} as they share the same COSObject. Although something like that might not be used in practice and currently only happens in my unit tests I created for COSArrayList I think we should ensure that this is handled consistently and preferably consistent to {{java.util.List}} IMHO as changing one instance does also change the other they should be treated as the same mutable object. WDYT? Side note - longer term (very long) we might want to think about no longer directly manipulating the COS model from PD but only create it as we save to disk. Would also help with issues where one could directly manipulate COS which does not update PD e.g. what happens if one removes an entry from a COSArray. We would then have have two independent models where one could choose to use COS or PD with the typical user using PD. > Ensure proper functionality of COSArrayList > --- > > Key: PDFBOX-4669 > URL: https://issues.apache.org/jira/browse/PDFBOX-4669 > Project: PDFBox > Issue Type: Sub-task > Components: PDModel >Affects Versions: 2.0.17, 3.0.0 PDFBox >Reporter: Maruan Sahyoun >Assignee: Maruan Sahyoun >Priority: Major > > The current COSArrayList implementation has some glitches as pointed out at > https://stackoverflow.com/questions/45812696/ > In addition when working with {{AnnotationFilter}} as the > adding/update/removal is index based the wron index of the underlying > {{COSArray}} is affected. -- This message was sent by Atlassian Jira (v8.3.4#803005) - To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org
[jira] [Commented] (PDFBOX-4669) Ensure proper functionality of COSArrayList
[ https://issues.apache.org/jira/browse/PDFBOX-4669?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17003530#comment-17003530 ] Andreas Lehmkühler commented on PDFBOX-4669: Looks like the setAnnotation/getAnnotation part is the reason for the same referenced objects: - setAnnotation reduces the given annotations to their dictionary -> COSArray with 4 dictionary objects, the first 3 are the same - getAnnotations creates new annotations from those dictionaries -> COSArrayList with 4 objects, the first 3 are all different but using the same dictionary At the end you don't get the very same objects back you called the setter with > Ensure proper functionality of COSArrayList > --- > > Key: PDFBOX-4669 > URL: https://issues.apache.org/jira/browse/PDFBOX-4669 > Project: PDFBox > Issue Type: Sub-task > Components: PDModel >Affects Versions: 2.0.17, 3.0.0 PDFBox >Reporter: Maruan Sahyoun >Assignee: Maruan Sahyoun >Priority: Major > > The current COSArrayList implementation has some glitches as pointed out at > https://stackoverflow.com/questions/45812696/ > In addition when working with {{AnnotationFilter}} as the > adding/update/removal is index based the wron index of the underlying > {{COSArray}} is affected. -- This message was sent by Atlassian Jira (v8.3.4#803005) - To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org
[jira] [Commented] (PDFBOX-4669) Ensure proper functionality of COSArrayList
[ https://issues.apache.org/jira/browse/PDFBOX-4669?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17003542#comment-17003542 ] Maruan Sahyoun commented on PDFBOX-4669: in addition - writing to PDF for the 3 same annotations they share the same indirect object reference - \{{4 0 R}} in my case. Possible fixes * add \{{equals}} to PDAnnotation where two annotations are equal if the COSObject is equal * additionally we could also look in adding the same objects to the list of they share the same COSObject for getAnnotation The first one is a must have IMHO - the second an added benefit. > Ensure proper functionality of COSArrayList > --- > > Key: PDFBOX-4669 > URL: https://issues.apache.org/jira/browse/PDFBOX-4669 > Project: PDFBox > Issue Type: Sub-task > Components: PDModel >Affects Versions: 2.0.17, 3.0.0 PDFBox >Reporter: Maruan Sahyoun >Assignee: Maruan Sahyoun >Priority: Major > > The current COSArrayList implementation has some glitches as pointed out at > https://stackoverflow.com/questions/45812696/ > In addition when working with {{AnnotationFilter}} as the > adding/update/removal is index based the wron index of the underlying > {{COSArray}} is affected. -- This message was sent by Atlassian Jira (v8.3.4#803005) - To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org
[jira] [Commented] (PDFBOX-4669) Ensure proper functionality of COSArrayList
[ https://issues.apache.org/jira/browse/PDFBOX-4669?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17003599#comment-17003599 ] Maruan Sahyoun commented on PDFBOX-4669: removeAll/retainAll won't show an issue after the fixes (also need to ensure proper update of the underlying COSArray). Now - I'd also like to implement \{equals] and {hashSet} for \{COSDictionary} where two dictionaries are equal if their string representation is equal - WDYT? Otherwise we need to put in individual fixes for annotations and similar objects such as fields whereas when adding to COSDictionary there will be less specific code. > Ensure proper functionality of COSArrayList > --- > > Key: PDFBOX-4669 > URL: https://issues.apache.org/jira/browse/PDFBOX-4669 > Project: PDFBox > Issue Type: Sub-task > Components: PDModel >Affects Versions: 2.0.17, 3.0.0 PDFBox >Reporter: Maruan Sahyoun >Assignee: Maruan Sahyoun >Priority: Major > > The current COSArrayList implementation has some glitches as pointed out at > https://stackoverflow.com/questions/45812696/ > In addition when working with {{AnnotationFilter}} as the > adding/update/removal is index based the wron index of the underlying > {{COSArray}} is affected. -- This message was sent by Atlassian Jira (v8.3.4#803005) - To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org
[jira] [Commented] (PDFBOX-4669) Ensure proper functionality of COSArrayList
[ https://issues.apache.org/jira/browse/PDFBOX-4669?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17003580#comment-17003580 ] Tilman Hausherr commented on PDFBOX-4669: - OK, got... so yes, these are equal, and yes, we'd need an equals(). The removeAll should have a javadoc hinting at this problem. Which I hope won't occur in production. > Ensure proper functionality of COSArrayList > --- > > Key: PDFBOX-4669 > URL: https://issues.apache.org/jira/browse/PDFBOX-4669 > Project: PDFBox > Issue Type: Sub-task > Components: PDModel >Affects Versions: 2.0.17, 3.0.0 PDFBox >Reporter: Maruan Sahyoun >Assignee: Maruan Sahyoun >Priority: Major > > The current COSArrayList implementation has some glitches as pointed out at > https://stackoverflow.com/questions/45812696/ > In addition when working with {{AnnotationFilter}} as the > adding/update/removal is index based the wron index of the underlying > {{COSArray}} is affected. -- This message was sent by Atlassian Jira (v8.3.4#803005) - To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org
[jira] [Commented] (PDFBOX-4669) Ensure proper functionality of COSArrayList
[ https://issues.apache.org/jira/browse/PDFBOX-4669?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17003626#comment-17003626 ] Maruan Sahyoun commented on PDFBOX-4669: OK - for now I'd do * equals by comparing the dictionaries - which would ensure that we don't keep nested structures in memory and also fail early * hashCode by using the hasCode of the underlying Map which should be as safe as the current default calculation. > Ensure proper functionality of COSArrayList > --- > > Key: PDFBOX-4669 > URL: https://issues.apache.org/jira/browse/PDFBOX-4669 > Project: PDFBox > Issue Type: Sub-task > Components: PDModel >Affects Versions: 2.0.17, 3.0.0 PDFBox >Reporter: Maruan Sahyoun >Assignee: Maruan Sahyoun >Priority: Major > > The current COSArrayList implementation has some glitches as pointed out at > https://stackoverflow.com/questions/45812696/ > In addition when working with {{AnnotationFilter}} as the > adding/update/removal is index based the wron index of the underlying > {{COSArray}} is affected. -- This message was sent by Atlassian Jira (v8.3.4#803005) - To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org
[jira] [Comment Edited] (PDFBOX-4669) Ensure proper functionality of COSArrayList
[ https://issues.apache.org/jira/browse/PDFBOX-4669?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17003599#comment-17003599 ] Maruan Sahyoun edited comment on PDFBOX-4669 at 12/26/19 12:50 PM: --- removeAll/retainAll won't show an issue after the fixes (also need to ensure proper update of the underlying COSArray). Now - I'd also like to implement {{equals}} and {{hashCode}} for {{COSDictionary}} where two dictionaries are equal if their string representation is equal - WDYT? Otherwise we need to put in individual fixes for annotations and similar objects such as fields whereas when adding to COSDictionary there will be less specific code. was (Author: msahyoun): removeAll/retainAll won't show an issue after the fixes (also need to ensure proper update of the underlying COSArray). Now - I'd also like to implement \{equals] and {hashSet} for \{COSDictionary} where two dictionaries are equal if their string representation is equal - WDYT? Otherwise we need to put in individual fixes for annotations and similar objects such as fields whereas when adding to COSDictionary there will be less specific code. > Ensure proper functionality of COSArrayList > --- > > Key: PDFBOX-4669 > URL: https://issues.apache.org/jira/browse/PDFBOX-4669 > Project: PDFBox > Issue Type: Sub-task > Components: PDModel >Affects Versions: 2.0.17, 3.0.0 PDFBox >Reporter: Maruan Sahyoun >Assignee: Maruan Sahyoun >Priority: Major > > The current COSArrayList implementation has some glitches as pointed out at > https://stackoverflow.com/questions/45812696/ > In addition when working with {{AnnotationFilter}} as the > adding/update/removal is index based the wron index of the underlying > {{COSArray}} is affected. -- This message was sent by Atlassian Jira (v8.3.4#803005) - To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org
[jira] [Created] (PDFBOX-4723) Add equals() and hashCode() to PDAnnotation and COSDictionary
Maruan Sahyoun created PDFBOX-4723: -- Summary: Add equals() and hashCode() to PDAnnotation and COSDictionary Key: PDFBOX-4723 URL: https://issues.apache.org/jira/browse/PDFBOX-4723 Project: PDFBox Issue Type: Sub-task Components: PDModel Affects Versions: 2.0.18 Reporter: Maruan Sahyoun Assignee: Maruan Sahyoun Fix For: 2.0.19, 3.0.0 PDFBox In order to proper support removeAll/retainAll for COSArrayList we need to detect if entries are in fact duplicates of others. This currently fails as even though one might add the same instance of an annotation object multiple times to setAnnotations getting the annotations will have individual instances. See the discussion at PDFBOX-4669. In order to proper support removal we need to be able to detect equality where an object is equal if the underlying COSDictionary has the same entries. -- This message was sent by Atlassian Jira (v8.3.4#803005) - To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org
[jira] [Commented] (PDFBOX-4714) The font "Wingdings" can't encode any text
[ https://issues.apache.org/jira/browse/PDFBOX-4714?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17003928#comment-17003928 ] Tilman Hausherr commented on PDFBOX-4714: - The code is correct. The image didn't get through, probably because of the closure. Either reopen the issue, or include the stack trace as text (it is a text, after all!). Also include any other warnings / log messages you get. And don't forget to update to 2.0.18. > The font "Wingdings" can't encode any text > -- > > Key: PDFBOX-4714 > URL: https://issues.apache.org/jira/browse/PDFBOX-4714 > Project: PDFBox > Issue Type: Bug >Affects Versions: 2.0.11 >Reporter: bai yuan >Priority: Major > Attachments: Test.zip > > > The font(c://windows//fonts//wingding.ttf) can encode the text "Stet clita > kasd gubergren", but not in pdfbox. -- This message was sent by Atlassian Jira (v8.3.4#803005) - To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org
[jira] [Commented] (PDFBOX-4714) The font "Wingdings" can't encode any text
[ https://issues.apache.org/jira/browse/PDFBOX-4714?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17003923#comment-17003923 ] bai yuan commented on PDFBOX-4714: -- [~tilman] i change my code to: {code:java} contentStream.showText("\u1F4A7"); {code} it still throw an exception: !image-2019-12-27-14-31-47-100.png! Is there anything wrong with my usage? > The font "Wingdings" can't encode any text > -- > > Key: PDFBOX-4714 > URL: https://issues.apache.org/jira/browse/PDFBOX-4714 > Project: PDFBox > Issue Type: Bug >Affects Versions: 2.0.11 >Reporter: bai yuan >Priority: Major > Attachments: Test.zip > > > The font(c://windows//fonts//wingding.ttf) can encode the text "Stet clita > kasd gubergren", but not in pdfbox. -- This message was sent by Atlassian Jira (v8.3.4#803005) - To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org
[jira] [Commented] (PDFBOX-4714) The font "Wingdings" can't encode any text
[ https://issues.apache.org/jira/browse/PDFBOX-4714?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17003940#comment-17003940 ] bai yuan commented on PDFBOX-4714: -- I'm sorry that the above picture is damaged. I have updated the jar to 2.0.18. The exception information is as follows: Exception in thread "main" java.lang.IllegalArgumentException: No glyph for U+1F4A (Ὂ) in font Wingdings-RegularException in thread "main" java.lang.IllegalArgumentException: No glyph for U+1F4A (Ὂ) in font Wingdings-Regular at org.apache.pdfbox.pdmodel.font.PDCIDFontType2.encode(PDCIDFontType2.java:366) at org.apache.pdfbox.pdmodel.font.PDType0Font.encode(PDType0Font.java:415) at org.apache.pdfbox.pdmodel.font.PDFont.encode(PDFont.java:332) at org.apache.pdfbox.pdmodel.PDPageContentStream.showTextInternal(PDPageContentStream.java:514) at org.apache.pdfbox.pdmodel.PDPageContentStream.showText(PDPageContentStream.java:476) at test.main.main(main.java:34) > The font "Wingdings" can't encode any text > -- > > Key: PDFBOX-4714 > URL: https://issues.apache.org/jira/browse/PDFBOX-4714 > Project: PDFBox > Issue Type: Bug >Affects Versions: 2.0.11 >Reporter: bai yuan >Priority: Major > Attachments: Test.zip > > > The font(c://windows//fonts//wingding.ttf) can encode the text "Stet clita > kasd gubergren", but not in pdfbox. -- This message was sent by Atlassian Jira (v8.3.4#803005) - To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org
[jira] [Commented] (PDFBOX-4714) The font "Wingdings" can't encode any text
[ https://issues.apache.org/jira/browse/PDFBOX-4714?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17003952#comment-17003952 ] Tilman Hausherr commented on PDFBOX-4714: - OK, sorry about that. I can't remember what I did last time, but today I opened the font file with DTL OTMaster 3.7 light, and the droplet is "\uF053", and I tested it. This website has the correct code: [https://www.fileformat.info/info/unicode/font/wingdings/nonunicode.htm] (I hope the others one will be correct too) !image-2019-12-27-08-47-11-383.png! > The font "Wingdings" can't encode any text > -- > > Key: PDFBOX-4714 > URL: https://issues.apache.org/jira/browse/PDFBOX-4714 > Project: PDFBox > Issue Type: Bug >Affects Versions: 2.0.11 >Reporter: bai yuan >Priority: Major > Attachments: Test.zip > > > The font(c://windows//fonts//wingding.ttf) can encode the text "Stet clita > kasd gubergren", but not in pdfbox. -- This message was sent by Atlassian Jira (v8.3.4#803005) - To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org
[jira] [Comment Edited] (PDFBOX-4714) The font "Wingdings" can't encode any text
[ https://issues.apache.org/jira/browse/PDFBOX-4714?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17003952#comment-17003952 ] Tilman Hausherr edited comment on PDFBOX-4714 at 12/27/19 7:47 AM: --- OK, sorry about that. I can't remember what I did last time, but today I opened the font file with DTL OTMaster 3.7 light, and the droplet is "\uF053", and I tested it. This website has the correct code: [https://www.fileformat.info/info/unicode/font/wingdings/nonunicode.htm] (I hope the others one will be correct too) !image-2019-12-27-08-47-42-960.png! was (Author: tilman): OK, sorry about that. I can't remember what I did last time, but today I opened the font file with DTL OTMaster 3.7 light, and the droplet is "\uF053", and I tested it. This website has the correct code: [https://www.fileformat.info/info/unicode/font/wingdings/nonunicode.htm] (I hope the others one will be correct too) !image-2019-12-27-08-47-11-383.png! > The font "Wingdings" can't encode any text > -- > > Key: PDFBOX-4714 > URL: https://issues.apache.org/jira/browse/PDFBOX-4714 > Project: PDFBox > Issue Type: Bug >Affects Versions: 2.0.11 >Reporter: bai yuan >Priority: Major > Attachments: Test.zip, image-2019-12-27-08-47-42-960.png > > > The font(c://windows//fonts//wingding.ttf) can encode the text "Stet clita > kasd gubergren", but not in pdfbox. -- This message was sent by Atlassian Jira (v8.3.4#803005) - To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org
[jira] [Reopened] (PDFBOX-4714) The font "Wingdings" can't encode any text
[ https://issues.apache.org/jira/browse/PDFBOX-4714?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Tilman Hausherr reopened PDFBOX-4714: - > The font "Wingdings" can't encode any text > -- > > Key: PDFBOX-4714 > URL: https://issues.apache.org/jira/browse/PDFBOX-4714 > Project: PDFBox > Issue Type: Bug >Affects Versions: 2.0.11 >Reporter: bai yuan >Priority: Major > Attachments: Test.zip, image-2019-12-27-08-47-42-960.png > > > The font(c://windows//fonts//wingding.ttf) can encode the text "Stet clita > kasd gubergren", but not in pdfbox. -- This message was sent by Atlassian Jira (v8.3.4#803005) - To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org