Hello,
I have a problem to copy a pdf file to a new pdf file.
When I run the code below, I obtain the right number of page with the right
size and the output file have the right size, but i can't see anything in
the output file ?
The pdf file to copy to new file come under a ByteArrayInputStream format.
I don't understand what's happen.
Note
PdfWriter p_PdfWriter;
Document p_Document;
ByteArrayOutputStream p_outputStream;
(this variables are initialise in the a first part of the code and no
problem with this)
private void addPdf(ByteArrayInputStream iStream, String ChapterTitle) {
if(p_PdfWriter != null && p_Document != null && p_outputStream !=
null) {
try {
int l;
InputStreamReader isr = new InputStreamReader(iStream);
ByteArrayOutputStream out = new ByteArrayOutputStream();
while ((l = isr.read()) != -1) {
out.write(l);
}
PdfReader reader = new PdfReader(out.toByteArray());
int n = reader.getNumberOfPages();
int i = 0;
int rotation;
PdfContentByte cb = p_PdfWriter.getDirectContent();
while (i < n) {
i++;
p_PdfDocument.setPageSize(reader.getPageSizeWithRotation(i));
if (p_FirstChapter) {
p_FirstChapter = false;
p_Document.open();
p_Document.newPage();
} else {
p_Document.newPage();
}
rotation = reader.getPageRotation(i);
if (rotation == 90 || rotation == 270) {
cb.addTemplate((PdfTemplate)p_PdfWriter.getImportedPage(reader,i),0,-1f,1f,0
,0,reader.getPageSizeWithRotation(i).height());
} else {
cb.addTemplate((PdfTemplate)p_PdfWriter.getImportedPage(reader,i),1f,0,0,1f,
0,0);
}
}
} catch (Exception de) {
System.out.println("addPdf - Error");
System.out.println("error message : " + de.getMessage());
((DfException)de).printStackTrace();
}
}
}
---
HUTTIN Pierre
OMNIS ECM Services
81 route de Luxembourg
L-4391 PONTPIERRE
�
tel : (+352) 29 14 11 1
fax : (+352) 29 14 11 650
url : http://www.ecm.lu
**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the security manager at [EMAIL PROTECTED]
This footnote also confirms that this email message has been swept by
the SOFITEC C.A.T.S. systems for the presence of computer viruses.
For more information about C.A.T.S. please check
http://www.sofitec.lu
**********************************************************************
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions