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 70268C0CC for ; Tue, 11 Jun 2013 11:45:19 +0000 (UTC) Received: (qmail 63283 invoked by uid 500); 11 Jun 2013 11:45:19 -0000 Delivered-To: apmail-pdfbox-users-archive@pdfbox.apache.org Received: (qmail 63018 invoked by uid 500); 11 Jun 2013 11:45:16 -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 62996 invoked by uid 99); 11 Jun 2013 11:45:15 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Jun 2013 11:45:15 +0000 X-ASF-Spam-Status: No, hits=0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE X-Spam-Check-By: apache.org Received-SPF: error (nike.apache.org: local policy) Received: from [81.169.146.161] (HELO mo-p00-ob.rzone.de) (81.169.146.161) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Jun 2013 11:45:09 +0000 X-RZG-AUTH: :LWIAZ0WpaN8UY5o8XRz0jOyrHsdEC+nAE10OdySrgHL6ku8V1wBZiT5FHwxl X-RZG-CLASS-ID: mo00 Received: from [192.168.1.12] (dslb-088-077-238-179.pools.arcor-ip.net [88.77.238.179]) by smtp.strato.de (josoe mo42) (RZmta 31.27 DYNA|AUTH) with ESMTPA id J0765dp5BAtuPw for ; Tue, 11 Jun 2013 13:44:28 +0200 (CEST) Message-ID: <51B70D9C.8030900@lehmi.de> Date: Tue, 11 Jun 2013 13:44:28 +0200 From: Andreas Lehmkuehler User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130514 Thunderbird/17.0.6 MIME-Version: 1.0 To: users@pdfbox.apache.org Subject: Re: Extract Embedded files from pdf using pdfbox in .NET application References: <51B5DA47.3020201@lehmi.de> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Checked: Checked by ClamAV on apache.org Am 11.06.2013 07:06, schrieb Ramesh Shrestha: > Thanks, > > The java example link i provided should have been - > http://svn.apache.org/repos/asf/pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/pdmodel/ExtractEmbeddedFiles.java > > But your suggestion WORKS. > > Now i am able to extract the attached file located in the *attachments tab*but > *haven't been able to extract the attached file located in page*. I am > getting null efTree in this case. > > PDDocumentNameDictionary namesDictionary = new > PDDocumentNameDictionary(pdfDoc.getDocumentCatalog()); > PDEmbeddedFilesNameTreeNode *efTree *= > namesDictionary.getEmbeddedFiles(); > > So now working on it. Embedded files are always document related. If an embedded file is referenced on a single page a file attachment annotation is used. Try something like this to get all annotations of a single page: List annotations = page.getAnnotations(); The one you are looking for has to be an instance of the class org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationFileAttachment. > On Mon, Jun 10, 2013 at 7:38 PM, Andreas Lehmkuehler wrote: > >> Hi, >> >> Am 10.06.2013 11:22, schrieb Ramesh Shrestha: >> >> Hi, >>> >>> >>> I am developing .NET Application using pdfbox to extract metadata, >>> content and attached file from PDF. >>> >>> I was able to extract metadata and content, but stuck while extracting >>> attached/embedded files. >>> >>> I have a pdf with embedded/attached doc file and want to retrieve that >>> file. I have gone through the java example - >>> http://www.docjar.com/html/**api/org/apache/pdfbox/**examples/pdmodel/** >>> EmbeddedFiles.java.html >>> . >>> >>> But while trying to use it in .Net, i got "non generic type >>> 'java.util.Map' >>> cannot be used with type arguments" in the following code snippet >>> >>> java.util.Map names = efTree.getNames(); >>> >>> So, i will be grateful if anybody help me to extract the file from pdf. >>> >> I'm not a .NET expert and don't know what may cause that issue. But maybe >> it is >> a good idea to just omit the generics and try something like this: >> >> java.util.Map names = efTree.getNames(); >> >> Thanks in advance. >>> >> >> HTH >> Andreas Lehmk�hler BR Andreas Lehmk�hler