Page 1 of 1

Error on convert pdf with FO on docx4j.3.3.1

PostPosted: Fri Aug 26, 2016 12:58 am
by johnnycoppini
Hello,

I'm trying to convert a .docx to .pdf

When the method the code
Code: Select all
Docx4J.toFO(foSettings, the, Docx4J.FLAG_EXPORT_PREFER_XSL);
throws the following exception:

java.lang.NoSuchMethodException: org.apache.fop.apps.FopFactory.newInstance ()
at java.lang.Class.getDeclaredMethod (Class.java:2130)


I am using all the libs from folder dependencies and optional/export-fo, as recommended.

In debug I realized that AbastractExporter in export method throws the exception when you try to get the path of fosettings. The method does not find the hasmap and when trying to access fo_dump_file and converts it into File, the error occurs -
Code: Select all
  Public File getFoDumpFile () {
return (File) settings.get (FO_DUMP_FILE);
}



Another thing I noticed is that before running the AbstractExporter.export method, code
Code: Select all
process (conversionSettings, conversionContext, intermediateOutputStream);

the hash map with the path to the settings was there.

Please does anyone know what I'm doing wrong?

Re: Error on convert pdf with FO on docx4j.3.3.1

PostPosted: Thu Sep 01, 2016 2:13 pm
by jason
Not sure about your specific issue, but we do need to release docx4j-export-fo 3.3.1 incorporating https://github.com/plutext/docx4j-expor ... 27cfa92f79

Could you please try http://www.docx4java.org/docx4j/docx4j- ... 160901.jar

What code are you using to kick off your docx to PDF conversion?

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
                FOSettings foSettings = Docx4J.createFOSettings();
                if (saveFO) {
                        foSettings.setFoDumpFile(new java.io.File(inputfilepath + ".fo"));
                }
                foSettings.setWmlPackage(wordMLPackage);
               
                OutputStream os = new java.io.FileOutputStream(outputfilepath);
       
                Docx4J.toFO(foSettings, os, Docx4J.FLAG_EXPORT_PREFER_XSL);
 
Parsed in 0.015 seconds, using GeSHi 1.0.8.4


works for me...

Re: Error on convert pdf with FO on docx4j.3.3.1

PostPosted: Fri Sep 02, 2016 12:58 am
by johnnycoppini
Jason,
Thanks about your answer. I tried docx4j-export-fo 3.3.1 now, but the same problem happens.
.Fo the file is generated normally . But the .pdf is with zero bytes
Here is my code:
Code: Select all
try {
            WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.load(new java.io.File(inputfilepath));
            // Refresh the values of DOCPROPERTY fields
            FieldUpdater updater = new FieldUpdater(wordMLPackage);
            updater.update(true);


            String regex = null;

            regex = ".*(calibri|camb|cour|arial|symb|times|Times|zapf).*";
            regex = ".*(calibri|camb|cour|arial|times|comic|georgia|impact|LSANS|pala|tahoma|trebuc|verdana|symbol|webdings|wingding|Liberation Serif).*";
     
            regex = ".*(Courier New|Arial|Times New Roman|Comic Sans|Georgia|Impact|Lucida Console|Lucida Sans Unicode|Palatino Linotype|Tahoma|Trebuchet|Verdana|Symbol|Webdings|Wingdings|MS Sans Serif|MS Serif).*";
            PhysicalFonts.setRegex(regex);


            FOSettings foSettings = Docx4J.createFOSettings();
            boolean saveFO = true;
            if (saveFO) {
                foSettings.setFoDumpFile(new java.io.File(System.getProperty("user.dir")
                        + "/sample-docs/word/modificados/FOsetting" + ".fo"));
            }

            foSettings.setWmlPackage(wordMLPackage);

            OutputStream os = new java.io.FileOutputStream(outputfilepath);


            foSettings.setApacheFopMime(FOSettings.MIME_PDF);


            //i tried this
            Docx4J.toFO(foSettings, os, Docx4J.FLAG_EXPORT_PREFER_XSL);
            //i tried this to
            //Docx4J.toPDF(wordMLPackage, os);


            // Clean up, so any ObfuscatedFontPart temp files can be deleted
            if (wordMLPackage.getMainDocumentPart().getFontTablePart() != null) {
                wordMLPackage.getMainDocumentPart().getFontTablePart().deleteEmbeddedFontTempFiles();
            }
            // This would also do it, via finalize() methods
            updater = null;
            foSettings = null;
            wordMLPackage = null;
        } catch (Exception ex) {
            Logger.getLogger(VariableReplace.class.getName()).log(Level.SEVERE, null, ex);
        }

Re: Error on convert pdf with FO on docx4j.3.3.1

PostPosted: Sun Sep 11, 2016 4:01 am
by jason
java.lang.NoSuchMethodException: org.apache.fop.apps.FopFactory.newInstance ()
at java.lang.Class.getDeclaredMethod (Class.java:2130)


What FOP is on your classpath? You need fop-2.1 and only fop-2.1.

Re: Error on convert pdf with FO on docx4j.3.3.1

PostPosted: Sat Sep 24, 2016 12:29 am
by johnnycoppini
Jason,

fop 2.1

My libs:

    antlr-2.7.7.jar}:\
    antlr-runtime-3.5.2.jar}:\
    avalon-framework-api-4.3.1.jar}:\
    avalon-framework-impl-4.3.1.jar}:\
    commons-codec-1.10.jar}:\
    commons-io-2.4.jar}:\
    commons-lang3-3.4.jar}:\
    commons-logging-1.1.3.jar}:\
    guava-19.0.jar}:\
    httpclient-4.5.2.jar}:\
    httpcore-4.4.4.jar}:\
    jackson-annotations-2.7.0.jar}:\
    jackson-core-2.7.3.jar}:\
    jackson-databind-2.7.3.jar}:\
    jaxb-svg11-1.0.2.jar}:\
    lorem-2.0.jar}:\
    mbassador-1.2.4.2.jar}:\
    serializer-2.7.2.jar}:\
    slf4j-api-1.7.21.jar}:\
    stringtemplate-3.2.1.jar}:\
    wmf2svg-0.9.8.jar}:\
    xmlgraphics-commons-2.1.jar}:\
    batik-anim-1.7.jar}:\
    batik-awt-util-1.7.jar}:\
    batik-bridge-1.7.jar}:\
    batik-css-1.7.jar}:\
    batik-dom-1.7.jar}:\
    batik-ext-1.7.jar}:\
    batik-extension-1.7.jar}:\
    batik-gvt-1.7.jar}:\
    batik-js-1.7.jar}:\
    batik-parser-1.7.jar}:\
    batik-script-1.7.jar}:\
    batik-svg-dom-1.7.jar}:\
    batik-svggen-1.7.jar}:\
    batik-transcoder-1.7.jar}:\
    batik-util-1.7.jar}:\
    batik-xml-1.7.jar}:\
    jaxb-xslfo-1.0.1.jar}:\
    fop-2.1.jar}:\
    docx4j-3.3.1.jar}:\
    docx4j-export-fo-3.3.1-nightly-20160901.jar}:\
    xalan-2.7.2.jar}

Re: Error on convert pdf with FO on docx4j.3.3.1

PostPosted: Sat Sep 24, 2016 7:33 am
by jason
Do you still get the error java.lang.NoSuchMethodException: org.apache.fop.apps.FopFactory.newInstance?

If so, confirm your fop-2.1.jar contains org.apache.fop.apps.FopFactory.newInstance; confirm it is really on your classpath.

What environment are you working in: An IDE? An AppServer?

What do the docx4j logs say?

Re: Error on convert pdf with FO on docx4j.3.3.1

PostPosted: Mon Sep 26, 2016 10:18 pm
by johnnycoppini
hi Jason,

I checked class org.apache.fop.apps.FopFactory.newInstance, it is in the classpath. There is 3 newInstance methods (receiving FopFactoryConfig, File, URI and URI+inputStream).

I am using Netbeans, and the project is Java project kind, running local, without any server.

