Coder Social home page Coder Social logo

fugerit-org / fj-doc Goto Github PK

View Code? Open in Web Editor NEW
11.0 6.0 1.0 4.53 MB

Fugerit Document Generation Framework (fj-doc)Fugerit Doc

Home Page: https://www.fugerit.org/perm/venus/

License: Apache License 2.0

Java 67.22% HTML 18.07% CSS 0.33% JavaScript 3.52% FreeMarker 10.74% Dockerfile 0.11%
apache-fop apache-poi csv csv-generator excel excel-generation freemarker html html-generation java

fj-doc's Introduction

Venus - Fugerit Document Generation Framework (fj-doc)

Framework to produce documents in different output formats starting from an XML document metamodel. (options for json and yaml source models are also available)

Keep a Changelog v1.1.0 badge Maven Central license code of conduct Quality Gate Status Coverage Known Vulnerabilities Codacy Badge build and scan Docker images

Java runtime version Java build version Apache Maven Online playground Fugerit Github Project Conventions

The Core library (fj-doc-base) is all you need to start, even though typically you will use at least :

Quickstart

Build

Clone :

git clone https://github.com/fugerit-org/fj-doc

Full build is made by :

mvn clean install -P full,test

Or with the maven wrapper for linux :

./mvnw clean install -P full,test

Or with the maven wrapper for windows :

./mvnw clean install -P full,test

Run

The Fugerit Venus Doc project is a library for generating documents to be included.

The module fj-doc-playground-quarkus demonstrates some of the main features.

After building, it is possible to just run it by launching :

cd fj-doc-playground-quarkus
mvn compile quarkus:dev -P buildreact

Open : http://localhost:8080/fj-doc-playground/home/

NOTE : The playground demo single page application currently runs on node 20

Useful resources

A quick start is available in module fj-doc-sample

Modules

There are five kinds of components (each components README.md contains module status) :

1. Framework core :

2. Modules :

3. Available type handlers :

  • MD BASIC - (fj-doc-base) output as Markdown basic language
  • MD EXT - (fj-doc-base) output as Markdown extended (include tables) language
  • HTML - (fj-doc-freemarker) output as html
  • HTML FRAGMENT - (fj-doc-freemarker) output as html body content only (no html, head or body tags)
  • XLS - (fj-doc-mod-poi) output as Microsoft XLS using Apache POI
  • XLSX - (fj-doc-mod-poi) output as Microsoft XLSX using Apache POI
  • PDF - (fj-doc-mod-fop) - output as PDF using Apache FOP
  • FO - (fj-doc-mod-fop) - output as FO using Apache FOP
  • CSV - (fj-doc-mod-opencsv) - output as CSV using OpenCSV
  • PDF - (fj-doc-mod-openpdf-ext) - output as PDF using OpenPDF
  • HTML - (fj-doc-mod-openpdf-ext) - output as HTML using OpenPDF
  • RTF - (fj-doc-mod-openrtf-ext) - output as RTF using OpenRTF

4. Bundled libraries :

5. Tutorial :

6. Extension Type Handlers (Extension renders) :

Basically the same as type handlers but based on libraries not available on Maven Repository Central (es. PDFLIB).
You can find in them in a dedicated repository fj-doc-ext

7. Incubator Type Handlers (Are too far from being complete) :

8. Deprecated Type Handlers (Will not be maintained) :

9. GraalVM native support

Beginning with version 1.4.0-rc.001, GraalVM metadata started to be added (reflect-config.json and resources-config.json). Initially only the fj-doc-base and fj-doc-freemarker have full support. Actual support for other module will be added as soon as possible, but sometimes is dependent on underlying dependencies support (for example Apache FOP for fj-doc-mod-fop). It is possible to check the current status on the module documentation, in the section native support

About javadoc
Javadoc are far from being complete, but you can find latest version at https://www.fugerit.org
Note that, being an open source project hosted on maven central, you can find release javadoc on javadoc.io

Special thanks

Special thanks to JetBrains for accepting this project in the Licenses for Open Source Development - Community Support program.

JetBrains

