You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Tilman Hausherr (JIRA)" <ji...@apache.org> on 2014/06/09 21:39:01 UTC
[jira] [Resolved] (PDFBOX-54) please correct the SetField example
[ https://issues.apache.org/jira/browse/PDFBOX-54?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Tilman Hausherr resolved PDFBOX-54.
-----------------------------------
Resolution: Fixed
Fix Version/s: 2.0.0
1.8.6
Assignee: Tilman Hausherr
I took the code from the PrintFields example and inserted it here so that users get an error message. Done in http://svn.apache.org/r1601489 for the trunk and http://svn.apache.org/r1601490 for the 1.8 branch.
> please correct the SetField example
> -----------------------------------
>
> Key: PDFBOX-54
> URL: https://issues.apache.org/jira/browse/PDFBOX-54
> Project: PDFBox
> Issue Type: Bug
> Components: Writing
> Affects Versions: 1.8.5, 1.8.6, 2.0.0
> Assignee: Tilman Hausherr
> Fix For: 1.8.6, 2.0.0
>
>
> [imported from SourceForge]
> http://sourceforge.net/tracker/index.php?group_id=78314&atid=552832&aid=1182270
> Originally submitted by nobody on 2005-04-13 07:51.
> Hi, at last I understand what is wrong with
> org.pdfbox.examples.fdf.setField example - my file is
> encripted but there wasn't code for decryption :) please
> add it there for the other developers.
> Ilya
> private void setField( String[] args ) throws
> IOException, COSVisitorException
> {
> PDDocument pdf = null;
> try
> {
> if( args.length != 3 )
> {
> usage();
> }
> else
> {
> SetField example = new SetField();
> pdf = PDDocument.load( args[0] );
> PrintFields exporter = new PrintFields();
> if( pdf.isEncrypted() )
> {
> try
> {
> pdf.decrypt( "" );
> }
> catch ( CryptographyException e ) {
> System.err.println( "Error: The
> document is encrypted." );
> usage();
> }
> catch( InvalidPasswordException e ) {
> System.err.println( "Error: The
> document is encrypted." );
> usage();
> }
> }
> example.setField( pdf, args[1], args[2] );
> pdf.save( args[0] );
> }
> }
> finally
> {
> if( pdf != null )
> {
> pdf.close();
> }
> }
> }
--
This message was sent by Atlassian JIRA
(v6.2#6252)