Search in sources :

Example 6 with EdFeature

use of eu.transkribus.core.model.beans.EdFeature in project TranskribusCore by Transkribus.

the class TrpTxtBuilder method addTitlePage.

public static void addTitlePage(TrpDoc doc, File file) {
    List<String> titleContent = new ArrayList<String>();
    titleContent.add("----------------------------");
    titleContent.add("Metadata section of document");
    titleContent.add("----------------------------");
    TrpDocMetadata docMd = doc.getMd();
    titleContent.add("Title: " + docMd.getTitle());
    titleContent.add("Author: " + docMd.getAuthor());
    titleContent.add("Description: " + docMd.getDesc());
    titleContent.add("Genre: " + docMd.getGenre());
    titleContent.add("Writer: " + docMd.getWriter());
    if (docMd.getScriptType() != null) {
        titleContent.add("Sripttype: " + docMd.getScriptType().toString());
    }
    titleContent.add("Language: " + docMd.getLanguage());
    titleContent.add("Number of Pages in whole Document: " + String.valueOf(docMd.getNrOfPages()));
    if (docMd.getCreatedFromDate() != null) {
        titleContent.add("Created From: " + docMd.getCreatedFromDate().toString());
    }
    if (docMd.getCreatedToDate() != null) {
        titleContent.add("Created To: " + docMd.getCreatedToDate().toString());
    }
    titleContent.add("Editorial Declaration: ");
    for (EdFeature edfeat : doc.getEdDeclList()) {
        titleContent.add(edfeat.getTitle() + ": " + edfeat.getDescription() + System.lineSeparator() + edfeat.getSelectedOption().toString());
    }
    titleContent.add("-----------------------");
    titleContent.add("End of metadata section");
    titleContent.add("-----------------------");
    titleContent.add(System.lineSeparator());
    try {
        Files.write(Paths.get(file.getAbsolutePath()), titleContent, utf8, StandardOpenOption.CREATE, StandardOpenOption.APPEND);
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
}
Also used : EdFeature(eu.transkribus.core.model.beans.EdFeature) ArrayList(java.util.ArrayList) TrpDocMetadata(eu.transkribus.core.model.beans.TrpDocMetadata) IOException(java.io.IOException)

Aggregations

EdFeature (eu.transkribus.core.model.beans.EdFeature)6 TrpDocMetadata (eu.transkribus.core.model.beans.TrpDocMetadata)4 IOException (java.io.IOException)3 ArrayList (java.util.ArrayList)3 CorruptImageException (eu.transkribus.core.exceptions.CorruptImageException)2 File (java.io.File)2 FileNotFoundException (java.io.FileNotFoundException)2 DocumentException (com.itextpdf.text.DocumentException)1 PdfContentByte (com.itextpdf.text.pdf.PdfContentByte)1 XmlFormat (eu.transkribus.core.io.formats.XmlFormat)1 TrpDoc (eu.transkribus.core.model.beans.TrpDoc)1 TrpPage (eu.transkribus.core.model.beans.TrpPage)1 Dimension (java.awt.Dimension)1 MalformedURLException (java.net.MalformedURLException)1 JAXBException (javax.xml.bind.JAXBException)1 ParserConfigurationException (javax.xml.parsers.ParserConfigurationException)1 TransformerException (javax.xml.transform.TransformerException)1 SAXException (org.xml.sax.SAXException)1