Search the FirstSpirit Knowledge Base
Hy!
Ich habe einen Vorlagensatz wie folgt definiert:
Vorlagensatz-Name: pdf
Präsentationskanal: PDF (ist FOP v0.20.5)
Konvertierungs-Regel: Unicode to FOP entities
Zeilenumbruch: Windows
Zieldatei-Erweiterung: pdf
In einer neuen Seitenvorlage habe ich den pdf-Kanal dann wie folgt zum Testen befüllt:
<?xml version="1.0" encoding="ISO-8859-1"?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master master-name="A4">
<fo:region-body />
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="A4">
<fo:flow flow-name="xsl-region-body">
<fo:block>Hallo Community</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
Damit dann eine Inhaltsseite angelegt und es gibt keine Fehler in der Vorschau. Wie erwartet.
Erzeuge ich dann das gesamte im Deployment, dann wirft er mir folgenden Fehler aus:
ERROR
[–] 10:37:29 ERROR 10.01.2011 10:37:29.063 {seID=18547818} (fs.opt.fop.FoProcessor): er [...] 10.01.2011 10:37:29 ERROR 10.01.2011 10:37:29.063 {seID=18547818} (de.espirit.firstspirit.opt.fop.FoProcessor): error processing fo - org.apache.fop.apps.FOPException: Premature end of file.
org.apache.fop.apps.FOPException: Premature end of file.
at org.apache.fop.apps.Driver.render(Driver.java:503)
at org.apache.fop.apps.Driver.run(Driver.java:565)
at de.espirit.firstspirit.opt.fop.FoProcessor.process(FoProcessor.java:61)
at de.espirit.firstspirit.generate.AbstractContentProcessor.finish(AbstractContentProcessor.java:46)
at de.espirit.firstspirit.generate.SiteProduction.render(SiteProduction.java:182)
at de.espirit.firstspirit.generate.SiteProduction.render(SiteProduction.java:135)
at de.espirit.firstspirit.generate.SiteProduction.render(SiteProduction.java:138)
at de.espirit.firstspirit.generate.SiteProduction.render(SiteProduction.java:138)
at de.espirit.firstspirit.generate.SiteProduction.start(SiteProduction.java:105)
at de.espirit.firstspirit.generate.SiteProduction.start(SiteProduction.java:98)
at de.espirit.firstspirit.server.scheduler.GenerateTaskExecutor.run(GenerateTaskExecutor.java:201)
at de.espirit.firstspirit.server.scheduler.ScheduleManagerImpl$TaskCallable.executeLocal(ScheduleManagerImpl.java:1955)
at de.espirit.firstspirit.server.scheduler.ScheduleManagerImpl$TaskCallable.executeLocal(ScheduleManagerImpl.java:1935)
at de.espirit.firstspirit.server.scheduler.ScheduleManagerImpl$TaskCallable.call(ScheduleManagerImpl.java:1863)
at de.espirit.firstspirit.server.ExecutionManagerImpl$ExtendedCallable.call(ExecutionManagerImpl.java:505)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at de.espirit.common.util.BoundedExecutorService$RunnableWrapper.run(BoundedExecutorService.java:414)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
at de.espirit.common.util.SuspendableThread.run(SuspendableThread.java:36)
---------
org.xml.sax.SAXParseException: Premature end of file.
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1231)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
at org.apache.fop.apps.Driver.render(Driver.java:498)
at org.apache.fop.apps.Driver.run(Driver.java:565)
at de.espirit.firstspirit.opt.fop.FoProcessor.process(FoProcessor.java:61)
at de.espirit.firstspirit.generate.AbstractContentProcessor.finish(AbstractContentProcessor.java:46)
at de.espirit.firstspirit.generate.SiteProduction.render(SiteProduction.java:182)
at de.espirit.firstspirit.generate.SiteProduction.render(SiteProduction.java:135)
at de.espirit.firstspirit.generate.SiteProduction.render(SiteProduction.java:138)
at de.espirit.firstspirit.generate.SiteProduction.render(SiteProduction.java:138)
at de.espirit.firstspirit.generate.SiteProduction.start(SiteProduction.java:105)
at de.espirit.firstspirit.generate.SiteProduction.start(SiteProduction.java:98)
at de.espirit.firstspirit.server.scheduler.GenerateTaskExecutor.run(GenerateTaskExecutor.java:201)
at de.espirit.firstspirit.server.scheduler.ScheduleManagerImpl$TaskCallable.executeLocal(ScheduleManagerImpl.java:1955)
at de.espirit.firstspirit.server.scheduler.ScheduleManagerImpl$TaskCallable.executeLocal(ScheduleManagerImpl.java:1935)
at de.espirit.firstspirit.server.scheduler.ScheduleManagerImpl$TaskCallable.call(ScheduleManagerImpl.java:1863)
at de.espirit.firstspirit.server.ExecutionManagerImpl$ExtendedCallable.call(ExecutionManagerImpl.java:505)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at de.espirit.common.util.BoundedExecutorService$RunnableWrapper.run(BoundedExecutorService.java:414)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
at de.espirit.common.util.SuspendableThread.run(SuspendableThread.java:36)
Woran kann das liegen? Was mache ich falsch?
Ach ja, FirstSpirit 4.2.219 !
Grüße
Marcus
Es lag am XML! Da war irgendetwas verkehrt, kann leider auch nicht sagen was. Aber mit diesem XML hier klappt es:
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master master-name="A4Page"
page-height="297mm"
page-width="210mm"
margin-left="0mm"
margin-right="0mm"
margin-top="15mm"
margin-bottom="0mm">
<fo:region-before extent="20mm"/>
<fo:region-after extent="20mm"/>
<fo:region-start extent="20mm"/>
<fo:region-end extent="20mm"/>
<fo:region-body
margin-top="25mm"
margin-bottom="25mm"
margin-left="25mm"
margin-right="25mm"/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="A4Page">
<fo:static-content flow-name="xsl-region-before" font-size="10pt">
<fo:block>
Überschrift
</fo:block>
</fo:static-content>
<fo:static-content flow-name="xsl-region-after" text-align="right" font-size="10pt">
<fo:block>
Seite <fo:page-number/> von <fo:page-number-citation ref-id="lastBlock"/>
</fo:block>
</fo:static-content>
<fo:flow flow-name="xsl-region-body" font-family="Arial" font-size="10pt">
<fo:block font-family="Arial" font-size="14pt" padding-bottom="20px">Test-Text</fo:block>
<fo:block>Und hier der Text</fo:block>
<fo:block id="lastBlock">Letzter Block</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
Es lag am XML! Da war irgendetwas verkehrt, kann leider auch nicht sagen was. Aber mit diesem XML hier klappt es:
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master master-name="A4Page"
page-height="297mm"
page-width="210mm"
margin-left="0mm"
margin-right="0mm"
margin-top="15mm"
margin-bottom="0mm">
<fo:region-before extent="20mm"/>
<fo:region-after extent="20mm"/>
<fo:region-start extent="20mm"/>
<fo:region-end extent="20mm"/>
<fo:region-body
margin-top="25mm"
margin-bottom="25mm"
margin-left="25mm"
margin-right="25mm"/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="A4Page">
<fo:static-content flow-name="xsl-region-before" font-size="10pt">
<fo:block>
Überschrift
</fo:block>
</fo:static-content>
<fo:static-content flow-name="xsl-region-after" text-align="right" font-size="10pt">
<fo:block>
Seite <fo:page-number/> von <fo:page-number-citation ref-id="lastBlock"/>
</fo:block>
</fo:static-content>
<fo:flow flow-name="xsl-region-body" font-family="Arial" font-size="10pt">
<fo:block font-family="Arial" font-size="14pt" padding-bottom="20px">Test-Text</fo:block>
<fo:block>Und hier der Text</fo:block>
<fo:block id="lastBlock">Letzter Block</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
Hallo Marcus,
der von Dir beschriebene FOP-Code hat bei mir in der Vorschau (auch) nicht funktioniert.
Eine gute Ausgangsbasis für die FO-Syntax sind die Beispiele mit Mithras-Demo-Projekt.
Ein "minimales" Seiten-Template habe ich da mal rauskopiert:
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:fox="http://xml.apache.org/fop/extensions">
<fo:layout-master-set>
<fo:simple-page-master master-name="A4" page-width="210mm" page-height="297mm" margin-left="22mm" margin-right="23mm" margin-top="12mm">
<fo:region-body margin-top="28mm" margin-bottom="23mm"/>
<fo:region-before region-name="header" extent="26mm"/>
<fo:region-after region-name="footer" extent="15mm"/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="A4">
<fo:flow flow-name="xsl-region-body">
<fo:block font-family="Helvetica" font-size="10pt" keep-with-previous.within-page="always">
<fo:block break-after="page" id="test">
Hallo Community
</fo:block>
</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>