The problem is: in some instruction, the program generated a new fop config, but it forgot to add foDumpFile paramenter in the tree map (see the attachments)

If you prefer, i can send you the project by e-mail. It's just a test project.


Thanks for your help.
Sorry about my english

Re: Error on convert pdf with FO on docx4j.3.3.1

PostPosted: Wed Sep 28, 2016 11:10 am
by johnnycoppini
Jason,

I made some tests in another app, running in apache. Now i can see java.lang.NoSuchMethodException: org.apache.fop.apps.FopFactory.newInstance()

logs:

Code: Select all
465 [http-nio-8084-exec-6] INFO org.docx4j.jaxb.Context - java.vendor=Oracle Corporation
465 [http-nio-8084-exec-6] INFO org.docx4j.jaxb.Context - java.version=1.7.0_51
1006 [http-nio-8084-exec-6] INFO org.docx4j.jaxb.Context - No MOXy JAXB config found; assume not intended..
1316 [http-nio-8084-exec-6] INFO org.docx4j.jaxb.NamespacePrefixMapperUtils - Using NamespacePrefixMapperSunInternal, which is suitable for Java 6
1316 [http-nio-8084-exec-6] INFO org.docx4j.jaxb.Context - Using Java 6/7 JAXB implementation
36938 [http-nio-8084-exec-6] INFO org.docx4j.jaxb.Context - Not using MOXy; using com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl
39637 [http-nio-8084-exec-6] WARN org.docx4j.utils.ResourceUtils - Couldn't get resource: docx4j.properties
39637 [http-nio-8084-exec-6] WARN org.docx4j.Docx4jProperties - Couldn't find/read docx4j.properties; docx4j.properties not found via classloader.
39638 [http-nio-8084-exec-6] INFO org.docx4j.XmlUtils - setProperty com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl
39638 [http-nio-8084-exec-6] INFO org.docx4j.XmlUtils - actual: com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl
39638 [http-nio-8084-exec-6] INFO org.docx4j.XmlUtils - setProperty com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl
39639 [http-nio-8084-exec-6] INFO org.docx4j.XmlUtils - actual: com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl
39701 [http-nio-8084-exec-6] INFO org.docx4j.openpackaging.contenttype.ContentTypeManager - Detected WordProcessingML package
39713 [http-nio-8084-exec-6] INFO org.docx4j.openpackaging.io3.Load3 - Instantiated package of type org.docx4j.openpackaging.packages.WordprocessingMLPackage
39739 [http-nio-8084-exec-6] INFO org.docx4j.utils.XPathFactoryUtil - xpath implementation: org.apache.xpath.jaxp.XPathFactoryImpl
39810 [http-nio-8084-exec-6] INFO org.docx4j.openpackaging.io3.Load3 - package read;  elapsed time: 39576 ms
71444 [http-nio-8084-exec-6] INFO org.docx4j.openpackaging.parts.DocPropsCorePart - unmarshalling org.docx4j.openpackaging.parts.DocPropsCorePart
71452 [http-nio-8084-exec-6] INFO org.docx4j.openpackaging.parts.DocPropsExtendedPart - unmarshalling org.docx4j.openpackaging.parts.DocPropsExtendedPart
72549 [http-nio-8084-exec-6] INFO org.docx4j.model.fields.FieldUpdater -

Simple Fields in /word/document.xml
=============
Found 0 simple fields

Complex Fields in /word/document.xml
==============
Found 0 fields

/word/header1.xml


Simple Fields in /word/header1.xml
=============
Found 0 simple fields

Complex Fields in /word/header1.xml
==============
Found 0 fields

/word/footer1.xml


Simple Fields in /word/footer1.xml
=============
Found 0 simple fields

Complex Fields in /word/footer1.xml
==============
Found 0 fields

