If you have a anchor.setReference("#someName") you must have somewhere else
a anchor2.setName("someName").

Best Regards,
Paulo Soares

> -----Original Message-----
> From: Carmona Perez, David [SMTP:[EMAIL PROTECTED]
> Sent: Monday, August 04, 2003 10:15
> To:   Itext-Questions (E-mail)
> Subject:      [iText-questions] Anchor behavior
> 
> I receive an exception ExceptionConverter: java.lang.RuntimeException: The
> name 'anchor2' has no local destination., when trying to execute the
> following simple program.
>  
> If I change
>       anchor1.setName(" ");
> by
>       anchor1.setName("something");
>  
> then the document is generated ok.
>  
> import com.lowagie.text.Anchor;
> import com.lowagie.text.Document;
> import com.lowagie.text.DocumentException;
> import com.lowagie.text.Paragraph;
> import com.lowagie.text.pdf.PdfWriter;
>  
> public class Test {
>       void render(OutputStream stream) throws Exception {
>             try {
>                   PdfWriter writer = PdfWriter.getInstance(doc, stream);
>                   doc.open();
>                   Anchor anchor1 = new Anchor("Go to anchor2");
>                   anchor1.setReference("#anchor2");
>                   doc.add(new Paragraph(anchor1));
>                   doc.newPage();
>                   anchor1 = new Anchor("Anchor2");
>                   anchor1.setName(" ");
>                   doc.add(anchor1);
>             } finally {
>                   if (doc.isOpen()) {
>                         doc.close();
>                   }
>             }
>       }
>       Document doc = new Document();
>       PdfTemplate template;
>       
>       static public void main(String[] args) {
>             try {
>                   new Test().render();
>                   System.out.println("Successfully generated");
>             } catch (Exception e) {
>                   e.printStackTrace();
>             }
>       }
> }
>  
>  
> --------
> David
>  


-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to