Problem found. Don't use an InputStreamReader as it translates the bytes into characters using some encoding and the result is pdf corruption; read it directly from the stream.
Best Regards, Paulo Soares > -----Original Message----- > From: Huttin Pierre [SMTP:[EMAIL PROTECTED] > Sent: Tuesday, February 25, 2003 16:48 > To: 'Paulo Soares' > Subject: RE: [iText-questions] problem to copy a pdf into another pdf > > You will find the two documents. > > > --- > 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 > > -----Original Message----- > From: Paulo Soares [mailto:[EMAIL PROTECTED] > Sent: mardi 25 f�vrier 2003 17:40 > To: 'Huttin Pierre' > Cc: '[EMAIL PROTECTED]' > Subject: RE: [iText-questions] problem to copy a pdf into another pdf > > When importing pages everything is copied including fonts. Can you send me > privately the generated pdf? > > Best Regards, > Paulo Soares > > > -----Original Message----- > > From: Huttin Pierre [SMTP:[EMAIL PROTECTED] > > Sent: Tuesday, February 25, 2003 16:41 > > To: 'Paulo Soares' > > Cc: '[EMAIL PROTECTED]' > > Subject: RE: [iText-questions] problem to copy a pdf into another pdf > > > > No i don't forget the p_Document.close(); it's make into another part of > > code. > > > > I have made the same methode to add Tiff and it's working fine. > > > > I have just find there is a problem with the font I suppose because in > > property of the original PDF file > > > > on the original Pdf, I found: > > > > Original Font type Encoding Actual Font Type > > > > TimesNewRoman TrueType Windows TimesNewRomanPSMT Type > 1 > > TimesNewRoman,Bold TrueType Windows TimesNewRomanPS-BoldMT Type > 1 > > TimesNewRoman,Italic TrueType Windows > > > > > > on the generated Pdf, I found: > > > > Original Font type Encoding Actual Font Type > > > > Helvetica Type 1 Windows > > TimesNewRoman,Bold TrueType Windows > > TimesNewRoman TrueType Windows > > TimesNewRoman,Italic TrueType Windows > > > > > > > > Best regards, > > --- > > 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 > > > > -----Original Message----- > > From: Paulo Soares [mailto:[EMAIL PROTECTED] > > Sent: mardi 25 f�vrier 2003 17:24 > > To: 'Huttin Pierre' > > Cc: '[EMAIL PROTECTED]' > > Subject: RE: [iText-questions] problem to copy a pdf into another pdf > > > > You are missing the p_Document.close(). > > > > > -----Original Message----- > > > From: Huttin Pierre [SMTP:[EMAIL PROTECTED] > > > Sent: Tuesday, February 25, 2003 16:22 > > > To: 'Paulo Soares' > > > Cc: '[EMAIL PROTECTED]' > > > Subject: RE: [iText-questions] problem to copy a pdf into another pdf > > > > > > The page rotation give by the instruction : > > > rotation = reader.getPageRotation(i); > > > > > > return me 0 > > > > > > I use the version 0.96 of iText > > > > > > Best Regards, > > > --- > > > 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 > > > > > > -----Original Message----- > > > From: Paulo Soares [mailto:[EMAIL PROTECTED] > > > Sent: mardi 25 f�vrier 2003 16:56 > > > To: 'Huttin Pierre'; '[EMAIL PROTECTED]' > > > Subject: RE: [iText-questions] problem to copy a pdf into another pdf > > > > > > It's probably a page rotation problem. What's the page rotation in the > > > original document and what version of iText are you using? > > > > > > Best Regards, > > > Paulo Soares > > > > > > > -----Original Message----- > > > > From: Huttin Pierre [SMTP:[EMAIL PROTECTED] > > > > Sent: Tuesday, February 25, 2003 12:51 > > > > To: '[EMAIL PROTECTED]' > > > > Subject: [iText-questions] problem to copy a pdf into another > pdf > > > > > > > > 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,1 > > > > f, > > > > 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 > > > > > > > > > ********************************************************************** > > > 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 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 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 > ********************************************************************** > << File: output.pdf >> << File: original.pdf >> ------------------------------------------------------- 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
