mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
- fixing a bug in jsf usage in create form details screen
- adding a sample of pdf renditioning - adding all necessary jars for fop - specifying xerces version in jar file name - fixing error in simple-test.ftl git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@4237 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -56,38 +56,30 @@ public class XSLFORenderingEngine
|
||||
super(nodeRef, nodeService, contentService);
|
||||
}
|
||||
|
||||
public void generate(final Document xmlContent,
|
||||
final Map<String, String> parameters,
|
||||
final OutputStream out)
|
||||
public void render(final Document xmlContent,
|
||||
final Map<String, String> parameters,
|
||||
final OutputStream out)
|
||||
throws IOException,
|
||||
RenderingEngine.RenderingException
|
||||
{
|
||||
Result result = null;
|
||||
try
|
||||
{
|
||||
final FopFactory fopFactory = FopFactory.newInstance();
|
||||
final FOUserAgent foUserAgent = fopFactory.newFOUserAgent();
|
||||
final Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent, out);
|
||||
|
||||
final Fop fop = fopFactory.newFop(this.getMimetypeForRendition(),
|
||||
foUserAgent,
|
||||
out);
|
||||
// Resulting SAX events (the generated FO) must be piped through to FOP
|
||||
final Result result = new SAXResult(fop.getDefaultHandler());
|
||||
result = new SAXResult(fop.getDefaultHandler());
|
||||
|
||||
super.render(new DOMSource(xmlContent), parameters, result);
|
||||
|
||||
// Result processing
|
||||
FormattingResults foResults = fop.getResults();
|
||||
java.util.List pageSequences = foResults.getPageSequences();
|
||||
for (java.util.Iterator it = pageSequences.iterator(); it.hasNext();)
|
||||
{
|
||||
PageSequenceResults pageSequenceResults = (PageSequenceResults)it.next();
|
||||
System.out.println("PageSequence "
|
||||
+ (String.valueOf(pageSequenceResults.getID()).length() > 0
|
||||
? pageSequenceResults.getID() : "<no id>")
|
||||
+ " generated " + pageSequenceResults.getPageCount() + " pages.");
|
||||
}
|
||||
System.out.println("Generated " + foResults.getPageCount() + " pages in total.");
|
||||
}
|
||||
catch (FOPException fope)
|
||||
{
|
||||
throw new RenderingEngine.RenderingException(fope);
|
||||
}
|
||||
|
||||
super.render(new DOMSource(xmlContent), parameters, result);
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user