Created
August 22, 2014 16:15
-
-
Save marti1125/c2b93ba5cdef7ac0f464 to your computer and use it in GitHub Desktop.
itext show in pdf vierwer
This file contains hidden or 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
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); | |
// step 1 | |
Document document = new Document(); | |
// step 2 | |
PdfWriter writer = PdfWriter.getInstance(document, outputStream); | |
// step 3 | |
document.open(); | |
// step 4 | |
document.add(new Paragraph("Hello World! 2222555")); | |
// step 5 | |
document.close(); | |
writer.flush(); | |
writer.close(); | |
outputStream.close(); | |
ByteArrayOutputStream out = new ByteArrayOutputStream(); | |
out.flush(); | |
System.out.println("test 1 " + out.size()); | |
out.write(outputStream.toByteArray()); | |
System.out.println("test 2 " + out.size()); | |
out.close(); | |
//6 out to in | |
InputStream is = new ByteArrayInputStream(out.toByteArray()); | |
renderBinary(is, "ReporteDeDistribucionClasesPorHoras.pdf","application/pdf",true); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment