Search The ForumSearch   RegisterRegister  LoginLogin

MailBee.NET Objects

 AfterLogic Forum : MailBee.NET Objects
Subject Topic: HtmlToPdf.ConvertFile: Method Not Found Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
Sever
Newbie
Newbie
Avatar

Joined: 04 August 2016
Location: United States
Online Status: Offline
Posts: 11
Posted: 17 February 2020 at 1:13pm | IP Logged Quote Sever

I recently attempted to “hotfix” an older version of our product with a newer MailBee 12.1.1 to support TLS 1.1 and TLS 1.2. This version was running on .Net 4 Framework (not 4.5 or later).

I downloaded the latest installer and grabbed the following files from the C:\Program Files (x86)\MailBee.NET Objects\4.0 directory.
HtmlAgilityaPack.dll (1.4.9.5)
Mailbee.NET.dll (12.1.1.620)
Mailbee.NET.PDF.dll (12.1.1.620)
I also found the ITextSharp.dll (4.1.6.0) in the parent directory.

When testing, I found I could no longer convert an email body from HTML to PDF.
I received an error:
   Method not found: 'System.Text.Encoding a.bh.b(System.String)'.
Stack trace:
   at a.n.k.a(Byte[] A_0)
   at a.n.k.a(Stream A_0, Stream A_1)
   at a.n.k.b(String A_0, Stream A_1)
   at ConsoleApp1.Program.Main(String[] args)

Exception occurred on the converter.ConvertFile(htmlFile, outputStream); line below.


String emailFile = "c:\\test.eml";    // retrieved from gmail
MailMessage message = new MailMessage();
message.LoadMessage(emailFile);

try
{
   MailBee.Pdf.HtmlToPdf converter = new MailBee.Pdf.HtmlToPdf( )
   {
      SourceType = MailBee.Pdf.PdfSourceType.Html
   };

   using (MemoryStream outputStream = new MemoryStream())
   {
      converter.ConvertFile(htmlFile, outputStream);
      byte[] emailBody = outputStream.ToArray();
   }
}
catch (Exception e)
{
    throw e;
}


I switched to using Nuget and the same error occurred.

The only way I could get this to work was to reference the slightly older version 12.1.0.618 directly (References, Add References, Browse) (i.e…not from NuGet), and ensure no binding redirects in app.config.
Is this a known issue with 12.1.1.620?

Thanks
Back to Top View Sever's Profile Search for other posts by Sever
 
Alex
AfterLogic Support
AfterLogic Support
Avatar

Joined: 19 November 2003
Online Status: Offline
Posts: 2159
Posted: 18 February 2020 at 12:06am | IP Logged Quote Alex

I just tried MailBee.NET.PDF.dll 12.1.1.620 for .NET 4.0, ConvertFile worked flawlessly. Can't reproduce the issue, sorry. Maybe it occurs for some particular HTML files only?

Regards,
Alex
Back to Top View Alex's Profile Search for other posts by Alex
 
Sever
Newbie
Newbie
Avatar

Joined: 04 August 2016
Location: United States
Online Status: Offline
Posts: 11
Posted: 18 February 2020 at 6:58am | IP Logged Quote Sever

An update:

We tried the sample project on another machine and it worked great.
The only difference is:

a) On the original machine we installed MailBee from the installer to get help files, samples, etc.

b) Original machine is loading the MailBee.Net.dll 12.01.1.620 from the GAC. Second machine is loading it from the bin\debug.

Right now the problem seems to be isolated to the original only.

Back to Top View Sever's Profile Search for other posts by Sever
 
Sever
Newbie
Newbie
Avatar

Joined: 04 August 2016
Location: United States
Online Status: Offline
Posts: 11
Posted: 18 February 2020 at 7:08am | IP Logged Quote Sever

I just uninstalled MailBee .Net Objects.

Verified the sample project was using Mailbee components 12.01.1.620 from NuGet.

The test/sample project above works great now.

Mailbee.Net.dll and Mailbee.Net.Pdf.dll are being loaded from the bin\debug.
Back to Top View Sever's Profile Search for other posts by Sever
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump

Powered by Web Wiz Forums version 7.9
Copyright ©2001-2004 Web Wiz Guide