Dynamic Document Generator

Overview

This version is for Appian 23.2 and above. Cloud customers on a lower version of Appian that want to install this plugin should open a support case. Self-managed customers can find the latest jar for Appian 23.1 and lower version in the folder pre-23.2

Convert, merge and generate DOCX, PDF and XML files automatically in an Appian process

Key Features & Functionality

  • PDF from single DOCX with Fonts
    • Convert multiple DOCX files into a single PDF. Please note that the translation from DOCX to PDF is not always 1:1. The template may need to be tweaked or simplified to achieve the desired results.
  • PDF from DOCX without Fonts
    • Convert multiple DOCX files into a single PDF. Please note that the translation from DOCX to PDF is not always 1:1. The template may need to be tweaked or simplified to achieve the desired results. This will not support fonts.
  • PDF from XSL-FO Transformation
    • Uses XSLT to convert an XML to XSL-FO which is then converted to PDF
  • PDF from HTML
    • Converts an HTML document into a single page PDF.
  • PDF from HTML Transformation
    • Uses XSLT to convert an XML to HTML which is then converted to PDF
  • Text Doc from XSLT
    • Uses XSLT to convert an XML to a plain text document (such as HTML, another XML doc, etc).
  • DOCX from XHTML With Styling
    • Converts a valid XHTML file into a DOCX, allowing you to provide your own template file for style reference. Useful for creating dynamic documents that are editable
  • DOCX Merge
    • Merges one or more DOCX files together. If a header or footer exists in any document, they will be removed during the merge process.
    • A configurable separator can be specified: none, line break or page break

Function: xsltransform - Transform source XML using XSL Transform

