From users-return-11883-archive-asf-public=cust-asf.ponee.io@pdfbox.apache.org Wed Jul 24 16:10:48 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id 3F6C918025F for ; Wed, 24 Jul 2019 18:10:48 +0200 (CEST) Received: (qmail 96245 invoked by uid 500); 24 Jul 2019 16:10:46 -0000 Mailing-List: contact users-help@pdfbox.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@pdfbox.apache.org Delivered-To: mailing list users@pdfbox.apache.org Received: (qmail 96223 invoked by uid 99); 24 Jul 2019 16:10:46 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 24 Jul 2019 16:10:46 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 04FC8C018A for ; Wed, 24 Jul 2019 16:10:46 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.806 X-Spam-Level: * X-Spam-Status: No, score=1.806 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, KAM_SHORT=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-ec2-va.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id GM5oMaW9Gx4m for ; Wed, 24 Jul 2019 16:10:43 +0000 (UTC) Received-SPF: None (mailfrom) identity=mailfrom; client-ip=194.25.134.17; helo=mailout02.t-online.de; envelope-from=thausherr@t-online.de; receiver= Received: from mailout02.t-online.de (mailout02.t-online.de [194.25.134.17]) by mx1-ec2-va.apache.org (ASF Mail Server at mx1-ec2-va.apache.org) with ESMTPS id C1076BC781 for ; Wed, 24 Jul 2019 16:10:42 +0000 (UTC) Received: from fwd35.aul.t-online.de (fwd35.aul.t-online.de [172.20.27.145]) by mailout02.t-online.de (Postfix) with SMTP id E181341AF9C0 for ; Wed, 24 Jul 2019 18:10:35 +0200 (CEST) Received: from [192.168.2.111] (rfZIavZBQhgCtE78AwHvUa-JdJwnzAcPgWgL0jGM6uAsa0aXQwE4vnhXuiGGGywwxe@[84.151.177.203]) by fwd35.t-online.de with (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384 encrypted) esmtp id 1hqJqc-2e4QEK0; Wed, 24 Jul 2019 18:10:34 +0200 Subject: Re: Problems accessing javascript: To: users@pdfbox.apache.org References: <3A47DB0C4FC4F049951786771F2F79755CEDD723@bgb01xud1008> <412c4837-a732-8788-eed6-88f477ef7fdb@t-online.de> <3A47DB0C4FC4F049951786771F2F79755CEDD79B@bgb01xud1008> <3A47DB0C4FC4F049951786771F2F79755CEDD7A9@bgb01xud1008> <3A47DB0C4FC4F049951786771F2F79755CEDD7B9@bgb01xud1008> From: Tilman Hausherr Message-ID: Date: Wed, 24 Jul 2019 18:10:33 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-ID: rfZIavZBQhgCtE78AwHvUa-JdJwnzAcPgWgL0jGM6uAsa0aXQwE4vnhXuiGGGywwxe X-TOI-MSGID: f07c2b5e-97d2-4eae-9a47-fbad99852da1 So first you wanted to remove the Javascript, now you want to add some? Where do you want to add it? In a field, when opening the PDF, on an annotation? There are several examples in the examples subproject in the source code download - FieldTriggers.java - UpdateFieldOnDocumentOpen.java - AddJavascript.java Tilman Am 24.07.2019 um 12:23 schrieb Kodjo Afriyie - iSite Eng: > 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" > 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.afriyie01@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 [THausherr@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-unsubscribe@pdfbox.apache.org >> For additional commands, e-mail: users-help@pdfbox.apache.org >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org >> For additional commands, e-mail: users-help@pdfbox.apache.org >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org > For additional commands, e-mail: users-help@pdfbox.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org For additional commands, e-mail: users-help@pdfbox.apache.org