Click here to Skip to main content
15,923,087 members
Home / Discussions / C#
   

C#

 
GeneralRe: Millisecond Timer Period Pin
Pr@teek B@h!20-Nov-08 3:24
Pr@teek B@h!20-Nov-08 3:24 
QuestionIs there a (static) CER Checking Tool? Pin
HosamAly19-Nov-08 4:59
HosamAly19-Nov-08 4:59 
AnswerRe: Is there a (static) CER Checking Tool? Pin
Paul Conrad19-Nov-08 5:02
professionalPaul Conrad19-Nov-08 5:02 
GeneralRe: Is there a (static) CER Checking Tool? Pin
Wendelius19-Nov-08 5:50
mentorWendelius19-Nov-08 5:50 
GeneralRe: Is there a (static) CER Checking Tool? Pin
HosamAly19-Nov-08 6:10
HosamAly19-Nov-08 6:10 
GeneralRe: Is there a (static) CER Checking Tool? Pin
Paul Conrad19-Nov-08 6:12
professionalPaul Conrad19-Nov-08 6:12 
GeneralRe: Is there a (static) CER Checking Tool? Pin
Dave Kreskowiak19-Nov-08 6:35
mveDave Kreskowiak19-Nov-08 6:35 
AnswerRe: Is there a (static) CER Checking Tool? Pin
Pete O'Hanlon19-Nov-08 10:13
mvePete O'Hanlon19-Nov-08 10:13 
GeneralRe: Is there a (static) CER Checking Tool? Pin
HosamAly20-Nov-08 1:25
HosamAly20-Nov-08 1:25 
Questionsmall question about the use accelerated key for buttons within dialog Pin
Seraph_summer19-Nov-08 4:42
Seraph_summer19-Nov-08 4:42 
AnswerRe: small question about the use accelerated key for buttons within dialog Pin
Simon P Stevens19-Nov-08 4:45
Simon P Stevens19-Nov-08 4:45 
AnswerRe: small question about the use accelerated key for buttons within dialog Pin
DaveyM6919-Nov-08 12:21
professionalDaveyM6919-Nov-08 12:21 
Questioncan not find file vjslib.dll Pin
nesfrank19-Nov-08 3:33
nesfrank19-Nov-08 3:33 
AnswerRe: can not find file vjslib.dll Pin
Thomas Stockwell19-Nov-08 3:35
professionalThomas Stockwell19-Nov-08 3:35 
GeneralRe: can not find file vjslib.dll Pin
leppie19-Nov-08 3:44
leppie19-Nov-08 3:44 
GeneralRe: can not find file vjslib.dll Pin
nesfrank19-Nov-08 3:47
nesfrank19-Nov-08 3:47 
GeneralRe: can not find file vjslib.dll Pin
Thomas Stockwell19-Nov-08 4:26
professionalThomas Stockwell19-Nov-08 4:26 
GeneralRe: can not find file vjslib.dll Pin
nesfrank19-Nov-08 8:10
nesfrank19-Nov-08 8:10 
GeneralRe: can not find file vjslib.dll Pin
nesfrank19-Nov-08 4:01
nesfrank19-Nov-08 4:01 
Question[Message Deleted] Pin
droig19-Nov-08 3:24
droig19-Nov-08 3:24 
AnswerRe: Binging DataGridView to a Generic List of interfaces Pin
leppie19-Nov-08 3:45
leppie19-Nov-08 3:45 
GeneralRe: Binging DataGridView to a Generic List of interfaces Pin
Pedram Behroozi19-Nov-08 5:32
Pedram Behroozi19-Nov-08 5:32 
GeneralRe: Binging DataGridView to a Generic List of interfaces Pin
droig19-Nov-08 5:53
droig19-Nov-08 5:53 
GeneralRe: Binging DataGridView to a Generic List of interfaces Pin
Pedram Behroozi19-Nov-08 6:01
Pedram Behroozi19-Nov-08 6:01 
QuestioniTextSharp html image parsing issue Pin
Cape Town Developer19-Nov-08 2:49
Cape Town Developer19-Nov-08 2:49 
The problem

Using itextSharp to convert an html file to pdf and emailing it, I am unable to successfully parse an html file on the web server backend even when doing "absolute" or "relative" image referencing itextSharp fails and says "unable to find file c:\my_image.jpg" this is crazy didn’t specify c:\my_image.jpg as a path !!!

The madness of all this is it works well on my local file system, when the html file is located on asp.net using an IIS webserver i get the above described error.


Here is my code.



// Simple copy of the html<br />
<html xmlns="http://www.w3.org/1999/xhtml"><br />
<head><br />
	<title></title><br />
</head><br />
<body><br />
<table width="100%" border="0" cellpadding="1" cellspacing="5" style="font-size:10pt font-family:Arial, Tahoma"><br />
    <tr><br />
        <td colspan="2" align="right"><br />
            <img src="logo.gif" /><br />
        </td><br />
    </tr><br />
</table><br />
</body><br />
</html><br />
<br />
<br />
asp.net code behind <br />
<br />
 private void SendEmail(string attachmentName, string pdfDocumentHtml, <br />
                               string mailSubject, string mailBody,  MailAddress fromEmailAddress, <br />
                               List<mailaddress> toMailAddressCollection)<br />
        {<br />
            Document doc = null;<br />
            XmlTextReader reader = null;<br />
            MemoryStream ms = null;<br />
            MemoryStream msPdf = null;<br />
            MemoryStream msHtml = null;<br />
            try<br />
            {<br />
                /* Convert to PDF */<br />
                doc = new Document(PageSize.A4, 10, 10, 10, 10);<br />
<br />
                msPdf = new MemoryStream();<br />
                PdfWriter.GetInstance(doc, msPdf); /* Create a pdf document listner to the memory data strean */<br />
                msHtml = new MemoryStream(new ASCIIEncoding().GetBytes(pdfDocumentHtml)); <br />
<br />
                reader = new XmlTextReader(msHtml);<br />
                reader.WhitespaceHandling = WhitespaceHandling.None;<br />
                HtmlParser.Parse(doc, reader);<br />
                ms = new MemoryStream(msPdf.ToArray());<br />
<br />
                /* Mail and add PDF as Attachment*/<br />
                var attachment = new Attachment(ms, new ContentType("application/pdf"));<br />
                attachment.Name = attachmentName;<br />
                attachment.NameEncoding = Encoding.UTF8;<br />
                MailMessage email = new MailMessage();<br />
                email.From = fromEmailAddress;<br />
<br />
                foreach (MailAddress address in toMailAddressCollection)<br />
                {<br />
                    email.To.Add(address);<br />
                }<br />
<br />
                email.Attachments.Add(attachment); /* Assumes one attachment of type pdf from the memory stream */ <br />
                email.Subject = mailSubject;<br />
                email.Body = mailBody;<br />
                email.IsBodyHtml = true;<br />
                SmtpClient client = new SmtpClient();<br />
                client.Send(email);<br />
            }<br />
            finally<br />
            {<br />
                /* Clean up */<br />
                if (reader != null)<br />
                    reader.Close();<br />
                if (ms != null)<br />
                    ms.Close();<br />
                if (msPdf != null)<br />
                    msPdf.Close();<br />
                if (msHtml != null)<br />
                    msHtml.Close();<br />
                //if (doc != null && doc.IsOpen())<br />
                //    doc.Close();<br />
            }<br />
        }<br />
</mailaddress>





Frown | :(
Thanks in advance

Wisdom is often meant as the ability and desire to make choices that can gain approval in a long-term examination by many people.

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.