Im using a modified version of itext2.0.7 (legacy code), with the method
preClose modified like this:

            if (!isInvisible()){

                int pages = writer.reader.getNumberOfPages();

                for (int i = 1; i <= pages; i++) {                      
                  PdfFormField field = PdfFormField.createEmpty(writer);
                  this.page = i;
                                  pagen= i;
                                  
                                  

                 
field.setWidget((Rectangle)multiPageRect.get(Integer.valueOf(i)), null);

                  field.setAppearance(PdfAnnotation.APPEARANCE_NORMAL,
getAppearance());
                  field.setPlaceInPage(i);
                  field.setPage(i);
                  field.setFlags(PdfAnnotation.FLAGS_PRINT);
                  sigField.addKid(field);

                  if (texto){
                    
                    StringBuffer sbContenido = new
StringBuffer(this.contenido);

                    //-- %pags
                    int j = sbContenido.indexOf("%pags");
                    if (j > 0) sbContenido.replace(j, j + 5,
String.valueOf(pages));

                    //-- %pag
                    j = sbContenido.indexOf("%pag");
                    if (j > 0) sbContenido.replace(j, j + 4,
String.valueOf(i));

                    String s = sbContenido.toString();


                    BaseFont bfont = BaseFont.createFont(this.fuente,
BaseFont.WINANSI, true);

                    PdfContentByte cb = writer.getUnderContent(i);
                    PdfTemplate tp = null;

                    if (this.vertical){
                      tp = cb.createTemplate(this.size,
bfont.getWidthPoint(s, this.size));
                      float x = size - (this.size / 5f);
                      cb.addTemplate(tp, this.x - x, this.y);

                      Font font = new Font(bfont, this.size);

                      StringTokenizer st = new StringTokenizer(this.color,
",");
                      int r = 0;
                      int g = 0;
                      int b = 0;
                      if (st.countTokens() == 3){
                        r = Integer.parseInt(st.nextToken().trim());
                        g = Integer.parseInt(st.nextToken().trim());
                        b = Integer.parseInt(st.nextToken().trim());
                      }
                      font.setColor(new Color(r,g,b));

                      ColumnText ct = new ColumnText(tp);
                      ct.showTextAligned(tp, Element.ALIGN_LEFT, new
Phrase(s, font), x, 0, 90);
                    }
                    else{
                      tp = cb.createTemplate(bfont.getWidthPoint(s,
this.size), this.size);
                      cb.addTemplate(tp, this.x, this.y);

                      Font font = new Font(bfont, this.size);

                      StringTokenizer st = new StringTokenizer(this.color,
",");
                      int r = 0;
                      int g = 0;
                      int b = 0;
                      if (st.countTokens() == 3){
                        r = Integer.parseInt(st.nextToken().trim());
                        g = Integer.parseInt(st.nextToken().trim());
                        b = Integer.parseInt(st.nextToken().trim());
                      }
                      font.setColor(new Color(r,g,b));

                      font.setColor(new Color(r,g,b));

                      ColumnText ct = new ColumnText(tp);
                      ct.showTextAligned(tp, Element.ALIGN_LEFT, new
Phrase(s, font), 0, this.size / 5f, 0);
                      ct.go();
                    }
                  }
                }

                writer.addAnnotation(sigField, pagen);
}



However, ill try to add a little example....


Paulo Soares wrote:
> 
> It works for me. Posta a small standalone example with any need files so 
> that the problem can be reproduced.
> 
> Paulo
> 
> ----- Original Message ----- 
> From: "VTARIN" <[EMAIL PROTECTED]>
> To: <itext-questions@lists.sourceforge.net>
> Sent: Wednesday, July 23, 2008 7:17 AM
> Subject: Re: [iText-questions] Visible Signature Positioning with
> differente 
> page sizes (A4, A3)
> 
> 
>>
>> it works well with the A4 non-rotated pages, but int the A3 rotated pages 
>> (or
>> pages with different sizes) it appears in the middle. (Rectangle: 
>> 25.0x765.0
>> (rot: 0 degrees)). The template contains some scaled images and text. Im
>> using itext2.0.7.
>>
>> There must be something wrong with my code, but i havent found it yet :-(
>>
>> Thanks for your time.
>>
>>
>>
>> Paulo Soares-3 wrote:
>>>
>>> Why doesn't it work for you?
>>>
>>> Paulo
>>>
>>>> -----Original Message-----
>>>> From: [EMAIL PROTECTED]
>>>> [mailto:[EMAIL PROTECTED] On
>>>> Behalf Of VTARIN
>>>> Sent: Tuesday, July 22, 2008 10:04 AM
>>>> To: itext-questions@lists.sourceforge.net
>>>> Subject: [iText-questions] Visible Signature Positioning with
>>>> differente page sizes (A4, A3)
>>>>
>>>>
>>>> Hello,
>>>>
>>>> I have a pdf document with different page sizes and formats,
>>>> and some of
>>>> these pages are rotated.
>>>>
>>>> I do all the signing, but im not able to position correctly
>>>> the visible
>>>> signature with setVisibleSignature. I want the visible signature to be
>>>> placed, for all the pages, in the rigth margin, with vertical
>>>> alignment.
>>>>
>>>> Im adding a PdfTemplate to app[2], and using this code:
>>>>
>>>> Rectangle rect = new Rectangle(point[0], point[1],
>>>> point2[0],point2[1]);
>>>> sap.setVisibleSignature(rect, 1, null);
>>>> sap.setAcro6Layers(true);
> 
> 
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's
> challenge
> Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> Grand prize is a trip for two to an Open Source event anywhere in the
> world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> iText-questions mailing list
> iText-questions@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/itext-questions
> 
> Do you like iText?
> Buy the iText book: http://www.1t3xt.com/docs/book.php
> Or leave a tip: https://tipit.to/itexttipjar
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Visible-Signature-Positioning-with-differente-page-sizes-%28A4%2CA3%29-tp18585201p18607130.html
Sent from the iText - General mailing list archive at Nabble.com.


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Do you like iText?
Buy the iText book: http://www.1t3xt.com/docs/book.php
Or leave a tip: https://tipit.to/itexttipjar

Reply via email to