7,6 → 7,7 |
import javax.xml.transform.stream.StreamSource; |
import java.io.*; |
import java.net.URL; |
import java.util.Date; |
import java.util.Hashtable; |
import java.util.Map; |
|
80,15 → 81,27 |
static FopFactory fopFactory = FopFactory.newInstance(); |
static FOUserAgent foUserAgent = fopFactory.newFOUserAgent(); |
// configure foUserAgent as desired |
public static final String PDF_CREATOR = "Plataforma PAE-IPP 2016 - Sistema de Informação Integrado do Instituto Politecnico de Portalegre - Apache FOP 1.0"; |
|
public static void setAuthority(String title, String name,String subject) |
{ |
foUserAgent.setAuthor(name); |
foUserAgent.setSubject(subject); |
foUserAgent.setCreator(PDF_CREATOR); |
foUserAgent.setCreationDate(new Date()); |
foUserAgent.setTitle(title); |
foUserAgent.setKeywords(subject); |
|
public static void createPdfFromXml(Source xmlFile, String xslFile, OutputStream pdfFile, Map<String, Object> params) throws IOException, FOPException, TransformerException { |
} |
public static synchronized void createPdfFromXml(Source xmlFile, String xslFile, OutputStream pdfFile, Map<String, Object> params) throws IOException, FOPException, TransformerException { |
// configure fopFactory as desired |
|
|
|
// Setup output |
OutputStream out = new BufferedOutputStream(pdfFile); |
|
fopFactory.getImageManager().getCache().clearCache(); |
// Construct fop with desired output format |
Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent, out); |
|
110,6 → 123,7 |
out.close(); |
} |
|
/* |
public static void createPdfFromXml2_0(Source xmlFile, String xslFile, OutputStream pdfFile, Map<String, Object> params) throws IOException, FOPException, TransformerException { |
// configure fopFactory as desired |
|
148,8 → 162,8 |
|
out.close(); |
} |
*/ |
|
|
|
public static void main(String[] args) { |
try { |