grails.doc.PdfPublisher.groovy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of grails-docs Show documentation
Show all versions of grails-docs Show documentation
Grails Web Application Framework
The newest version!
package grails.doc
import groovy.transform.CompileStatic
import org.w3c.dom.Document
@CompileStatic
class PdfPublisher {
static void publishPdfFromHtml(File outputDir, String child, String pdfName) {
PdfBuilder pdfBuilder = new PdfBuilder()
File currFile = new File(outputDir, child)
String xml = pdfBuilder.createXml(currFile, outputDir.absolutePath)
Document doc = pdfBuilder.createDocument(xml)
File outputFile = new File(currFile.parentFile, pdfName)
File urlBase = new File(outputDir, "guide/single.html")
pdfBuilder.createPdfWithDocument(doc, outputFile, urlBase)
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy