Running initial sample

I have downloaded the free version of GemBox and am trying to code up an initial test. I am running the HTML to PDF example.

However, when I put the same code that is in the example I get errors. I added a few more references thinking that would work but it doesn’t.

In this code:

var htmlLoadOptions = new HtmlLoadOptions();
using (var htmlStream = new MemoryStream(htmlLoadOptions.Encoding.GetBytes(html)))
{
    // Load input HTML text as stream.
    var document = DocumentModel.Load(htmlStream, htmlLoadOptions);
    // Save output PDF file.
    document.Save("Output.pdf");
}

There is a problem with “new MemoryStream(htmlLoadOptions.Encoding.GetBytes(html)))” The ‘Encoding’ is in red with this message when I hover over it: Reference to type ‘Encoding’ claims it is defined in ‘System.Runtime’, but it couldn’t be found

I specifically included a reference to “System.Text.Encoding” but that didn’t seem to help. What is missing?

Thanks in advance,
Paul

As a follow up, I tried the very simple example found in the articles section and doing this:

DocumentModel document = DocumentModel.Load("Input.html", LoadOptions.HtmlDefault);

Results in a “Reference to type ‘Stream’ claims it is defined in System.Runtime, but it could not be found.” error

Is the ‘Stream’ object in GemBox different than the basic ‘System.IO.Stream’ object?

Hi Paul,

There seems to be some problem with your project’s setting.
Can you please send us a small Visual Studio project that reproduces your issue so we can investigate it?

Regards,
Mario

Your project is targeting 4.5.2 so you need to use GemBox.Document 3.5 for .NET Framework 3.5.
Please try again using version 35.0.35.1673:

Does this solve your issue?

Regards,
Mario