83583 [http-nio-8084-exec-6] WARN org.docx4j.fonts.PhysicalFonts - Aborting: file:/Library/Fonts/Impact.ttf (can't get EmbedFontInfo[] .. try deleting fop-fonts.cache?)
83760 [http-nio-8084-exec-6] WARN org.docx4j.fonts.PhysicalFonts - Aborting: file:/System/Library/Fonts/Apple%20Symbols.ttc (can't get EmbedFontInfo[] .. try deleting fop-fonts.cache?)
83813 [http-nio-8084-exec-6] WARN org.docx4j.fonts.PhysicalFonts - Aborting: file:/System/Library/Fonts/Symbol.ttf (can't get EmbedFontInfo[] .. try deleting fop-fonts.cache?)
83825 [http-nio-8084-exec-6] WARN org.docx4j.fonts.IdentityPlusMapper - WARNING! SubstituterWindowsPlatformImpl works best on Windows.  To get good results on other platforms, you'll probably  need to have installed Windows fonts.
83862 [http-nio-8084-exec-6] INFO org.docx4j.fonts.RunFontSelector - rPrDefault/rFonts referenced Times New Roman
87344 [http-nio-8084-exec-6] INFO org.docx4j.openpackaging.parts.WordprocessingML.FontTablePart - Writing temp embedded fonts 1475020034538
87345 [http-nio-8084-exec-6] WARN org.docx4j.fonts.IdentityPlusMapper - - - No physical font for: Times New Roman
87345 [http-nio-8084-exec-6] WARN org.docx4j.fonts.IdentityPlusMapper - - - No physical font for: Calibri
87346 [http-nio-8084-exec-6] INFO org.docx4j.fonts.RunFontSelector - rPrDefault/rFonts referenced Times New Roman
87347 [http-nio-8084-exec-6] WARN org.docx4j.fonts.RunFontSelector - Font 'Times New Roman' is not mapped to a physical font.
90742 [http-nio-8084-exec-6] INFO org.docx4j.openpackaging.parts.WordprocessingML.FontTablePart - Writing temp embedded fonts 1475020037936
91232 [http-nio-8084-exec-6] INFO org.docx4j.convert.out.common.preprocess.FieldsCombiner - starting
91358 [http-nio-8084-exec-6] INFO org.docx4j.convert.out.common.preprocess.CoverPageSectPrMover - No need to move sectPr
92797 [http-nio-8084-exec-6] INFO org.docx4j.model.structure.PageDimensions - No cols in this section; defaulting.
93059 [http-nio-8084-exec-6] INFO org.docx4j.fonts.RunFontSelector - rPrDefault/rFonts referenced Times New Roman
93059 [http-nio-8084-exec-6] WARN org.docx4j.fonts.RunFontSelector - Font 'Times New Roman' is not mapped to a physical font.
93059 [http-nio-8084-exec-6] WARN org.docx4j.fonts.RunFontSelector - Times New Roman is not mapped!
97072 [http-nio-8084-exec-6] INFO org.docx4j.XmlUtils - Using org.apache.xalan.transformer.TransformerImpl
97392 [http-nio-8084-exec-6] INFO org.docx4j.convert.out.common.AbstractConversionContext - /pkg:package
98007 [http-nio-8084-exec-6] INFO org.docx4j.fonts.RunFontSelector - rPrDefault/rFonts referenced Times New Roman
98007 [http-nio-8084-exec-6] WARN org.docx4j.fonts.RunFontSelector - Font 'Times New Roman' is not mapped to a physical font.
101380 [http-nio-8084-exec-6] INFO org.docx4j.openpackaging.parts.WordprocessingML.FontTablePart - Writing temp embedded fonts 1475020048574
101393 [http-nio-8084-exec-6] INFO org.docx4j.convert.out.common.preprocess.FieldsCombiner - starting
101398 [http-nio-8084-exec-6] INFO org.docx4j.convert.out.common.preprocess.CoverPageSectPrMover - No need to move sectPr
101444 [http-nio-8084-exec-6] INFO org.docx4j.model.structure.PageDimensions - No cols in this section; defaulting.
101446 [http-nio-8084-exec-6] INFO org.docx4j.fonts.RunFontSelector - rPrDefault/rFonts referenced Times New Roman
101446 [http-nio-8084-exec-6] WARN org.docx4j.fonts.RunFontSelector - Font 'Times New Roman' is not mapped to a physical font.
101446 [http-nio-8084-exec-6] WARN org.docx4j.fonts.RunFontSelector - Times New Roman is not mapped!
101601 [http-nio-8084-exec-6] INFO org.docx4j.XmlUtils - Using org.apache.xalan.transformer.TransformerImpl
101603 [http-nio-8084-exec-6] INFO org.docx4j.convert.out.common.AbstractConversionContext - /pkg:package
131969 [http-nio-8084-exec-6] WARN org.docx4j.fonts.RunFontSelector - Font 'Calibri' is not mapped to a physical font.
132028 [http-nio-8084-exec-6] WARN org.docx4j.fonts.RunFontSelector - Font 'Calibri' is not mapped to a physical font.
132065 [http-nio-8084-exec-6] WARN org.docx4j.fonts.RunFontSelector - Font 'Calibri' is not mapped to a physical font.
132142 [http-nio-8084-exec-6] WARN org.docx4j.fonts.RunFontSelector - Font 'Calibri' is not mapped to a physical font.
132284 [http-nio-8084-exec-6] WARN org.docx4j.fonts.RunFontSelector - Font 'Times New Roman' is not mapped to a physical font.
132334 [http-nio-8084-exec-6] WARN org.docx4j.fonts.RunFontSelector - Font 'Times New Roman' is not mapped to a physical font.
132389 [http-nio-8084-exec-6] WARN org.docx4j.fonts.RunFontSelector - Font 'Times New Roman' is not mapped to a physical font.
132437 [http-nio-8084-exec-6] WARN org.docx4j.fonts.RunFontSelector - Font 'Times New Roman' is not mapped to a physical font.
132476 [http-nio-8084-exec-6] INFO org.docx4j.fonts.RunFontSelector - rPrDefault/rFonts referenced Times New Roman
132476 [http-nio-8084-exec-6] WARN org.docx4j.fonts.RunFontSelector - Font 'Times New Roman' is not mapped to a physical font.
132569 [http-nio-8084-exec-6] WARN org.docx4j.fonts.fop.util.FopConfigUtil - Document font Times New Roman is not mapped to a physical font!
132569 [http-nio-8084-exec-6] WARN org.docx4j.fonts.fop.util.FopConfigUtil - Document font Calibri is not mapped to a physical font!
log4j:WARN No appenders could be found for logger (org.apache.xmlgraphics.image.loader.spi.ImageImplRegistry).
log4j:WARN Please initialize the log4j system properly.
133817 [http-nio-8084-exec-6] WARN org.docx4j.convert.out.fo.renderers.FORendererApacheFOP - Can't set up FOP svn; null
java.lang.NoSuchMethodException: org.apache.fop.apps.FopFactory.newInstance()
   at java.lang.Class.getDeclaredMethod(Class.java:2004)
   at org.docx4j.convert.out.fo.renderers.FORendererApacheFOP.createFopFactory(FORendererApacheFOP.java:329)
   at org.docx4j.convert.out.fo.renderers.FORendererApacheFOP.getFopFactory(FORendererApacheFOP.java:253)
   at org.docx4j.convert.out.fo.renderers.FORendererApacheFOP.render(FORendererApacheFOP.java:119)
   at org.docx4j.convert.out.fo.AbstractFOExporter.postprocess(AbstractFOExporter.java:168)
   at org.docx4j.convert.out.fo.AbstractFOExporter.postprocess(AbstractFOExporter.java:47)
   at org.docx4j.convert.out.common.AbstractExporter.export(AbstractExporter.java:82)
   at org.docx4j.Docx4J.toFO(Docx4J.java:568)

Re: Error on convert pdf with FO on docx4j.3.3.1

PostPosted: Thu Sep 29, 2016 11:28 am
by egavaldo
Hi Jason,
Eric here. I too have the same issue:

It looks like in the version of FOP included in 3.3.1 (2.1), FopFactory.newInstance() have to be passed an argument.
I guess Docx4J.toFO() does not pass anything.

In my case the exception is thrown when this is executed:
Code: Select all
Docx4J.toFO(foSettings, os, Docx4J.FLAG_EXPORT_PREFER_XSL);


And the Exception is this one:
Code: Select all
Add tc row 5 col 1+-1
Add tc row 6 col 1+-1
Add tc row 7 col 1+-1
Add tc row 8 col 1+-1
java.lang.NoSuchMethodException: org.apache.fop.apps.FopFactory.newInstance()
   at java.lang.Class.getDeclaredMethod(Class.java:2130)
   at org.docx4j.convert.out.fo.renderers.FORendererApacheFOP.createFopFactory(FORendererApacheFOP.java:329)
   at org.docx4j.convert.out.fo.renderers.FORendererApacheFOP.getFopFactory(FORendererApacheFOP.java:253)
   at org.docx4j.convert.out.fo.renderers.FORendererApacheFOP.render(FORendererApacheFOP.java:119)
   at org.docx4j.convert.out.fo.AbstractFOExporter.postprocess(AbstractFOExporter.java:168)
   at org.docx4j.convert.out.fo.AbstractFOExporter.postprocess(AbstractFOExporter.java:47)
   at org.docx4j.convert.out.common.AbstractExporter.export(AbstractExporter.java:82)
   at org.docx4j.Docx4J.toFO(Docx4J.java:568)
   at com.xqual.xstudio.gui.module.report.CReportUtils.convertToPdf(CReportUtils.java:971)
   at com.xqual.xstudio.gui.module.report.CPanel_CampaignSessionReportChooser.submit(CPanel_CampaignSessionReportChooser.java:335)
   at com.xqual.xstudio.gui.module.CControlbar.actionPerformed(CControlbar.java:575)
   at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
   at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
   at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
   at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
   at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
   at java.awt.Component.processMouseEvent(Component.java:6533)
   at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
   at java.awt.Component.processEvent(Component.java:6298)
   at java.awt.Container.processEvent(Container.java:2236)
   at java.awt.Component.dispatchEventImpl(Component.java:4889)
   at java.awt.Container.dispatchEventImpl(Container.java:2294)
   at java.awt.Component.dispatchEvent(Component.java:4711)
   at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4888)
   at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4525)
   at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4466)
   at java.awt.Container.dispatchEventImpl(Container.java:2280)
   at java.awt.Window.dispatchEventImpl(Window.java:2746)
   at java.awt.Component.dispatchEvent(Component.java:4711)
   at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
   at java.awt.EventQueue.access$500(EventQueue.java:97)
   at java.awt.EventQueue$3.run(EventQueue.java:709)
   at java.awt.EventQueue$3.run(EventQueue.java:703)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
   at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
   at java.awt.EventQueue$4.run(EventQueue.java:731)
   at java.awt.EventQueue$4.run(EventQueue.java:729)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
   at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
   at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
   at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
   at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:109)
   at java.awt.WaitDispatchSupport$2.run(WaitDispatchSupport.java:184)
   at java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:229)
   at java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:227)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.awt.WaitDispatchSupport.enter(WaitDispatchSupport.java:227)
   at java.awt.Dialog.show(Dialog.java:1084)
   at java.awt.Component.show(Component.java:1671)
   at java.awt.Component.setVisible(Component.java:1623)
   at java.awt.Window.setVisible(Window.java:1014)
   at java.awt.Dialog.setVisible(Dialog.java:1005)
   at com.xqual.xstudio.gui.module.CActions.displayPopup(CActions.java:7259)
   at com.xqual.xstudio.gui.module.CActions.displayPopup(CActions.java:7231)
   at com.xqual.xstudio.gui.module.CActions.displayPopup(CActions.java:7225)
   at com.xqual.xstudio.gui.module.CActions.displayPopup(CActions.java:7222)
   at com.xqual.xstudio.gui.module.CActions.showCampaignSessionReportChooser(CActions.java:2261)
   at com.xqual.xstudio.gui.module.CToolbar.actionPerformed(CToolbar.java:8775)
   at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
   at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
   at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
   at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
   at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
   at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:289)
   at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:289)
   at java.awt.Component.processMouseEvent(Component.java:6533)
   at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
   at java.awt.Component.processEvent(Component.java:6298)
   at java.awt.Container.processEvent(Container.java:2236)
   at java.awt.Component.dispatchEventImpl(Component.java:4889)
   at java.awt.Container.dispatchEventImpl(Container.java:2294)
   at java.awt.Component.dispatchEvent(Component.java:4711)
   at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4888)
   at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4525)
   at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4466)
   at java.awt.Container.dispatchEventImpl(Container.java:2280)
   at java.awt.Window.dispatchEventImpl(Window.java:2746)
   at java.awt.Component.dispatchEvent(Component.java:4711)
   at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
   at java.awt.EventQueue.access$500(EventQueue.java:97)
   at java.awt.EventQueue$3.run(EventQueue.java:709)
   at java.awt.EventQueue$3.run(EventQueue.java:703)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
   at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
   at java.awt.EventQueue$4.run(EventQueue.java:731)
   at java.awt.EventQueue$4.run(EventQueue.java:729)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
   at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
   at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
   at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
   at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
   at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