Special thanks to Sonar Cloud too for their code review platform.

fj-doc's People

Contributors

daneeldeveloper avatar dependabot[bot] avatar fugerit79 avatar mttfranci avatar snyk-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Forkers

daneeldeveloper

fj-doc's Issues

[fj-doc-mod-poi] On linux sometimes you may get a java.lang.InternalError on org.fugerit.java.doc.mod.poi.PoiUtils.resizeSheet()

On linux server with no graphical interface, is possible to get the an error when invoking :
at org.fugerit.java.doc.mod.poi.PoiUtils.resizeSheet()
For instance on :
at org.fugerit.java.doc.mod.poi.BasicPoiTypeHandler.handle()

Tested on jdk : jdk-11.0.16.1 (for linux arm)

Fix : install the fontconfig package on your system. (source)

Here is a sample stack trace for version fj-doc-mod-poi version 0.7.2

java.lang.InternalError: java.lang.reflect.InvocationTargetException
	at java.desktop/sun.font.FontManagerFactory$1.run(FontManagerFactory.java:86)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.desktop/sun.font.FontManagerFactory.getInstance(FontManagerFactory.java:74)
	at java.desktop/java.awt.Font.getFont2D(Font.java:497)
	at java.desktop/java.awt.Font.canDisplayUpTo(Font.java:2250)
	at java.desktop/java.awt.font.TextLayout.singleFont(TextLayout.java:469)
	at java.desktop/java.awt.font.TextLayout.<init>(TextLayout.java:530)
	at org.apache.poi.ss.util.SheetUtil.getDefaultCharWidth(SheetUtil.java:273)
	at org.apache.poi.ss.util.SheetUtil.getColumnWidth(SheetUtil.java:248)
	at org.apache.poi.ss.util.SheetUtil.getColumnWidth(SheetUtil.java:233)
	at org.apache.poi.xssf.usermodel.XSSFSheet.autoSizeColumn(XSSFSheet.java:555)
	at org.apache.poi.xssf.usermodel.XSSFSheet.autoSizeColumn(XSSFSheet.java:537)
	at org.fugerit.java.doc.mod.poi.PoiUtils.resizeSheet(PoiUtils.java:17)
	at org.fugerit.java.doc.mod.poi.PoiUtils.autoSizeColumns(PoiUtils.java:25)
	at org.fugerit.java.doc.mod.poi.BasicPoiTypeHandler.handle(BasicPoiTypeHandler.java:292)
	at org.fugerit.java.doc.lib.simpletable.SimpleTableDocConfig.processSimpleTable(SimpleTableDocConfig.java:60)
	at org.fugerit.java.doc.playground.doc.GenerateRest.validate(GenerateRest.java:142)
	at org.fugerit.java.doc.playground.doc.GenerateRest_ClientProxy.validate(Unknown Source)
	at org.fugerit.java.doc.playground.doc.GenerateRest$quarkusrestinvoker$validate_9602abc43de303ad70b38c0fbaa7c81272957d46.invoke(Unknown Source)
	at org.jboss.resteasy.reactive.server.handlers.InvocationHandler.handle(InvocationHandler.java:29)
	at io.quarkus.resteasy.reactive.server.runtime.QuarkusResteasyReactiveRequestContext.invokeHandler(QuarkusResteasyReactiveRequestContext.java:114)
	at org.jboss.resteasy.reactive.common.core.AbstractResteasyReactiveContext.run(AbstractResteasyReactiveContext.java:145)
	at io.quarkus.vertx.core.runtime.VertxCoreRecorder$14.runWith(VertxCoreRecorder.java:576)
	at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
	at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:29)
	at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:29)
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.reflect.InvocationTargetException
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
	at java.desktop/sun.font.FontManagerFactory$1.run(FontManagerFactory.java:84)
	... 28 more
