2011-07-12 114 views
2

我們有5個xsl文件,用於在運行時生成的轉換的xml內容,當我們爲單個xsl文件生成單個pdf時,它工作正常。Multiple XSL to single PDF

我們的需求是我們需要基於運行時輸入爲5個xsl文件生成一個pdf。

例如:輸入是3個xsl文件名,那麼我們需要在多個頁面上生成一個包含3個xsl內容的pdf文件。

我們使用Apache FOP 1.0和Java 1.5。

在此先感謝

感謝 -Arul

回答

0

正如你已經能夠將XSL轉換爲PDF,您可以嘗試concatenate multiple PDF files,從這些XSL文件創建,到使用Aspose.Pdf.Kit for Java單一的PDF 。 的代碼非常簡單:

//read the input file 
String inFile1 = "example1.pdf"; 
String inFile2 = "example2.pdf"; 
String outFile = "kitOut1.pdf"; 

FileInputStream inStream1 = new FileInputStream(inFile1); 
FileInputStream inStream2 = new FileInputStream(inFile2); 


//concatenate two files 
FileOutputStream outputStream = new FileOutputStream(outFile); 
PdfFileEditor editor = new PdfFileEditor(); 
editor.concatenate(inStream1, inStream2, outputStream); 

//close the output FileOutputStream 
outputStream.close(); 

披露:我作爲開發商的Aspose傳道工作。