Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 0CBAD200B40 for ; Fri, 1 Jul 2016 11:16:50 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 0B321160A61; Fri, 1 Jul 2016 09:16:50 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 2F4C7160A5D for ; Fri, 1 Jul 2016 11:16:49 +0200 (CEST) Received: (qmail 70863 invoked by uid 500); 1 Jul 2016 09:16:43 -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 70850 invoked by uid 99); 1 Jul 2016 09:16:42 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 01 Jul 2016 09:16:42 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 33DEE1A0ADB for ; Fri, 1 Jul 2016 09:16:42 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.279 X-Spam-Level: * X-Spam-Status: No, score=1.279 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd2-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=tibco-support-com.20150623.gappssmtp.com Received: from mx2-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id LHjggsVzwDRU for ; Fri, 1 Jul 2016 09:16:39 +0000 (UTC) Received: from mail-oi0-f54.google.com (mail-oi0-f54.google.com [209.85.218.54]) by mx2-lw-eu.apache.org (ASF Mail Server at mx2-lw-eu.apache.org) with ESMTPS id DEEA75FB01 for ; Fri, 1 Jul 2016 09:16:37 +0000 (UTC) Received: by mail-oi0-f54.google.com with SMTP id u201so102625235oie.0 for ; Fri, 01 Jul 2016 02:16:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tibco-support-com.20150623.gappssmtp.com; s=20150623; h=mime-version:from:date:message-id:subject:to; bh=oJt1Kr67SFO3iyDoeaVnH7pfFZtcq6XWcfjTEr5oD/I=; b=W3hIuq6znzKT/looOIyCoCMxyEzbi73u1VIEVThAHJ4+oasazmISRTIjCG1qzb9LbG NvDpNPY+cF0z0R3SBjxVrOzqTFWy3I7wug5UXqeok8hjFZ/1IgUA8KOh+bMCo3w8oFmz ip64zyZIjYagdkJF1ShkOIMo/iuA2/j0+DHj0BluZmI+rhTtPMvU/rkkSAVz4ZhRHXgg 9SlsTFSG2miDvZcN0G5BEnN025xJUyMri0u5LNmh05nm4q7ilF4UBQNa/7hy9eHNugdR 6siA/cIVBmiqgtTsHESpIV5zruYubPlitj2+tjnNLpEInJ8rKZX2fOMKiLeo7IMoPPdj Fqvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=oJt1Kr67SFO3iyDoeaVnH7pfFZtcq6XWcfjTEr5oD/I=; b=Jn3EgWRT9hPqakLlrH4wuRrctMlxF7kaODC79Oa0RUQWM09qMmrWeA22nZsQLf0sKz VvifNNsY/QfLJzfICaJEaLsbPM/Byw3ACBKrAWfshMTX173bLxYo9aEhezf2OOgp2E6E 8QbKr7yd1ixlUScyi5pEdBWh8b+KV2AOmNf1qHY9Dt+hhk8ifek0+yxL+0lQRXixOnkA b0084KImgvA3GU9cMaXtwylkuWQPTT/kgzSIRkHlEuwmp/W2vZDOEJoR/ahOZTBNOtsY QSiJPhYU4m+39Y+oHEIn/HQ4zDXAtUgJSfTvrK0Avwvtx7m+bp3EvCIkpTEJVK1CZNKx Xj1g== X-Gm-Message-State: ALyK8tJKNpr/PlE3WaCHWStyjCUBUnv0IYvQSNcoRQXlE02Mg0xbl32CgoDBkoQgMzWGdCyUEWDfIBW6RZOz8zq0 X-Received: by 10.202.83.9 with SMTP id h9mr12659941oib.25.1467364596259; Fri, 01 Jul 2016 02:16:36 -0700 (PDT) MIME-Version: 1.0 Received: by 10.157.36.73 with HTTP; Fri, 1 Jul 2016 02:16:15 -0700 (PDT) From: "Barry Zhao [Zhao]" Date: Fri, 1 Jul 2016 17:16:15 +0800 Message-ID: Subject: About decrypt pdf using pdfbox 2.0.1 To: users@pdfbox.apache.org Content-Type: multipart/mixed; boundary=001a113d2ae884a1de05368f7190 archived-at: Fri, 01 Jul 2016 09:16:50 -0000 --001a113d2ae884a1de05368f7190 Content-Type: multipart/alternative; boundary=001a113d2ae884a1d905368f718e --001a113d2ae884a1d905368f718e Content-Type: text/plain; charset=UTF-8 Hello team, I found a weird thing when upgrading pdfbox from 1.8.7 to 2.0.1. Here is my scenario below. I used a pdf template which was encrypted. And my code is like below. *import java.io.File;* *import java.io.IOException;* *import java.util.List;* *import javax.xml.parsers.ParserConfigurationException;* *import org.apache.pdfbox.pdmodel.PDDocument;* *import org.apache.pdfbox.pdmodel.PDDocumentCatalog;* *import org.apache.pdfbox.pdmodel.interactive.form.PDAcroForm;* *import org.apache.pdfbox.pdmodel.interactive.form.PDField;* *import org.xml.sax.SAXException;* *public class Testpdf9 {* * public static void main(String[] args) throws IOException, ParserConfigurationException, SAXException {* * String file = "E:\\pdf_issues\\Items\\samplepdfread1.pdf";* * PDDocument doc = PDDocument.load(new File(file));* * PDDocumentCatalog catalog = doc.getDocumentCatalog();* * PDAcroForm form = catalog.getAcroForm();* * List fields = form.getFields();* * for(int i=0;i
Hello team,

I found a weird thing when upgrading pdfbox fr= om 1.8.7 to 2.0.1.

Here is my scenario below.

I used a pdf templa= te which was encrypted. And my code is like below.

import java.io.File;
import= java.io.IOException;
import java.util.List;<= /div>
import javax.xml.parsers.ParserConfigurationException;
import org.apache.pdfbox.pdmodel.PDDocument;
impo= rt org.apache.pdfbox.pdmodel.PDDocumentCatalog;
import = org.apache.pdfbox.pdmodel.interactive.form.PDAcroForm;
i= mport org.apache.pdfbox.pdmodel.interactive.form.PDField;
<= div class=3D"gmail_default" style=3D""><= i>import org.xml.sax.SAXException;

=
= public class Testpdf9 {

public static void main(Strin= g[] args) throws IOException, ParserConfigurationException, SAXException {<= /i>
Stri= ng file =3D "E:\\pdf_issues\\Items\\samplepdfread1.pdf";
PDDocument d= oc =3D PDDocument.load(new File(file));
PDDocumentCatalog catalog =3D doc.getDo= cumentCatalog();
PDAcroForm form =3D catalog.getAcroForm();
= List fields =3D form.ge= tFields();
= for(int i=3D0;i<fields.size();i++){
Object field =3D fields.get(i);<= /i>
Sys= tem.out.println(((PDField)field).getFullyQualifiedName());
=
= System.out.println(= field.getClass().getSimpleName());
}
doc.close();
}
}

1. If I use PDFBox 1.8.7, then I will get th= e messy code of the form field names.
2. If I use PDFBox 2.0.1, then I will get the right name of t= he form fields.
3. If I = use PDFBox 1.8.7, then I must modify my code to decrypt the pdf and then I = can get the right names. While changing to PDFBox 2.0.1, I don't need t= o do additional change.
=
You can run my code= by using my attaching file. The password is abcd.

So above all, my question is that, is this an issue in PDFBox 2.0.1= ? Or some other reasons?

Please let me know= your reply. Thank you in advance.


--
Best Regards,
Barry
--001a113d2ae884a1d905368f718e-- --001a113d2ae884a1de05368f7190 Content-Type: text/plain; charset=us-ascii --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org For additional commands, e-mail: users-help@pdfbox.apache.org --001a113d2ae884a1de05368f7190--