org.docx4j.openpackaging.exceptions.Docx4JException: Exception exporting package
   at org.docx4j.convert.out.common.AbstractExporter.export(AbstractExporter.java:109)
   at org.docx4j.Docx4J.toFO(Docx4J.java:568)
   at com.xqual.xstudio.gui.module.report.CReportUtils.convertToPdf(CReportUtils.java:971)
   at com.xqual.xstudio.gui.module.report.CPanel_CampaignSessionReportChooser.submit(CPanel_CampaignSessionReportChooser.java:335)
   at com.xqual.xstudio.gui.module.CControlbar.actionPerformed(CControlbar.java:575)
   at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
   at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
   at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
   at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
   at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
   at java.awt.Component.processMouseEvent(Component.java:6533)
   at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
   at java.awt.Component.processEvent(Component.java:6298)
   at java.awt.Container.processEvent(Container.java:2236)
   at java.awt.Component.dispatchEventImpl(Component.java:4889)
   at java.awt.Container.dispatchEventImpl(Container.java:2294)
   at java.awt.Component.dispatchEvent(Component.java:4711)
   at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4888)
   at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4525)
   at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4466)
   at java.awt.Container.dispatchEventImpl(Container.java:2280)
   at java.awt.Window.dispatchEventImpl(Window.java:2746)
   at java.awt.Component.dispatchEvent(Component.java:4711)
   at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
   at java.awt.EventQueue.access$500(EventQueue.java:97)
   at java.awt.EventQueue$3.run(EventQueue.java:709)
   at java.awt.EventQueue$3.run(EventQueue.java:703)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
   at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
   at java.awt.EventQueue$4.run(EventQueue.java:731)
   at java.awt.EventQueue$4.run(EventQueue.java:729)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
   at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
   at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
   at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
   at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:109)
   at java.awt.WaitDispatchSupport$2.run(WaitDispatchSupport.java:184)
   at java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:229)
   at java.awt.WaitDispatchSupport$4.run(WaitDispatchSupport.java:227)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.awt.WaitDispatchSupport.enter(WaitDispatchSupport.java:227)
   at java.awt.Dialog.show(Dialog.java:1084)
   at java.awt.Component.show(Component.java:1671)
   at java.awt.Component.setVisible(Component.java:1623)
   at java.awt.Window.setVisible(Window.java:1014)
   at java.awt.Dialog.setVisible(Dialog.java:1005)
   at com.xqual.xstudio.gui.module.CActions.displayPopup(CActions.java:7259)
   at com.xqual.xstudio.gui.module.CActions.displayPopup(CActions.java:7231)
   at com.xqual.xstudio.gui.module.CActions.displayPopup(CActions.java:7225)
   at com.xqual.xstudio.gui.module.CActions.displayPopup(CActions.java:7222)
   at com.xqual.xstudio.gui.module.CActions.showCampaignSessionReportChooser(CActions.java:2261)
   at com.xqual.xstudio.gui.module.CToolbar.actionPerformed(CToolbar.java:8775)
   at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
   at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
   at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
   at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
   at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
   at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:289)
   at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:289)
   at java.awt.Component.processMouseEvent(Component.java:6533)
   at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
   at java.awt.Component.processEvent(Component.java:6298)
   at java.awt.Container.processEvent(Container.java:2236)
   at java.awt.Component.dispatchEventImpl(Component.java:4889)
   at java.awt.Container.dispatchEventImpl(Container.java:2294)
   at java.awt.Component.dispatchEvent(Component.java:4711)
   at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4888)
   at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4525)
   at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4466)
   at java.awt.Container.dispatchEventImpl(Container.java:2280)
   at java.awt.Window.dispatchEventImpl(Window.java:2746)
   at java.awt.Component.dispatchEvent(Component.java:4711)
   at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
   at java.awt.EventQueue.access$500(EventQueue.java:97)
   at java.awt.EventQueue$3.run(EventQueue.java:709)
   at java.awt.EventQueue$3.run(EventQueue.java:703)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
   at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
   at java.awt.EventQueue$4.run(EventQueue.java:731)
   at java.awt.EventQueue$4.run(EventQueue.java:729)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
   at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
   at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
   at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
   at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
   at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Caused by: java.lang.NullPointerException
   at org.docx4j.convert.out.fo.renderers.FORendererApacheFOP.render(FORendererApacheFOP.java:199)
   at org.docx4j.convert.out.fo.renderers.FORendererApacheFOP.render(FORendererApacheFOP.java:159)
   at org.docx4j.convert.out.fo.AbstractFOExporter.postprocess(AbstractFOExporter.java:168)
   at org.docx4j.convert.out.fo.AbstractFOExporter.postprocess(AbstractFOExporter.java:47)
   at org.docx4j.convert.out.common.AbstractExporter.export(AbstractExporter.java:82)
   ... 91 more


