Return-Path: X-Original-To: apmail-pdfbox-users-archive@www.apache.org Delivered-To: apmail-pdfbox-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B81937893 for ; Fri, 9 Dec 2011 17:39:46 +0000 (UTC) Received: (qmail 73026 invoked by uid 500); 9 Dec 2011 17:39:46 -0000 Delivered-To: apmail-pdfbox-users-archive@pdfbox.apache.org Received: (qmail 73013 invoked by uid 500); 9 Dec 2011 17:39: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 72983 invoked by uid 99); 9 Dec 2011 17:39:46 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 09 Dec 2011 17:39:46 +0000 X-ASF-Spam-Status: No, hits=0.2 required=5.0 tests=ASF_LIST_OPS,HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [67.211.127.46] (HELO exchange.thoughtcorp.com) (67.211.127.46) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 09 Dec 2011 17:39:40 +0000 Received: from exchange.thoughtcorp.com ([10.10.10.7]) by exchange.thoughtcorp.com ([10.10.10.7]) with mapi; Fri, 9 Dec 2011 12:39:18 -0500 From: Haris Javaid To: "users-digest-subscribe@pdfbox.apache.org" , "users@pdfbox.apache.org" , "users-help@pdfbox.apache.org" Date: Fri, 9 Dec 2011 12:39:11 -0500 Subject: Need help with Overlay for Layout pages Thread-Topic: Need help with Overlay for Layout pages Thread-Index: Acy2mXZrUrS8DS8cSJidcPPVNL/BdA== Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US Content-Type: multipart/alternative; boundary="_000_A39DDA4820D293429E7F87DB08186A0008FA4B95exchangethought_" MIME-Version: 1.0 --_000_A39DDA4820D293429E7F87DB08186A0008FA4B95exchangethought_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hello there, We are working on a product that supports highlighting PDF documents. We re= cently came across a situation where when trying to highlight a pdf that w= as converted into a PDF from word by some third part library, threw Unsuppo= rtedOperationException. It happened in Overlay.java. private void collectLayoutPages( List pages) throws IOException { Iterator pagesIter =3D pages.iterator(); while( pagesIter.hasNext() ) { PDPage page =3D (PDPage)pagesIter.next(); COSBase contents =3D page.getCOSDictionary().getDictionaryObjec= t( COSName.CONTENTS ); PDResources resources =3D page.findResources(); if( resources =3D=3D null ) { resources =3D new PDResources(); page.setResources( resources ); } COSDictionary res =3D resources.getCOSDictionary(); if( contents instanceof COSStream ) { COSStream stream =3D (COSStream) contents; Map objectNameMap =3D new TreeMap(); stream =3D makeUniqObjectNames(objectNameMap, stream); layoutPages.add(new LayoutPage(stream, res, objectNameMap))= ; } else if( contents instanceof COSArray ) { throw new UnsupportedOperationException("Layout pages with = COSArray currently not supported."); // layoutPages.add(new LayoutPage(contents, res)); } else { throw new IOException( "Contents are unknown type:" + conte= nts.getClass().getName() ); } } } Below is the exception: ava.lang.UnsupportedOperationException: Layout pages with COSArray currentl= y not supported. at org.apache.pdfbox.Overlay.collectLayoutPages(Overlay.java:269) at org.apache.pdfbox.Overlay.overlay(Overlay.java:224) at com.thoughtcorp.annotation.AnnotatedFile.applyAnnotationsToPDF(Ann= otatedFile.java:54) at com.thoughtcorp.services.SyncAnnotationsService.syncAnnotations(Sy= ncAnnotationsService.java:26) at com.thoughtcorp.SyncRequestHandler.handle(SyncRequestHandler.java:= 60) at org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.ja= va:47) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrap= per.java:110) at org.eclipse.jetty.server.Server.handle(Server.java:346) at org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnecti= on.java:589) at org.eclipse.jetty.server.HttpConnection$RequestHandler.content(Htt= pConnection.java:1065) at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:823) at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:2= 20) at org.eclipse.jetty.server.HttpConnection.handle(HttpConnection.java= :411) at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChanne= lEndPoint.java:535) at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannel= EndPoint.java:40) at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadP= ool.java:529) at java.lang.Thread.run(Thread.java:662) Can you please ask the developer who worked on the code highlighted above w= as it not implemented coz it required a lot of work or was it coz he though= t the functionality would not be required by many people? We were thinking = if we could just implement LayoutPage.java to take in COSArray and operate = on it. Would it be too hard to implement to support our solution? Another a= pproach was to convert COSArray into COSStream so the code always catches i= f block. We are currently trying to meet a deadline and this has become a road block= er for us. Any help in this matter would be really appreciated! Thanks, Haris --_000_A39DDA4820D293429E7F87DB08186A0008FA4B95exchangethought_--