Question
4
Replies
1064
Views
Posted: December 26, 2016
Last activity: April 14, 2017
Closed
Solved
Need help in converting docx to pdf using docx4j api
The following exceptions are recorded while trying to convert docx to pdf.
Pega 7.2
Exceptions:
2016-12-26 17:22:05,849 [fault (self-tuning)'] [TABTHREAD5] [ ] [testapp:01.01.01] ( org.docx4j.XmlUtils) ERROR XXX.XXX.X.X|XXX.X.X.X user26 - Cannot convert argument/return type in call to method 'org.docx4j.convert.out.fo.XsltFOFunctions.createBlockForPPr(reference, node-set, string, result-tree)'
2016-12-26 17:22:05,851 [fault (self-tuning)'] [TABTHREAD5] [ ] [testapp:01.01.01] ( org.docx4j.XmlUtils) ERROR XXX.XXX.X.X|XXX.X.X.X user26 - Cannot convert argument/return type in call to method 'org.docx4j.convert.out.fo.XsltFOFunctions.createBlockForRPr(reference, node-set, node-set, result-tree)'
2016-12-26 17:22:05,851 [fault (self-tuning)'] [TABTHREAD5] [ ] [testapp:01.01.01] ( org.docx4j.XmlUtils) ERROR XXX.XXX.X.X|XXX.X.X.X user26 - Cannot convert argument/return type in call to method 'org.docx4j.convert.out.common.XsltCommonFunctions.fontSelector(reference, node-set, node-set, node-type)'
2016-12-26 17:22:05,853 [fault (self-tuning)'] [TABTHREAD5] [ ] [testapp:01.01.01] ( org.docx4j.XmlUtils) ERROR XXX.XXX.X.X|XXX.X.X.X user26 - Cannot convert argument/return type in call to method 'org.docx4j.convert.out.fo.XsltFOFunctions.createBlockForSdt(reference, node-set, string, result-tree, string)'
2016-12-26 17:22:05,854 [fault (self-tuning)'] [TABTHREAD5] [ ] [testapp:01.01.01] ( org.docx4j.XmlUtils) ERROR XXX.XXX.X.X|XXX.X.X.X user26 - Cannot convert argument/return type in call to method 'org.docx4j.convert.out.fo.XsltFOFunctions.createBlockForSdt(reference, node-set, string, result-tree, string)'
2016-12-26 17:22:05,855 [fault (self-tuning)'] [TABTHREAD5] [ ] [testapp:01.01.01] ( org.docx4j.XmlUtils) ERROR XXX.XXX.X.X|XXX.X.X.X user26 - Cannot convert argument/return type in call to method 'org.docx4j.convert.out.fo.XsltFOFunctions.createInlineForSdt(reference, node-set, result-tree, string)'
2016-12-26 17:22:05,856 [fault (self-tuning)'] [TABTHREAD5] [ ] [testapp:01.01.01] ( org.docx4j.XmlUtils) ERROR XXX.XXX.X.X|XXX.X.X.X user26 - Cannot convert argument/return type in call to method 'org.docx4j.convert.out.common.XsltCommonFunctions.notImplemented(reference, node-type, string)'
2016-12-26 17:22:05,857 [fault (self-tuning)'] [TABTHREAD5] [ ] [testapp:01.01.01] ( org.docx4j.XmlUtils) ERROR XXX.XXX.X.X|XXX.X.X.X user26 - Cannot convert argument/return type in call to method 'org.docx4j.convert.out.common.XsltCommonFunctions.notImplemented(reference, node-type, string)'
2016-12-26 17:22:05,858 [fault (self-tuning)'] [TABTHREAD5] [ ] [testapp:01.01.01] ( org.docx4j.XmlUtils) ERROR XXX.XXX.X.X|XXX.X.X.X user26 - Cannot convert argument/return type in call to method 'org.docx4j.convert.out.common.XsltCommonFunctions.updateComplexFieldDefinition(reference, node-type)'
2016-12-26 17:22:05,859 [fault (self-tuning)'] [TABTHREAD5] [ ] [testapp:01.01.01] ( org.docx4j.XmlUtils) ERROR XXX.XXX.X.X|XXX.X.X.X user26 - Cannot convert argument/return type in call to method 'org.docx4j.convert.out.common.XsltCommonFunctions.notImplemented(reference, node-type, string)'
2016-12-26 17:22:05,860 [fault (self-tuning)'] [TABTHREAD5] [ ] [testapp:01.01.01] ( org.docx4j.XmlUtils) ERROR XXX.XXX.X.X|XXX.X.X.X user26 - Cannot convert argument/return type in call to method 'org.docx4j.convert.out.common.XsltCommonFunctions.notImplemented(reference, node-type, string)'
2016-12-26 17:22:05,861 [fault (self-tuning)'] [TABTHREAD5] [ ] [testapp:01.01.01] ( out.common.AbstractExporter) ERROR XXX.XXX.X.X|XXX.X.X.X user26 - Exception exporting package
Code:
try {
java.io.InputStream is = new java.io.FileInputStream(new java.io.File("/temp/testing.docx"));
org.docx4j.openpackaging.packages.WordprocessingMLPackage wordMLPackage = org.docx4j.openpackaging.packages.WordprocessingMLPackage.load(is);
java.io.OutputStream out = new java.io.FileOutputStream(new java.io.File("/temp/HelloWorld2.pdf"));
org.docx4j.Docx4J.toPDF(wordMLPackage, out);
} catch (Throwable e) {
oLog.error("Exception while creating pdf:"+e.toString());
}
***Updated by moderator: Lochan to remove proprietary information; add SR details***
Have you restart the server after importing the docx4j api jar file?
Normally when you import third party jar files, you have to do following.
-Stop the server
-Clear your pega temp directory or delete pega extract marker txt file (this is most required)
-Start the server and test your code
Besides what is the codeset and codesetversion that you used to import the .jar file.
Run the below query to know the imported .jar file exist in environment or not.
select pzjar from pr_engineclasses where pzjar like '%docx4j%';
You can also use '=' operator in place of 'like' operator if you know the exact name of the file.