All Downloads are FREE. Search and download functionalities are using the official Maven repository.

grails.doc.PdfPublisher.groovy Maven / Gradle / Ivy

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