hi , i am using itext to  rotate a document and then add image to it , the
rotate work proprely and sam for adding image , but when i add an image to
a document tthat i was rotating befor it add the image to the origine
document(not rotated) not in the rotated document do you have a
justification of this , see the code :
ROTATE :
      reader.getPageN(pageNumber).put(PdfName.ROTATE, new PdfNumber(180));

ADD IMAGE :

            public String PdfWithSign(String fileIn, String sign, int page,
int posx, int posy) {
            String fileOut = null;
            String fileOutPath = null;
            try {
                  PdfReader reader = new PdfReader(fileIn);
                  int n = reader.getNumberOfPages();
                  if (page <= n && page >0)
                  {
                  fileOutPath = fileIn.substring(0,fileIn.lastIndexOf('/'
)+1)+docIDF+"_withSign"+System.currentTimeMillis()+".pdf";
                        Rectangle psize = reader.getPageSize(1);
                        float width = psize.width();
                        float height = psize.height();
                        Document document = new Document(psize, 50, 50, 50,
50);
                        OutputStream out = new
FileOutputStream(fileOutPath);
                        PdfWriter writer =
PdfWriter.getInstance(document,out);
                        document.open();
                        PdfContentByte cb = writer.getDirectContent();
                        int i = 0;
                        while (i < n) {
                              document.newPage();
                              i++;
                              PdfImportedPage page2 =
writer.getImportedPage(reader, i);
                              cb.addTemplate(page2, 1f, 0, 0, 1f, 0, 0);
                              if (i == page)
                              {
                                    Image tst = Image.getInstance(sign);
                                    tst.setAbsolutePosition(posx *( (2 *
width) / 9), posy *( height / 6));

tst.scalePercent((100/tst.height())*100);
                                    cb.addImage(tst);

                              }
                        }
                        document.close();
                        fileOut =
fileOutPath.substring(fileOutPath.lastIndexOf('/')+1,
fileOutPath.length());
                  }
                  else
                  {
                        setErrorMessage("Page number not valid !<br>");
                        signPosed = false;
                        return null;
                  }
            }
            catch (Exception de) {
                  de.printStackTrace();
            }


thanks
*************************************************************************
This message and any attachments (the "message") are confidential and intended 
solely for the addressee(s).
Any unauthorised use or dissemination is prohibited. E-mails are susceptible to 
alteration.   
Neither SOCIETE GENERALE nor any of its subsidiaries or affiliates shall be 
liable for the message if altered, changed or
falsified.
                              ************
Ce message et toutes les pieces jointes (ci-apres le "message") sont 
confidentiels et etablis a l'intention exclusive de ses
destinataires. Toute utilisation ou diffusion non autorisee est interdite. Tout 
message electronique est susceptible d'alteration. 
La SOCIETE GENERALE et ses filiales declinent toute responsabilite au titre de 
ce message s'il a ete altere, deforme ou falsifie.
*************************************************************************


-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course
Free Certification Exam for All Training Attendees Through End of 2005
Visit http://www.jboss.com/services/certification for more information
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to