We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Document.Save(Stream) issue

When trying to save a Document file as a stream, I’m getting this error:

Could not load file or assembly ‘System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089’. The system cannot find the file specified.

Code:

Document html = new Document();

        Page p = html.Pages.Add();
        HtmlFragment h = new HtmlFragment("<b>text</b>");

        p.Paragraphs.Add(h);
        using (MemoryStream stream = new MemoryStream())
        {
            html.Save(stream);
        }

@jeremyhurst02

Thank you for contacting support.

Would you please double check if source of this error is Aspose.PDF for .NET API because we are unable to reproduce it with Aspose.PDF for .NET 19.7. If you still face this problem then please share a narrowed down sample application with us so that we may try to reproduce and investigate further.

This was for pdf .net 19.7.

I just swapped the code to use .netstandard instead and it started working. not sure why though.

@jeremyhurst02

Thank you for your kind feedback.

We are glad to know that you are not facing any problem now. Please feel free to contact us if any issue occurs. We will be glad to help you.