Hi,

The following (simplified version of example in CH 14 of iText in Action) 
works using itextsharp 4.0.3, .NET 2.0:

using System;
using System.IO;
using iTextSharp.text;
using iTextSharp.text.pdf;
using iTextSharp.text.xml;

public class xml2pdf {
  public static void Main() {
    Document document = new Document(PageSize.A4, 80, 50, 30, 65);
    try {
      PdfWriter.GetInstance(document,
        new FileStream("x2p-test.pdf", FileMode.Create)
      );
      ITextmyHandler  h = new ITextmyHandler(document,
        new TagMap("tagmap.xml")
      );
      h.Parse("romeo_juliet.xml");
    }
    catch { throw; }
  }
}

but throws the following exception in 4.0.4:

Unhandled Exception: System.InvalidOperationException: Stack empty.
   at System.Collections.Stack.Pop()
   at iTextSharp.text.xml.ITextHandler.HandleEndingTags(String name)
   at iTextSharp.text.xml.ITextmyHandler.EndElement(String uri, String 
lname,
   String name)
   at iTextSharp.text.xml.ParserBase.Parse(XmlTextReader reader)
   at iTextSharp.text.xml.ParserBase.Parse(String url)
   at xml2pdf.Main()

The XML files are from the book's example files. Could anyone else see if 
they can run w/4.0.4?

Thanks - keith

_________________________________________________________________
http://liveearth.msn.com


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

Reply via email to