Skip to content

Commit

Permalink
added support for PDF form templates. close #37
Browse files Browse the repository at this point in the history
  • Loading branch information
j-dimension committed Oct 10, 2024
1 parent 0a46c92 commit bdb9da3
Show file tree
Hide file tree
Showing 2 changed files with 953 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -728,6 +728,7 @@ public class LibreOfficeAccess {
private static final Logger log = Logger.getLogger(LibreOfficeAccess.class.getName());
private static final String ERROR_MAYBE_HEADLESS = "Failure setting content of table cell - when running on a headless Linux system, please install xvfb libxext6 libxi6 libxtst6 libxrender1 libongoft2-1.0.0";
private static final String EXT_DOCX = ".docx";
private static final String EXT_PDF = ".pdf";

public static void mergeDocuments(String intoDocument, String mergeDocument) throws Exception {
// note: intoDocument is just an ID as filename, does not have an .odt / .docx extension
Expand Down Expand Up @@ -1528,6 +1529,8 @@ public static void setPlaceHolders(String caseId, String fileInFileSystem, Strin
outputOds.close();
} else if (fileName.toLowerCase().endsWith(EXT_DOCX)) {
MicrosoftOfficeAccess.setPlaceHolders(caseId, fileInFileSystem, fileName, values, formsPrefixes);
} else if (fileName.toLowerCase().endsWith(EXT_PDF)) {
PdfFormsAccess.setPlaceHolders(caseId, fileInFileSystem, fileName, values, formsPrefixes);
}

}
Expand Down Expand Up @@ -1665,6 +1668,10 @@ public static java.util.List<String> getPlaceHolders(String file, List<String> a
HashMap<Integer, CTR> tfCache = new HashMap<>();
return new ArrayList(MicrosoftOfficeAccess.getPlaceHolders(file, allPartyTypesPlaceHolders, formsPlaceHolders, tfCache));

} else if (file.toLowerCase().endsWith(EXT_PDF)) {

return new ArrayList(PdfFormsAccess.getPlaceHolders(file, allPartyTypesPlaceHolders, formsPlaceHolders));

}

return new ArrayList<>();
Expand Down
Loading

0 comments on commit bdb9da3

Please sign in to comment.