Anonymous
  • Hi Raza Mir(Author)

    We are having issues with this plugin when generating a PDF doc form DOCX. This plugin is working whit out any issues until 21.2 Version. We recently upgraded one environment to Appian latest version 21.3. After this upgrade the PDF from Single DOCX (with Fonts) smart service is breaking when generating  document. The same DOCX document we will be able to convert in other environments(21.2). We are not sure what is the root cause. I see based on the documentation it supports until 20.4. Could you please update this plugin to support the latest versions. 

    The following is the log error from the tomcat-stdOut.log

    Fri Sep 10 17:03:08 GMT 2021 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
    org.docx4j.org.xhtmlrenderer.load INFO:: SAX XMLReader in use (parser): org.apache.xerces.parsers.SAXParser
    org.docx4j.org.xhtmlrenderer.load INFO:: Loaded document in ~2ms
    org.docx4j.org.xhtmlrenderer.load INFO:: TIME: parse stylesheets  2ms
    org.docx4j.org.xhtmlrenderer.match INFO:: media = print
    org.docx4j.org.xhtmlrenderer.match INFO:: Matcher created with 140 selectors
    2021-09-10 17:03:11,172 [Appian Work Item - 18654 - execution01 : UnattendedJavaActivityRequest] ERROR com.appiancorp.process.engine.UnattendedJavaActivityRequest - An error occurred while executing activity: id=268443458, classname=com.appiancorp.ps.xmlfo.ss.PdfFromDocxWithFonts
    com.appiancorp.suiteapi.process.exceptions.SmartServiceException: org.docx4j.openpackaging.exceptions.Docx4JException: Exception exporting package
    	at com.appiancorp.suiteapi.process.exceptions.SmartServiceException$Builder.build(SmartServiceException.java:145)
    	at com.appiancorp.ps.xmlfo.ss.AbstractDocumentGeneration.run(AbstractDocumentGeneration.java:57)
    	at com.appiancorp.process.runtime.framework.DefaultActivityExecutor$1.lambda$call$0(DefaultActivityExecutor.java:131)
    	at com.appiancorp.plugins.PluginUsageLogger.runWithPluginInformation(PluginUsageLogger.java:52)
    	at com.appiancorp.process.runtime.framework.DefaultActivityExecutor$1.call(DefaultActivityExecutor.java:131)
    	at com.appiancorp.process.runtime.framework.DefaultActivityExecutor$1.call(DefaultActivityExecutor.java:125)
    	at com.appiancorp.common.ContextClassLoaderSwitcher.runInContext(ContextClassLoaderSwitcher.java:27)
    	at com.appiancorp.process.runtime.framework.DefaultActivityExecutor.execute(DefaultActivityExecutor.java:125)
    	at com.appiancorp.process.engine.UnattendedJavaActivityRequest.execute(UnattendedJavaActivityRequest.java:88)
    	at com.appiancorp.process.engine.UnattendedJavaActivityRequestResponseCreator.getJavaActivityResultResponse(UnattendedJavaActivityRequestResponseCreator.java:21)
    	at com.appiancorp.process.engine.UnattendedJavaActivityRequest.getJavaActivityResultResponse(UnattendedJavaActivityRequest.java:67)
    	at com.appiancorp.process.engine.UnattendedJavaActivityRequest.execute0(UnattendedJavaActivityRequest.java:55)
    	at com.appiancorp.common.persistence.data.AppianDataUserContextProvider.executeWithConsistentDataReads(AppianDataUserContextProvider.java:116)
    	at com.appiancorp.process.engine.ProcessContinuationRequest.executeOuter(ProcessContinuationRequest.java:68)
    	at com.appiancorp.process.engine.ContinuationRequest.execute(ContinuationRequest.java:123)
    	at com.appiancorp.process.workpoller.UnattendedRequestHandlerBean.onMessage(UnattendedRequestHandlerBean.java:36)
    	at com.appiancorp.process.workpoller.WorkItem.run(WorkItem.java:94)
    	at org.springframework.jca.work.SimpleTaskWorkManager$DelegatingWorkAdapter.run(SimpleTaskWorkManager.java:239)
    	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    	at java.lang.Thread.run(Thread.java:748)
    Caused by: org.docx4j.openpackaging.exceptions.Docx4JException: Exception exporting package
    	at org.docx4j.convert.out.common.AbstractExporter.export(AbstractExporter.java:106)
    	at org.docx4j.Docx4J.toFO(Docx4J.java:708)
    	at com.appiancorp.ps.xmlfo.util.XmlFoConverter.docxToPdf(XmlFoConverter.java:103)
    	at com.appiancorp.ps.xmlfo.ss.PdfFromDocxWithFonts.runSmartService(PdfFromDocxWithFonts.java:54)
    	at com.appiancorp.ps.xmlfo.ss.AbstractDocumentGeneration.run(AbstractDocumentGeneration.java:49)
    	... 19 more
    Caused by: org.docx4j.openpackaging.exceptions.Docx4JException: Exception writing Document to OutputStream: org.apache.fop.fo.ValidationException: For "fo:root", "fo:layout-master-set" must be declared before "fo:page-sequence"! (See position 1:258)
    	at org.docx4j.utils.XmlSerializerUtil.serialize(XmlSerializerUtil.java:56)
    	at org.docx4j.utils.XmlSerializerUtil.serialize(XmlSerializerUtil.java:18)
    	at org.docx4j.convert.out.fo.renderers.FORendererApacheFOP.render(FORendererApacheFOP.java:247)
    	at org.docx4j.convert.out.fo.renderers.FORendererApacheFOP.render(FORendererApacheFOP.java:181)
    	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:81)
    	... 23 more
    Caused by: javax.xml.transform.TransformerException: org.apache.fop.fo.ValidationException: For "fo:root", "fo:layout-master-set" must be declared before "fo:page-sequence"! (See position 1:258)
    	at org.docx4j.org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:535)
    	at org.docx4j.utils.XmlSerializerUtil.serialize(XmlSerializerUtil.java:51)
    	... 29 more
    Caused by: org.apache.fop.fo.ValidationException: For "fo:root", "fo:layout-master-set" must be declared before "fo:page-sequence"! (See position 1:258)
    	at org.apache.fop.events.ValidationExceptionFactory.createException(ValidationExceptionFactory.java:38)
    	at org.apache.fop.events.EventExceptionManager.throwException(EventExceptionManager.java:58)
    	at org.apache.fop.events.DefaultEventBroadcaster$1.invoke(DefaultEventBroadcaster.java:173)
    	at com.sun.proxy.$Proxy904.nodeOutOfOrder(Unknown Source)
    	at org.apache.fop.fo.FONode.nodesOutOfOrderError(FONode.java:542)
    	at org.apache.fop.fo.FONode.nodesOutOfOrderError(FONode.java:528)
    	at org.apache.fop.fo.pagination.Root.validateChildNode(Root.java:155)
    	at org.apache.fop.fo.FOTreeBuilder$MainFOHandler.startElement(FOTreeBuilder.java:277)
    	at org.apache.fop.fo.FOTreeBuilder.startElement(FOTreeBuilder.java:179)
    	at org.docx4j.org.apache.xalan.transformer.TransformerIdentityImpl.startElement(TransformerIdentityImpl.java:1119)
    	at org.apache.xerces.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:496)
    	at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:283)
    	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1653)
    	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:324)
    	at org.apache.xerces.parsers.XML11Configuration.parse(XML11Configuration.java:845)
    	at org.apache.xerces.parsers.XML11Configuration.parse(XML11Configuration.java:768)
    	at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:108)
    	at org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1196)
    	at org.docx4j.org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:518)
    	... 30 more
    Fri Sep 10 17:03:11 GMT 2021 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
  • When I try to generate a  DOCX from XHTML in the Appian cloud environment, i'm getting the below error
    Sample CODE:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
       "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
    <head>
     <title>My page title</title>
    </head>
    <body>
    My page content
    </body>
    </html>
    ERROR:
    Exception in thread "ThreadPoolTaskExecutor-1773" java.lang.NoClassDefFoundError: com/lowagie/text/pdf/BaseFont
    	at org.docx4j.org.xhtmlrenderer.docx.DocxRenderer.<init>(DocxRenderer.java:160)
    	at org.docx4j.org.xhtmlrenderer.docx.DocxRenderer.<init>(DocxRenderer.java:85)
    	at org.docx4j.convert.in.xhtml.XHTMLImporterImpl.getRenderer(XHTMLImporterImpl.java:271)
    	at org.docx4j.convert.in.xhtml.XHTMLImporterImpl.convert(XHTMLImporterImpl.java:538)
    	at com.appiancorp.ps.xmlfo.ss.DocxFromXhtmlWithStyling.runSmartService(DocxFromXhtmlWithStyling.java:70)
    	at com.appiancorp.ps.xmlfo.ss.AbstractDocumentGeneration.run(AbstractDocumentGeneration.java:49)
    	at com.appiancorp.process.runtime.framework.DefaultActivityExecutor$1.lambda$call$0(DefaultActivityExecutor.java:131)
    	at com.appiancorp.plugins.PluginUsageLogger.runWithPluginInformation(PluginUsageLogger.java:52)
    	at com.appiancorp.process.runtime.framework.DefaultActivityExecutor$1.call(DefaultActivityExecutor.java:131)
    	at com.appiancorp.process.runtime.framework.DefaultActivityExecutor$1.call(DefaultActivityExecutor.java:125)
    	at com.appiancorp.common.ContextClassLoaderSwitcher.runInContext(ContextClassLoaderSwitcher.java:27)
    	at com.appiancorp.process.runtime.framework.DefaultActivityExecutor.execute(DefaultActivityExecutor.java:125)
    	at com.appiancorp.process.engine.UnattendedJavaActivityRequest.execute(UnattendedJavaActivityRequest.java:88)
    	at com.appiancorp.process.engine.UnattendedJavaActivityRequestResponseCreator.getJavaActivityResultResponse(UnattendedJavaActivityRequestResponseCreator.java:21)
    	at com.appiancorp.process.engine.UnattendedJavaActivityRequest.getJavaActivityResultResponse(UnattendedJavaActivityRequest.java:67)
    	at com.appiancorp.process.engine.UnattendedJavaActivityRequest.execute0(UnattendedJavaActivityRequest.java:55)
    	at com.appiancorp.common.persistence.data.AppianDataUserContextProvider.executeWithConsistentDataReads(AppianDataUserContextProvider.java:116)
    	at com.appiancorp.process.engine.ProcessContinuationRequest.executeOuter(ProcessContinuationRequest.java:68)
    	at com.appiancorp.process.engine.ContinuationRequest.execute(ContinuationRequest.java:123)
    	at com.appiancorp.process.workpoller.UnattendedRequestHandlerBean.onMessage(UnattendedRequestHandlerBean.java:36)
    	at com.appiancorp.process.workpoller.WorkItem.run(WorkItem.java:94)
    	at org.springframework.jca.work.SimpleTaskWorkManager$DelegatingWorkAdapter.run(SimpleTaskWorkManager.java:239)
    	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    	at java.lang.Thread.run(Thread.java:748)
    Caused by: java.lang.ClassNotFoundException: com.lowagie.text.pdf.BaseFont not found by DynamicDocumentGen [89]
    	at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1650)
    	at org.apache.felix.framework.BundleWiringImpl.access$200(BundleWiringImpl.java:80)
    	at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:2064)
    	at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
    	... 25 more
  • v1.8.6 Release Notes
    • Removed dependency on iText
  • Raza, we attempted to upgrade the plugin tot he newest version about 3 weeks ago and got the errors indicated in the below message.  We needed to have Appian revert our version back to the old version because we could not get the new version to work without an error.  Can you please respond to let us know if we have something configuring incorrectly or if you have a fix for the error.

    We even had Appian increase the timeout hoping that would help evaluate the error but we still had the issue.

    Thank you

  • We are using this plugin and the PDF from HTML smart service and are getting a timeout error and the PDFs are not getting created.  This has been working for at least a month and is now failing in all environments and just started yesterday.

    This is part of the log error from the tomcat-stdOut.log

    ERROR com.appiancorp.ps.xmlfo.ss.PdfFromHtml - The PDF generation took longer than 10 seconds
  • We are using this plug in and the PDF from HTML smart service and started receiving errors yesterday and today.  It has been working for at least a month and just started failing in all environments today.  Here is a section of our tomcar-stdOut.log. It does appear that  it is a timeout issue, there are 2 in about 100 that do get converted.

    2021-07-26 16:19:32,413 [Appian Work Item - 40851 - execution09 : UnattendedJavaActivityRequest] ERROR com.appiancorp.ps.xmlfo.ss.PdfFromHtml - The PDF generation took longer than 10 seconds
    INTERRUPTED while loading Image
    2021-07-26 16:19:33,214 [Appian Work Item - 40851 - execution09 : UnattendedJavaActivityRequest] ERROR com.appiancorp.process.engine.UnattendedJavaActivityRequest - An error occurred while executing activity: id=-1878946949, classname=com.appiancorp.ps.xmlfo.ss.PdfFromHtml
    com.appiancorp.suiteapi.process.exceptions.SmartServiceException: java.lang.Exception: Error while generating the PDF file. The PDF file will not be available.
    	at com.appiancorp.suiteapi.process.exceptions.SmartServiceException$Builder.build(SmartServiceException.java:145)
    	at com.appiancorp.ps.xmlfo.ss.AbstractDocumentGeneration.run(AbstractDocumentGeneration.java:57)
    	at com.appiancorp.process.runtime.framework.DefaultActivityExecutor$1.lambda$call$0(DefaultActivityExecutor.java:131)
    	at com.appiancorp.plugins.PluginUsageLogger.runWithPluginInformation(PluginUsageLogger.java:52)
    	at com.appiancorp.process.runtime.framework.DefaultActivityExecutor$1.call(DefaultActivityExecutor.java:131)
    	at com.appiancorp.process.runtime.framework.DefaultActivityExecutor$1.call(DefaultActivityExecutor.java:125)
    	at com.appiancorp.common.ContextClassLoaderSwitcher.runInContext(ContextClassLoaderSwitcher.java:27)
    	at com.appiancorp.process.runtime.framework.DefaultActivityExecutor.execute(DefaultActivityExecutor.java:125)
    	at com.appiancorp.process.engine.UnattendedJavaActivityRequest.execute(UnattendedJavaActivityRequest.java:88)
    	at com.appiancorp.process.engine.UnattendedJavaActivityRequestResponseCreator.getJavaActivityResultResponse(UnattendedJavaActivityRequestResponseCreator.java:21)
    	at com.appiancorp.process.engine.UnattendedJavaActivityRequest.getJavaActivityResultResponse(UnattendedJavaActivityRequest.java:67)
    	at com.appiancorp.process.engine.UnattendedJavaActivityRequest.execute0(UnattendedJavaActivityRequest.java:55)
    	at com.appiancorp.common.persistence.data.AppianDataUserContextProvider.executeWithConsistentDataReads(AppianDataUserContextProvider.java:116)
    	at com.appiancorp.process.engine.ProcessContinuationRequest.executeOuter(ProcessContinuationRequest.java:68)
    	at com.appiancorp.process.engine.ContinuationRequest.execute(ContinuationRequest.java:102)
    	at com.appiancorp.process.workpoller.UnattendedRequestHandlerBean.onMessage(UnattendedRequestHandlerBean.java:36)
    	at com.appiancorp.process.workpoller.WorkItem.run(WorkItem.java:93)
    	at org.springframework.jca.work.SimpleTaskWorkManager$DelegatingWorkAdapter.run(SimpleTaskWorkManager.java:239)
    	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    	at java.lang.Thread.run(Thread.java:748)
    Caused by: java.lang.Exception: Error while generating the PDF file. The PDF file will not be available.
    	at com.appiancorp.ps.xmlfo.ss.PdfFromHtml.runSmartService(PdfFromHtml.java:58)
    	at com.appiancorp.ps.xmlfo.ss.AbstractDocumentGeneration.run(AbstractDocumentGeneration.java:49)
    	... 19 more
    2021-07-26 16:19:58,069 [ajp-nio-0.0.0.0-8009-exec-80] ERROR com.appiancorp.security.auth.saml.redirecter.SamlAuthProviderQueryStringGenerator - Could not find IdP entity Id: Idp Entity Id not stored on session or request
    2021-07-26 16:20:28,988 [Appian Timer - 1] WARN  com.appiancorp.common.ObjectSynchronizer - 1 services were missing users.
    2021-07-26 16:20:53 INFO [ConnectionTimeoutBasicDataSource-1044] com.appiancorp.a2.vpn.VPNTunnelNameService.lookupAllHostAddr DNS Lookup using VPN DNS servers: pwdenapnsql01.janus.cap
    2021-07-26 16:20:53 INFO [ConnectionTimeoutBasicDataSource-1044] sun.nio.ch.VPNDatagramChannel.bind VPNDatagramChannel - Binding to : 172.30.0.6
    2021-07-26 16:20:53 INFO [ConnectionTimeoutBasicDataSource-1044] com.appiancorp.a2.vpn.VPNTunnelNameService.lookupAllHostAddr VPN dns lookup result 10.151.13.75
    2021-07-26 16:21:17,053 [ajp-nio-0.0.0.0-8009-exec-76] ERROR com.appiancorp.ps.xmlfo.ss.PdfFromHtml - The PDF generation took longer than 10 seconds
    INTERRUPTED while loading Image
    2021-07-26 16:21:17,854 [ajp-nio-0.0.0.0-8009-exec-76] ERROR com.appiancorp.process.engine.UnattendedJavaActivityRequest - An error occurred while executing activity: id=1342254558, classname=com.appiancorp.ps.xmlfo.ss.PdfFromHtml
    com.appiancorp.suiteapi.process.exceptions.SmartServiceException: java.lang.Exception: Error while generating the PDF file. The PDF file will not be available.
    	at com.appiancorp.suiteapi.process.exceptions.SmartServiceException$Builder.build(SmartServiceException.java:145)
  • in addition to the above i am passing multiple font documents also

  • Hi Michael Chirlin  need some help. I am using this smart service to generate PDF in Arabic  language., For that I am using pdf from docx with fonts. I see that arabic characters are displayed as #### etc.  We are going with an approach like docx templates are created by client and Appian should  generate docx based on the given template and convert it to PDF.  Is there any other way that can be used to generate pdf in Arabic language/ utf-8 support

  • Hello.

    I've deployed the plug-in, but cannot find the "DOCX from XHTML With Styling" smart service with in the process modeler.

    How can I use the "DOCX from XHTML With Styling" smart service? Need Help ASAP.

    Thanks