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