HTML2PDF conversion issue

  •  02-20-2008, 5:25 PM

    HTML2PDF conversion issue

    I have this code (c#) to attach a PDF created from HTML on the fly to an email.  objMessage is a System.Net.Mail.Mailmessage object. 
     

    CuteEditor.Convertor.PDF.HTML2PDF objConverter = new CuteEditor.Convertor.PDF.HTML2PDF("<html><body><b>this is a test</b></body></html>");

    Stream sPDFForm = new MemoryStream();

    objConverter.RenderSinglePageContent = false;

    objConverter.Render();

    objConverter.Save(sPDFForm);

     

    objMessage.Attachments.Add(new System.Net.Mail.Attachment(sPDFForm, "a.pdf"));
     
    When I send the message, I receive the email with the attachment, however when I try to open it I get an error from adobe:
     
    "Adobe Reader could not open 'a.pdf' because it is either not a supported file type or because the file has been damaged (for example, it was sent as an email attachment and wasn't correctly decoded)."
     
    any ideas?
     
    Thanks
     
    Adam
View Complete Thread