Hi Tilman, I am trying to create a document with javascript added to COSName.AA object.
Any suggestions would be appreciated. Thanks, Kodjo On 23/07/2019, 22:13, "Kodjo Afriyie - iSite Eng" <kodjo.afriyi...@bbc.co.uk> wrote: >Hi Tilman: > >I finally manage to get the following to work: > > > PDPageTree pages = document.getPages(); > > > int pageCount = pages.getCount(); > > for(int i=0; i < pageCount; i++) { > pages.get(i).getCOSObject().removeItem(COSName.AA); > > } > >Thanks again for your assisance. > >Kodjo > >________________________________________ >From: Kodjo Afriyie - iSite Eng [kodjo.afriyi...@bbc.co.uk] >Sent: 23 July 2019 20:40 >To: users@pdfbox.apache.org >Subject: RE: Problems accessing javascript: > >Hi Tilman: > >Will install ubuntu on virtual box.. to see if I can't view the files in >PDFDebugger.. unfortunately as soon as i copy it onto my hardrive sopho's >delete its.. > >Thanks, >Kodjo >________________________________________ >From: Kodjo Afriyie - iSite Eng >Sent: 23 July 2019 20:37 >To: users@pdfbox.apache.org >Subject: RE: Problems accessing javascript: > >Hi Tilman: > >This contains the files re-named with .txt extension and placed in a zip >file. > >https://1drv.ms/u/s!AmNEMt7g6KbuhiLACsvRe4bcHogB?e=bNRew0 > >I tried the following: > COSObject name = >document.getDocument().getObjectByType(COSName.AA); > System.out.println("AA:"+name); >Which printed null.. > >Then I tried the following which also printed null: > >Which also printed null: > COSObject pagess = >document.getDocument().getObjectByType(COSName.PAGES); > COSBase name = pagess.getDictionaryObject(COSName.AA); > System.out.println("AA:"+name); > >Kodjo >________________________________________ >From: Tilman Hausherr [thaush...@t-online.de] >Sent: 23 July 2019 19:05 >To: users@pdfbox.apache.org >Subject: Re: Problems accessing javascript: > >Hi, > >If you get the dictionary, you could call >COSDictionary.removeItem(COSName.O), or do the same with the AA element. > >To get the dictionary from an element, usually .getCOSObject() delivers. > >To get a better look at the structure of a PDF, try PDFDebugger. > >Like I said, rename the PDF to .TXT and put that one into a ZIP and >upload that one. This way one could have a look without an antivirus >blocking it. > >Tilman > >Am 23.07.2019 um 16:44 schrieb Kodjo Afriyie - iSite Eng: >> >> I have tried all the possible ways but i can not remove the javascript >> element: >> >> >> *PDF Comment '%PDF-1.5\n'* >> * >> * >> *PDF Comment '%öäüß\n'* >> * >> * >> *obj 1 0* >> * Type: /Catalog* >> * Referencing: 2 0 R, 3 0 R, 4 0 R, 5 0 R* >> * >> * >> * <<* >> * /Type /Catalog* >> * /Outlines 2 0 R* >> * /Pages 3 0 R* >> * /Names 4 0 R* >> * /AA 5 0 R* >> * >>* >> * >> * >> * >> * >> *obj 6 0* >> * Type:* >> * Referencing:* >> * >> * >> * <<* >> * >>* >> * >> * >> * >> * >> *obj 2 0* >> * Type: /Outlines* >> * Referencing:* >> * >> * >> * <<* >> * /Type /Outlines* >> * /Count 0* >> * >>* >> * >> * >> * >> * >> *obj 3 0* >> * Type: /Pages* >> * Referencing: 7 0 R* >> * >> * >> * <<* >> * /Type /Pages* >> * /Kids [7 0 R]* >> * /Count 1* >> * >>* >> * >> * >> * >> * >> *obj 4 0* >> * Type:* >> * Referencing:* >> * >> * >> * <<* >> * >>* >> * >> * >> * >> * >> *obj 5 0* >> * Type:* >> * Referencing:* >> * >> * >> * <<* >> * >>* >> * >> * >> * >> * >> *obj 7 0* >> * Type: /Page* >> * Referencing: 3 0 R, 8 0 R* >> * >> * >> * <<* >> * /Type /Page* >> * /Parent 3 0 R* >> * /MediaBox [184 105 295 275]* >> * /AA* >> * <<* >> * /O* >> * <<* >> * /JS 8 0 R* >> * /S /JavaScript* >> * >>* >> * >>* >> * >>* > > > >--------------------------------------------------------------------- >To unsubscribe, e-mail: users-unsubscr...@pdfbox.apache.org >For additional commands, e-mail: users-h...@pdfbox.apache.org > > >--------------------------------------------------------------------- >To unsubscribe, e-mail: users-unsubscr...@pdfbox.apache.org >For additional commands, e-mail: users-h...@pdfbox.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@pdfbox.apache.org For additional commands, e-mail: users-h...@pdfbox.apache.org