Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PDF generation from XML requires FreeSans.ttf #387

Closed
Heavenfighter opened this issue May 29, 2024 · 2 comments
Closed

PDF generation from XML requires FreeSans.ttf #387

Heavenfighter opened this issue May 29, 2024 · 2 comments

Comments

@Heavenfighter
Copy link
Contributor

Heavenfighter commented May 29, 2024

The action pdf of the CLI which transforms XML to PDF throws an error, that the FreeSans.ttf is missing. It is not sufficient to install that font, it must explicitly be present in the calling directory.

Tested on Windows 10 system.

`
2024-05-29 08:17:48.379 [main] ERROR ROOT - Failed to read font file FreeSans.ttf C:\Users\user\Desktop\FreeSans.ttf (Das System kann die angegebene Datei nicht finden)
java.lang.RuntimeException: Failed to read font file FreeSans.ttf C:\Users\user\Desktop\FreeSans.ttf (Das System kann die angegebene Datei nicht finden)
at org.apache.fop.fonts.LazyFont.load(LazyFont.java:134)
at org.apache.fop.fonts.LazyFont.getAscender(LazyFont.java:237)
at org.apache.fop.fonts.Font.getAscender(Font.java:120)
at org.apache.fop.layoutmgr.BlockLayoutManager.initialize(BlockLayoutManager.java:82)
at org.apache.fop.layoutmgr.AbstractLayoutManager.getChildLM(AbstractLayoutManager.java:118)
at org.apache.fop.layoutmgr.FlowLayoutManager.getNextKnuthElements(FlowLayoutManager.java:108)
at org.apache.fop.layoutmgr.FlowLayoutManager.getNextKnuthElements(FlowLayoutManager.java:69)
at org.apache.fop.layoutmgr.PageBreaker.getNextKnuthElements(PageBreaker.java:252)
at org.apache.fop.layoutmgr.AbstractBreaker.getNextBlockList(AbstractBreaker.java:675)
at org.apache.fop.layoutmgr.PageBreaker.getNextBlockList(PageBreaker.java:179)
at org.apache.fop.layoutmgr.PageBreaker.getNextBlockList(PageBreaker.java:159)
at org.apache.fop.layoutmgr.AbstractBreaker.doLayout(AbstractBreaker.java:385)
at org.apache.fop.layoutmgr.PageBreaker.doLayout(PageBreaker.java:113)
at org.apache.fop.layoutmgr.PageSequenceLayoutManager.activateLayout(PageSequenceLayoutManager.java:143)
at org.apache.fop.area.AreaTreeHandler.endPageSequence(AreaTreeHandler.java:267)
at org.apache.fop.fo.pagination.PageSequence.endOfNode(PageSequence.java:140)
at org.apache.fop.fo.FOTreeBuilder$MainFOHandler.endElement(FOTreeBuilder.java:390)
at org.apache.fop.fo.FOTreeBuilder$3.run(FOTreeBuilder.java:207)
at org.apache.fop.fo.FOTreeBuilder$3.run(FOTreeBuilder.java:204)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at org.apache.fop.fo.FOTreeBuilder.endElement(FOTreeBuilder.java:203)
at net.sf.saxon.event.ContentHandlerProxy.endElement(ContentHandlerProxy.java:412)
at net.sf.saxon.event.ProxyReceiver.endElement(ProxyReceiver.java:185)
at net.sf.saxon.event.SequenceNormalizer.endElement(SequenceNormalizer.java:229)
at net.sf.saxon.event.ReceivingContentHandler.endElement(ReceivingContentHandler.java:528)
at java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:610)
at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1718)
at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2883)
at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:605)
at java.xml/com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:112)
at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:534)
at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:888)
at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:824)
at java.xml/com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
at java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1216)
at java.xml/com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:635)
at net.sf.saxon.event.Sender.sendSAXSource(Sender.java:434)
at net.sf.saxon.event.Sender.send(Sender.java:167)
at net.sf.saxon.jaxp.IdentityTransformer.transform(IdentityTransformer.java:366)
at org.mustangproject.ZUGFeRD.ZUGFeRDVisualizer.toPDF(ZUGFeRDVisualizer.java:331)
at org.mustangproject.commandline.Main.performVisualization(Main.java:838)

`

@jstaerk
Copy link
Collaborator

jstaerk commented May 30, 2024

The reason that this did not work properly was the reason why xml2pdf could not be finished before the new priority had to become UBL, due to new legislation. And that was also the reason why this functionality way never announced.

I will remove this functionality unless someone manages to embed the font (and all other neccessary artefacts) in the jar file. The output has to be valid PDF/A-1, though, just PDF is not sufficient.

email me if you want to contribute that functionality, maybe we could have a 30min workshop or so, otherwise: Apologies for the inconvenience, this functionality needs a reboot. And will be removed until it got it.

@Heavenfighter
Copy link
Contributor Author

Heavenfighter commented May 30, 2024

To keep this feature would be nice, since its a great alternative for visualization of xRechnung documents beside the HTML variant.
I'm not sure if i can contribute something because i have no experience in FOP, but i will take a look.

Added pull request.

jstaerk added a commit that referenced this issue May 31, 2024
#387 allow embedd fonts from jar-file for pdf creation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants