[iText-questions] HR tag error - Object reference not set to an instance of an object.

2012-03-05 Thread Stefanescu Gabi




Hello, I am using the FreeTextBox control to write the text, which then I want 
to export to pdf. I am using iText# of course. all works very nicely untill I 
use the hr tag, (the insert rule button). when I want to export to pdf, I get 
the error.This is the C# code I use: private byte[] RanderHTMLtoPDF(string html)
{
byte[] doc = null;iTextSharp.text.Document idocument = new 
iTextSharp.text.Document(iTextSharp.text.PageSize.A4, 32, 32, 50, 50);
using (MemoryStream m = new MemoryStream())
{
iTextSharp.text.pdf.PdfWriter.GetInstance(idocument, m);
idocument.Open();using (TextReader sReader = new 
StreamReader(new MemoryStream(System.Text.Encoding.Default.GetBytes(html)), 
Encoding.Default))
{
iTextSharp.text.html.simpleparser.HTMLWorker worker = new 
iTextSharp.text.html.simpleparser.HTMLWorker(idocument);
worker.StartDocument();
worker.Parse(sReader);
worker.EndDocument();
}
idocument.Close();doc = m.ToArray();
}
return doc;
} At the worker.Parse(sReader); it crashes. the error is:ERROR: Object 
reference not set to an instance of an object.  
SOURCE: itextsharpSTACK TRACE:at 
iTextSharp.text.html.simpleparser.HTMLWorker.CreateLineSeparator(IDictionary`2 
attrs)   at 
iTextSharp.text.html.simpleparser.HTMLTagProcessors.HTMLTagProcessor_HR.StartElement(HTMLWorker
 worker, String tag, IDictionary`2 attrs)   at 
iTextSharp.text.html.simpleparser.HTMLWorker.StartElement(String tag, 
IDictionary`2 attrs)   at 
iTextSharp.text.xml.simpleparser.SimpleXMLParser.ProcessTag(Boolean start)   at 
iTextSharp.text.xml.simpleparser.SimpleXMLParser.Go(TextReader reader)   at 
iTextSharp.text.xml.simpleparser.SimpleXMLParser.Parse(ISimpleXMLDocHandler 
doc, ISimpleXMLDocHandlerComment comment, TextReader r, Boolean html)   at 
iTextSharp.text.html.simpleparser.HTMLWorker.Parse(TextReader reader)   at 
ExportPDF.RanderHTMLtoPDF(String html) in 
d:\Lucru\Proiecte\CRMTravel\CRM\App_Code\Framework\PDF\ExportPDF.cs:line 383   
at ExportPDF.SaveToPDF(Int32 copyNo, String html) in 
d:\Lucru\Proiecte\CRMTravel\CRM\App_Code\Framework\PDF\ExportPDF.cs:line 422   
at ExportContractPJ..ctor(Int32 id, String title)  I really hope you could help 
me, I took over this from a colegue that left, and I am really stuck. Thanks in 
advance,Gabriel   --
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2___
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php

Re: [iText-questions] HR tag error - Object reference not set to an instance of an object.

2012-03-05 Thread Stefanescu Gabi

Ok, thanks, I have found it, but only for java (the .jar files). is it 
available for c# too? Thank you Gabriel
 Date: Mon, 5 Mar 2012 11:07:00 +0100
From: i...@1t3xt.info
To: itext-questions@lists.sourceforge.net
Subject: Re: [iText-questions] HR tag error - Object reference not set to an 
instance of an object.


  



  
  
Op 5/03/2012 11:00, Stefanescu Gabi schreef:
iTextSharp.text.html.simpleparser.HTMLWorker
  worker
HTMLWorker is no longer supported.

It's discontinued in favor of XML Worker:
http://demo.itextsupport.com/xmlworker

  


--
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
___
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php   --
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2___
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php

Re: [iText-questions] HR tag error - Object reference not set to an instance of an object.

2012-03-05 Thread Stefanescu Gabi

thanks for your fast and helpful replys.
  Date: Mon, 5 Mar 2012 13:40:59 +0100
 From: i...@1t3xt.info
 To: itext-questions@lists.sourceforge.net
 Subject: Re: [iText-questions] HR tag error - Object reference not set to an 
 instance of an object.
 
 Op 5/03/2012 13:36, Stefanescu Gabi schreef:
  Ok, thanks, I have found it, but only for java (the .jar files). is it 
  available for c# too?
 Yes, http://sourceforge.net/projects/itextsharp/files/xmlworker/
 We're working on the 1.1.2 release. It's much better than 1.1.1.
 
 --
 Try before you buy = See our experts in action!
 The most comprehensive online learning library for Microsoft developers
 is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
 Metro Style Apps, more. Free future releases when you subscribe now!
 http://p.sf.net/sfu/learndevnow-dev2
 ___
 iText-questions mailing list
 iText-questions@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/itext-questions
 
 iText(R) is a registered trademark of 1T3XT BVBA.
 Many questions posted to this list can (and will) be answered with a 
 reference to the iText book: http://www.itextpdf.com/book/
 Please check the keywords list before you ask for examples: 
 http://itextpdf.com/themes/keywords.php
  --
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2___
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php

Re: [iText-questions] HR tag error - Object reference not set to an instance of an object.

2012-03-05 Thread Stefanescu Gabi

Could you please guide me to a link where there is an implementation example in 
C# that could help me write with XMLWorker what I wrote here with HMTL worker? 
private byte[] RanderHTMLtoPDF(string html)
{
 byte[] doc = null;
 iTextSharp.text.Document idocument = new 
iTextSharp.text.Document(iTextSharp.text.PageSize.A4, 32, 32, 50, 50);
 using (MemoryStream m = new MemoryStream())
 {
  iTextSharp.text.pdf.PdfWriter.GetInstance(idocument, m);
  idocument.Open();
  using (TextReader sReader = new StreamReader(new 
MemoryStream(System.Text.Encoding.Default.GetBytes(html)), Encoding.Default))
   {
iTextSharp.text.html.simpleparser.HTMLWorker worker = new 
iTextSharp.text.html.simpleparser.HTMLWorker(idocument);
worker.StartDocument();
worker.Parse(sReader);
worker.EndDocument();
   }
  idocument.Close();
  doc = m.ToArray();
 }
 return doc;
}

I can't make the transition to XMLWorker and I am a bit pressed by time 
Thanks,Gabriel   Date: Mon, 5 Mar 2012 13:40:59 +0100
 From: i...@1t3xt.info
 To: itext-questions@lists.sourceforge.net
 Subject: Re: [iText-questions] HR tag error - Object reference not set to an 
 instance of an object.
 
 Op 5/03/2012 13:36, Stefanescu Gabi schreef:
  Ok, thanks, I have found it, but only for java (the .jar files). is it 
  available for c# too?
 Yes, http://sourceforge.net/projects/itextsharp/files/xmlworker/
 We're working on the 1.1.2 release. It's much better than 1.1.1.
 
 --
 Try before you buy = See our experts in action!
 The most comprehensive online learning library for Microsoft developers
 is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
 Metro Style Apps, more. Free future releases when you subscribe now!
 http://p.sf.net/sfu/learndevnow-dev2
 ___
 iText-questions mailing list
 iText-questions@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/itext-questions
 
 iText(R) is a registered trademark of 1T3XT BVBA.
 Many questions posted to this list can (and will) be answered with a 
 reference to the iText book: http://www.itextpdf.com/book/
 Please check the keywords list before you ask for examples: 
 http://itextpdf.com/themes/keywords.php
  --
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2___
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php

[iText-questions] Line spacing

2012-04-02 Thread Stefanescu Gabi




Hello, Could you please give me a little help for my problem? I am using the 
FreeTextBox to create a html text that later I want to export to pdf. I am 
using iText# and the HTMLWorker. This is my code: private byte[] 
RanderHTMLtoPDF(string html)
{
byte[] doc = null;iTextSharp.text.Document idocument = new 
iTextSharp.text.Document(iTextSharp.text.PageSize.A4, 32, 32, 50, 50);
using (MemoryStream m = new MemoryStream())
{
iTextSharp.text.pdf.PdfWriter.GetInstance(idocument, m);
idocument.Open();using (TextReader sReader = new 
StreamReader(new MemoryStream(System.Text.Encoding.Default.GetBytes(html)), 
Encoding.Default))
{
iTextSharp.text.html.simpleparser.HTMLWorker worker = new 
iTextSharp.text.html.simpleparser.HTMLWorker(idocument);
worker.StartDocument();
worker.Parse(sReader);
worker.EndDocument();
}
idocument.Close();doc = m.ToArray();
}
return doc;
} the problem is that in PDF, the line spacing is too big and the client 
wants it smaller. and I couldn't find a solution to do that.  Thanks, Gabriel   
 --
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure___
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php

Re: [iText-questions] Line spacing

2012-04-02 Thread Stefanescu Gabi




Hi,yes, I know it has beed discontinued in favor of XML Worker. I had a problem 
before with the hr tag I think, and I got the same answer, but I couldn't 
change it with XML Worker. I tried to use xml worker instead, couldn't. The guy 
who wrote this before left and I had to take over. I didn't have enough time to 
do this so I just replaced programatically the hr tag with string.empty as I 
didn't need it.but now I got this new problem and I really cannot work it out. 
is there a way I can use the html worker so I don't have to change the whole 
thing, and make the line spacing in the html I receive smaller? thanks  Hi 
Gabriel,

2012/4/2 Stefanescu Gabi sbiga@...

  Hello,

 Could you please give me a little help for my problem? I am using the
 FreeTextBox to create a html text that later I want to export to pdf. I am
 using iText# and the HTMLWorker. This is my code:


HTMLWorker has been discontinued in favor of XML Worker.
See http://demo.itextsupport.com/xmlworker/
http://demo.itextsupport.com/xmlworker/
http://sourceforge.net/projects/itextsharp/files/xmlworker/

Cheers,
alexis
  --
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure___
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php

Re: [iText-questions] Line spacing

2012-04-02 Thread Stefanescu Gabi

ok,  thanks a lot for your reply. Gabriel
 From: pigeon.ale...@gmail.com
Date: Mon, 2 Apr 2012 15:37:45 +0200
To: itext-questions@lists.sourceforge.net
Subject: Re: [iText-questions] Line spacing

Hi Gabriel,

2012/4/2 Stefanescu Gabi sb...@hotmail.com









Hi,
yes, I know it has beed discontinued in favor of XML Worker. I had a problem 
before with the hr tag I think, and I got the same answer, but I couldn't 
change it with XML Worker. I tried to use xml worker instead, couldn't. The guy 
who wrote this before left and I had to take over. I didn't have enough time to 
do this so I just replaced programatically the hr tag with string.empty as I 
didn't need it.


but now I got this new problem and I really cannot work it out. is there a way 
I can use the html worker so I don't have to change the whole thing, and make 
the line spacing in the html I receive smaller?



Unfortunately, free support on this mailing-list is only given for the latest 
versions of iText. If you are lucky, some other subscriber might have solved 
the same problem and provide you with an answer, but that I can't assure.


If keeping HTMLWorker is that critical for you, you might consider contacting 
the sales department and inquire for premium technical support

 http://itextpdf.com/support.php#premium 



Please note that I'm not affiliated in any way with the iText companies, so I 
might be wrong in assuming that support for deprecated products might be 
purchased. But I would say that it's your best shot.



HTH,
alexis


--
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
___
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php   --
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure___
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php