Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 60 additions & 3 deletions src/main/Mail/FormMailAddress.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public enum FormMailAddress {
"New Castle",
"PA",
"16103",
BigDecimal.ZERO,
BigDecimal.valueOf(20.0),
ImmutableSet.of("PA"),
ImmutableSet.of("ANY")),
PA_DRIVERS_LICENSE(
Expand All @@ -28,7 +28,7 @@ public enum FormMailAddress {
"Harrisburg",
"PA",
"17106",
BigDecimal.valueOf(40.0),
BigDecimal.valueOf(42.5),
ImmutableSet.of("PA"),
ImmutableSet.of("ANY")),
PA_VOTER_REGISTRATION_PHIL(
Expand Down Expand Up @@ -108,7 +108,64 @@ public enum FormMailAddress {
"11375",
BigDecimal.ZERO,
ImmutableSet.of("NY"),
ImmutableSet.of("Queens"));
ImmutableSet.of("Queens")),

FL_BIRTH_CERTIFICATE(
"FL Birth Certificate.pdf",
"Birth Certificate Address for Florida",
"FLORIDA DEPARTMENT OF HEALTH BUREAU OF VITAL STATISTICS",
"VITAL STATISTICS",
"P.O. BOX 210",
"",
"JACKSONVILLE",
"FL",
"32231-0042",
BigDecimal.valueOf(10.0),
ImmutableSet.of("FL"),
ImmutableSet.of("ANY")),

OH_BIRTH_CERTIFICATE(
"OH Birth Certificate.pdf",
"Birth Certificate Address for Ohio",
"Ohio Department of Health Vital Statistics",
"Bureau of Vital Statistics",
"P.O. Box 15098 ",
"",
"Columbus",
"OH",
"43215-0098",
BigDecimal.valueOf(21.50),
ImmutableSet.of("OH"),
ImmutableSet.of("ANY")),

TX_BIRTH_CERTIFICATE(
"TX Birth Certificate.pdf",
"Birth Certificate Address for Texas",
"DSHS - VSS",
"DSHS – Vital Statistics",
"P.O. Box 12040",
"",
"Austin",
"TX",
"78711-2040",
BigDecimal.valueOf(22.0),
ImmutableSet.of("TX"),
ImmutableSet.of("ANY")),

MD_BIRTH_CERTIFICATE(
"MD Birth Certificate.pdf",
"Birth Certificate Address for Maryland",
"Maryland Department of Health",
" DIVISION OF VITAL RECORDS",
"P.O. Box 68760",
"",
"Baltimore",
"MD",
"21215-0036",
BigDecimal.valueOf(10.0),
ImmutableSet.of("MD"),
ImmutableSet.of("ANY"))
;

private String name;
private String description;
Expand Down
45 changes: 18 additions & 27 deletions src/main/PDF/Services/V2Services/FillPDFServiceV2.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
import Validation.ValidationUtils;
import java.io.*;
import java.security.GeneralSecurityException;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import org.apache.pdfbox.Loader;
import org.apache.pdfbox.pdmodel.PDDocument;
Expand Down Expand Up @@ -95,9 +97,9 @@ public Message checkFillConditions() {
if (!ValidationUtils.isValidObjectId(fileId) || formAnswers == null) {
return PdfMessage.INVALID_PARAMETER;
}
if (signatureStream == null) {
return PdfMessage.SERVER_ERROR;
}
// if (signatureStream == null) {
// return PdfMessage.SERVER_ERROR;
// }
if (privilegeLevel == null) {
return PdfMessage.INVALID_PRIVILEGE_TYPE;
}
Expand All @@ -107,29 +109,6 @@ public Message checkFillConditions() {
return null;
}

// public void fillInSignature(PDSignatureField signatureField) throws IOException {
// PDVisibleSignDesigner visibleSignDesigner = new PDVisibleSignDesigner(this.signatureStream);
// visibleSignDesigner.zoom(0);
// PDVisibleSigProperties visibleSigProperties =
// new PDVisibleSigProperties()
// .visualSignEnabled(true)
// .setPdVisibleSignature(visibleSignDesigner);
// visibleSigProperties.buildSignature();
//
// SignatureOptions signatureOptions = new SignatureOptions();
// signatureOptions.setVisualSignature(visibleSigProperties.getVisibleSignature());
//
// PDSignature signature = new PDSignature();
// signature.setFilter(PDSignature.FILTER_ADOBE_PPKLITE);
// signature.setSubFilter(PDSignature.SUBFILTER_ADBE_PKCS7_DETACHED);
// signature.setName(username);
// signature.setSignDate(Calendar.getInstance());
//
// signatureField.setValue(signature);
//
// this.pdfDocument.addSignature(signature, signatureOptions);
// }

public void setPDFFieldsFromFormQuestions(List<FormQuestion> formQuestions, PDAcroForm acroForm)
throws IOException {
List<FormQuestion> filledFormBodyQuestions = new LinkedList<>();
Expand Down Expand Up @@ -189,6 +168,16 @@ public void setPDFFieldsFromFormQuestions(List<FormQuestion> formQuestions, PDAc
}
filledFormBodyQuestions.add(filledFormNewQuestion);
}

// Set Current Date
PDField currentDateField = acroForm.getField("currentDate");
if (currentDateField != null) {
LocalDate currentDate = LocalDate.now();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MM/dd/yyyy");
String formattedCurrentDate = currentDate.format(formatter);
currentDateField.setValue(formattedCurrentDate);
}

this.filledFormBody =
new FormSection(
this.templateForm.getBody().getTitle(),
Expand All @@ -211,7 +200,9 @@ public Message mergeFileAndFormQuestions(
}
try {
setPDFFieldsFromFormQuestions(formQuestions, acroForm);
signPDF();
if (this.signatureStream != null) {
signPDF();
}

this.filledFileOutputStream = new ByteArrayOutputStream();
this.pdfDocument.save(this.filledFileOutputStream);
Expand Down