-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #460 from phuonghuynh/master
Update changes
- Loading branch information
Showing
71 changed files
with
3,661 additions
and
720 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package com.techlooper.aspect; | ||
|
||
import com.itextpdf.text.pdf.BaseFont; | ||
import org.xhtmlrenderer.pdf.ITextRenderer; | ||
|
||
import java.awt.*; | ||
import java.io.FileOutputStream; | ||
import java.io.OutputStream; | ||
import java.io.OutputStreamWriter; | ||
import java.lang.reflect.Field; | ||
import java.nio.charset.Charset; | ||
import java.nio.file.Files; | ||
import java.nio.file.Paths; | ||
import java.util.Arrays; | ||
|
||
/** | ||
* Created by phuonghqh on 11/24/15. | ||
*/ | ||
public class Main2 { | ||
|
||
public static void main(String[] args) throws Exception { | ||
|
||
String content = String.join("\n", Files.readAllLines(Paths.get("./src/main/webapp/assets/report.html"))); | ||
|
||
//Set PDF target output file | ||
String outputFile = "firstdoc.pdf"; | ||
|
||
OutputStream os = new FileOutputStream(outputFile); | ||
|
||
ITextRenderer renderer = new ITextRenderer(); | ||
renderer.getFontResolver().addFont("font/verdana.ttf", BaseFont.IDENTITY_H, BaseFont.EMBEDDED); | ||
renderer.setDocumentFromString(content); | ||
renderer.layout(); | ||
renderer.createPDF(os); | ||
|
||
os.close(); | ||
} | ||
} |
Oops, something went wrong.