Class PdfMedicationCardGenerator
java.lang.Object
org.projecthusky.fhir.emed.ch.epr.narrative.pdf.PdfMedicationCardGenerator
- Direct Known Subclasses:
ChEmedEprPdfMedicationCardGenerator,EMediplanPdfMedicationCardGenerator
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final Stringprotected final HtmlNarrativeGeneratorThe generator HTML narrative.protected final OpenHtmlToPdfAConverterThe converter of HTML to PDF/A.protected final PdfA12ValidatorThe validator of PDF documents to conformance level A-1 and A-2.protected final SoftwareProviderMetadataprotected final StringThe custom template content. -
Constructor Summary
ConstructorsConstructorDescriptionPdfMedicationCardGenerator(NarrativeFormat narrativeFormat, String template, SoftwareProviderMetadataProvider softwareProviderMetadataProvider) PdfMedicationCardGenerator(NarrativeFormat narrativeFormat, SoftwareProviderMetadataProvider softwareProviderMetadataProvider) -
Method Summary
Modifier and TypeMethodDescriptionprotected static StringformatHumanName(org.hl7.fhir.r4.model.HumanName name) Formats a human name.abstract byte[]generate(ChEmedEprDocumentPmlc pmlcDocument, NarrativeLanguage lang) static Stringstatic Stringprotected Stringprotected voidvalidatePDF(ChEmedEprDocumentPmlc pmlcDocument, byte[] pdf) Validates the generated document using a different PDF/A-1 PDF/A-2 validator (not from husky).
-
Field Details
-
FONT_FAMILY
- See Also:
-
htmlNarrativeGenerator
The generator HTML narrative. -
pdfConverter
The converter of HTML to PDF/A. -
template
The custom template content. -
pdfValidator
The validator of PDF documents to conformance level A-1 and A-2. -
softwareProviderMetadata
-
-
Constructor Details
-
PdfMedicationCardGenerator
public PdfMedicationCardGenerator(NarrativeFormat narrativeFormat, String template, SoftwareProviderMetadataProvider softwareProviderMetadataProvider) throws IOException, ParserConfigurationException -
PdfMedicationCardGenerator
public PdfMedicationCardGenerator(NarrativeFormat narrativeFormat, SoftwareProviderMetadataProvider softwareProviderMetadataProvider) throws IOException, ParserConfigurationException
-
-
Method Details
-
generate
public abstract byte[] generate(ChEmedEprDocumentPmlc pmlcDocument, NarrativeLanguage lang) throws Exception - Throws:
Exception
-
validatePDF
protected void validatePDF(ChEmedEprDocumentPmlc pmlcDocument, byte[] pdf) throws PdfValidationException Validates the generated document using a different PDF/A-1 PDF/A-2 validator (not from husky). If the document does not pass validation, an exception is thrown.- Parameters:
pmlcDocument- The document for which the PDF has been generated.pdf- The byte array of the generated PDF.- Throws:
PdfValidationException- If the generated PDF failed to pass PDF/A-1 or A-2 validation.
-
getPdfAuthor
-
getDefaultChEmedEprPdfTemplate
- Throws:
IOException
-
getDefaultEmediplanPdfTemplate
-
formatHumanName
Formats a human name.
-