Skip to content

Commit

Permalink
ersion 0.1.0 - 2023-08-13
Browse files Browse the repository at this point in the history
* Updated parent version to fj-doc 1.4.4
* Typos in documentation
* Added JUnit for basic testing
  • Loading branch information
fugerit79 committed Aug 13, 2023
1 parent 4892660 commit 2e0d7d2
Show file tree
Hide file tree
Showing 7 changed files with 114 additions and 18 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# Changelog for project fj-doc-mod-itext
# Changelog for project fj-doc-mod-openpdf

## version 0.1.0 - 2023-08-13
* Updated parent version to fj-doc 1.4.4
* Typos in documentation
* Added JUnit for basic testing

## version 0.1.0-rc.001 - 2023-07-22
* Porting of fj-doc-mod-itext based on [OpenPDF](https://github.com/LibrePDF/OpenPDF) / [OpenRTF](https://github.com/LibrePDF/OpenRTF)
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
<parent>
<groupId>org.fugerit.java</groupId>
<artifactId>fj-doc</artifactId>
<version>1.3.2-rc.001</version>
<version>1.4.4</version>
<relativePath></relativePath>
</parent>

<name>fj-doc-mod-openpdf</name>
<description>Fugerit DOC module for output in PDF, RTF and HTML using Itext 2.1.X</description>
<version>0.1.0-rc.001</version>
<description>Fugerit DOC module for output in PDF, RTF and HTML using OpenPDF (Itext fork)</description>
<version>0.1.0</version>

<licenses>
<license>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,20 +85,6 @@ public void testIndex001() throws Exception {
list.add(new ListItem("dog", font));
document.add(list);

//PdfStructureTreeRoot tree = writer.getStructureTreeRoot();;


// PdfOutline root = writer.getRootOutline();
// PdfDestination mybookmark = new PdfDestination( PdfDestination.FITH, writer.getVerticalPosition(true) );
// PdfOutline bookmark = new PdfOutline( root , mybookmark, "test bookmark", true );
// ArrayList outlines = new ArrayList();
// HashMap map = new HashMap();
// outlines.add(map);





document.close();

}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package test.org.fugerit.java.doc.mod.itext.poc;

import org.fugerit.java.doc.mod.openpdf.PdfTypeHandler;
import org.junit.Test;

public class TestDefaultDoc extends TestDocBase {

@Test
public void testOpenPDF() {
this.testDocWorker( "default_doc" , PdfTypeHandler.HANDLER );
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package test.org.fugerit.java.doc.mod.itext.poc;

import static org.junit.Assert.fail;

import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;

import org.fugerit.java.core.lang.helpers.ClassHelper;
import org.fugerit.java.doc.base.config.DocInput;
import org.fugerit.java.doc.base.config.DocOutput;
import org.fugerit.java.doc.base.config.DocTypeHandler;

import lombok.extern.slf4j.Slf4j;

@Slf4j
public class TestDocBase {

protected void testDocWorker( String testCase, DocTypeHandler handler ) {
String inputXml = "xml/"+testCase+".xml" ;
File outputFile = new File( "target", testCase+"."+handler.getType() );
log.info( "inputXml:{}, outputFile:{}", inputXml, outputFile );
try ( InputStreamReader reader = new InputStreamReader( ClassHelper.loadFromDefaultClassLoader( inputXml ) );
OutputStream os = new FileOutputStream( outputFile ) ) {
handler.handle( DocInput.newInput( handler.getType() , reader ) , DocOutput.newOutput(os) );
} catch (Exception e) {
String message = "Error : "+e.getMessage();
log.error( message , e );
fail( message );
}
}

}
13 changes: 13 additions & 0 deletions src/test/resources/log4j2.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN">
<Appenders>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
</Console>
</Appenders>
<Loggers>
<Root level="INFO">
<AppenderRef ref="Console"/>
</Root>
</Loggers>
</Configuration>
45 changes: 45 additions & 0 deletions src/test/resources/xml/default_doc.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?xml version="1.0" encoding="utf-8"?>
<doc
xmlns="http://javacoredoc.fugerit.org"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://javacoredoc.fugerit.org https://www.fugerit.org/data/java/doc/xsd/doc-2-0.xsd" >

<metadata>
<!-- Margin for document : left;right;top;bottom -->
<info name="margins">10;10;10;30</info>
<info name="excel-table-id">excel-table=print</info>
<!-- documenta meta information -->
<info name="doc-title">Basic example</info>
<info name="doc-subject">fj doc venus sample source xml</info>
<info name="doc-author">fugerit79</info>
<info name="doc-language">en</info>
<!-- font must be loaded -->
<!--
<info name="default-font-name">TitilliumWeb</info>
-->
<footer-ext>
<para align="right">${r"${currentPage}"} / ${r"${pageCount}"}</para>
</footer-ext>
</metadata>
<body>
<para>My sample title</para>
<table columns="3" colwidths="30;30;40" width="100" id="excel-table" padding="2">
<row>
<cell align="center" border-color="#000000" border-width="1"><para style="bold">Name</para></cell>
<cell align="center"><para style="bold">Surname</para></cell>
<cell align="center"><para style="bold">Title</para></cell>
</row>
<row>
<cell><para><![CDATA[Luthien]]></para></cell>
<cell><para><![CDATA[Tinuviel]]></para></cell>
<cell><para><![CDATA[Queen]]></para></cell>
</row>
<row>
<cell><para><![CDATA[Thorin]]></para></cell>
<cell><para><![CDATA[Oakshield]]></para></cell>
<cell><para><![CDATA[King]]></para></cell>
</row>
</table>
</body>

</doc>

0 comments on commit 2e0d7d2

Please sign in to comment.