()
| 73 | } |
| 74 | |
| 75 | public Integer call() |
| 76 | { |
| 77 | try (PDDocument pdf = Loader.loadPDF(infile)) |
| 78 | { |
| 79 | PDAcroForm form = pdf.getDocumentCatalog().getAcroForm(); |
| 80 | if( form == null ) |
| 81 | { |
| 82 | SYSERR.println( "Error: This PDF does not contain a form." ); |
| 83 | return 1; |
| 84 | } |
| 85 | else |
| 86 | { |
| 87 | if (outfile == null) |
| 88 | { |
| 89 | String outPath = FilenameUtils.removeExtension(infile.getAbsolutePath()) + ".fdf"; |
| 90 | outfile = new File(outPath); |
| 91 | } |
| 92 | try (FDFDocument fdf = form.exportFDF()) |
| 93 | { |
| 94 | fdf.save( outfile ); |
| 95 | } |
| 96 | } |
| 97 | } |
| 98 | catch (IOException ioe) |
| 99 | { |
| 100 | SYSERR.println( "Error exporting FDF data [" + ioe.getClass().getSimpleName() + "]: " + ioe.getMessage()); |
| 101 | return 4; |
| 102 | } |
| 103 | return 0; |
| 104 | } |
| 105 | } |
nothing calls this directly
no test coverage detected