Any workaround ?
Eg\\*

Re: Error on convert pdf with FO on docx4j.3.3.1

PostPosted: Tue Oct 11, 2016 4:24 pm
by jason
The diagnostics we need to see are at https://github.com/plutext/docx4j-expor ... .java#L320

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
                } catch (Exception e) {
                        log.warn("Can't set up FOP svn; " + e.getMessage() );
                        log.debug(e.getMessage(), e);
 
Parsed in 0.013 seconds, using GeSHi 1.0.8.4


So please turn on DEBUG level logging for class org.docx4j.convert.out.fo.renderers.FORendererApacheFOP

To do that, please see the comments at https://github.com/plutext/docx4j/blob/ ... /log4j.xml

Re: Error on convert pdf with FO on docx4j.3.3.1

PostPosted: Tue Oct 11, 2016 4:35 pm
by jason
Now tracking this as https://github.com/plutext/docx4j-export-FO/issues/1

Johnny, also, where did you get your FOP 2.1? From Maven?

Re: Error on convert pdf with FO on docx4j.3.3.1

PostPosted: Tue Oct 11, 2016 10:22 pm
by johnnycoppini
Jason,

I downloaded from http://www.docx4java.org/docx4j/docx4j- ... -3.3.1.zip
But i tried with this one too: https://mvnrepository.com/artifact/org. ... cs/fop/2.1, with no sucess.

Re: Error on convert pdf with FO on docx4j.3.3.1

PostPosted: Thu Oct 13, 2016 9:40 am
by jason
Please try http://www.docx4java.org/docx4j/docx4j- ... 161012.jar and report the stack trace

Re: Error on convert pdf with FO on docx4j.3.3.1

PostPosted: Thu Oct 13, 2016 10:35 pm
by johnnycoppini
Jason,

I ran it with the new file you sent. The error message has changed and then I realized that a class was missing.
Then I replaced all the .jar version 1.7 of batik to version 1.8
Just replace the versions (1.7 -1.8) that the problem is solved without to change the docx4j-export-fo-3.3.0.jar

Add this issue in traking

Thank you for your help