Caused by: java.lang.NullPointerException
	at java.desktop/sun.awt.FontConfiguration.getVersion(FontConfiguration.java:1262)
	at java.desktop/sun.awt.FontConfiguration.readFontConfigFile(FontConfiguration.java:225)
	at java.desktop/sun.awt.FontConfiguration.init(FontConfiguration.java:107)
	at java.desktop/sun.awt.X11FontManager.createFontConfiguration(X11FontManager.java:719)
	at java.desktop/sun.font.SunFontManager$2.run(SunFontManager.java:379)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.desktop/sun.font.SunFontManager.<init>(SunFontManager.java:324)
	at java.desktop/sun.awt.FcFontManager.<init>(FcFontManager.java:35)
	at java.desktop/sun.awt.X11FontManager.<init>(X11FontManager.java:56)

[mod-fop] fix cell vertifcal align

Vertical alignment in mod-fop cell it's not wotking :

        <cell valign="middle">
          <para>Elrond</para>
        </cell>
        <cell valign="bottom">
          <para>Gil-Galad</para>
        </cell>

[fj-doc-mod-fop] fail to create a PDF which is both compliant to PDF/A-1b and PDF/UA-1

It seems setting both PDF/A and PDF/UA profile leads to this error on PDF/A validation :

"XMP property pdfuaid:part not defined in current schema."

Whereas PDF/UA validation succeds

PDF/A checked with : https://avepdf.com/en/pdfa-validation ( and Adobe )
PDF/UA checked with : https://check.axes4.com/en/

Here is a simple output of a PDF/A-1b and PDF/UA-1

Actually it seems that this property is added to the output PDF :

        <rdf:Description xmlns:pdfuaid="http://www.aiim.org/pdfua/ns/id/" rdf:about="">
            <pdfuaid:part>1</pdfuaid:part>
        </rdf:Description>

Which is leading to the validation error.

Javadoc generations with older versions of jdk 11 fails

The project build successfully with oracle jdk 11.0.16.1 and higher.

Previous implementation may failes with maven build profile 'full' when generating javadoc of auto generated sources from jaxb in module fj-doc-lib-autodoc.

[fj-doc-mod-fop] add pdf/a support

Adding support for pdf/a format.

The concept of format has been introduced.
By default the format is the same as the type (pdf, xlsx, html etc).

It is possible now to add format for the same type.

The DocHandlerFacade can handle multiple handlers for the same type, as long as the format is diffirent.

For instance we can have a normal pdf handler (type : pdf, format : pdf) and a pdf a handler (type : pdf, format : PDF/A-1a).

An example in the fj-doc-sample project will be provided.

[fj-doc-base] Managing of unsafe DocTypeHandler for DocHandlerFactory

The class DocHandlerFactory offers a conveniente system to load and register type handler, but if even just one type handler is not found, the load process will fail.

It would be better if it was possible to tag handlers entry as "unsafe" (in which case the factory creations should not safe if the handler is not found).

	<factory id="unsafe-test">
		<data id="html-fm" info="html" type="org.fugerit.java.doc.freemarker.html.FreeMarkerHtmlTypeHandlerUTF8" />	
		<data id="html-fragment-fm" info="fhtml" type="org.fugerit.java.doc.freemarker.html.FreeMarkerHtmlFragmentTypeHandlerUTF8" />
		<data id="pdf-unsafe" info="pdf" type="org.fugerit.java.doc.pdf.UnsafeDocHandler" />
	</factory>

Imagine the last handler is not available in class loader. Thi can be handled with the new properties :

unsafe="true" unsafeMode="log-trace"

	<factory id="unsafe-test">
		<data id="html-fm" info="html" type="org.fugerit.java.doc.freemarker.html.FreeMarkerHtmlTypeHandlerUTF8" />	
		<data id="html-fragment-fm" info="fhtml" type="org.fugerit.java.doc.freemarker.html.FreeMarkerHtmlFragmentTypeHandlerUTF8" />
		<data id="pdf-unsafe" info="pdf" type="org.fugerit.java.doc.pdf.UnsafeDocHandler" unsafe="true" unsafeMode="log-trace"/>
	</factory>

The stack trace will be logged only if you set unsafeMod to log-trace. If you want to suppress the stack trace use :

unsafe="true" unsafeMode="log-message"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.