Free Support Forum - groupdocs.com

Certain PDF to HTML rendering generates null reference exception in .NET

Converting the attached PDF to HTML results in a NullReferenceException.
This happens only with this one PDF and was tested with GroupDocs.Viewer 20.6.1
PDF With Signature.pdf (370.6 KB)

    using (var viewer = new Viewer("PDF With Signature.pdf"))
    {
        var options = View.Options.HtmlViewOptions.ForEmbeddedResources("PDF With Signature.html");
        viewer.View(options);
    }

@Clemens_Pestuka

This issue is reproduced at our end. We’ve logged it in our internal issue tracking system with ID VIEWERNET-2602. We’ll now further investigate it and share outcomes with you.

1 Like

@Clemens_Pestuka

As a workaround, please use following code:

using (Viewer viewer = new Viewer("PDF With Signature.pdf"))
{
    ViewOptions viewOptions = HtmlViewOptions.ForEmbeddedResources();
    viewOptions.RenderComments = true;  

    viewer.View(viewOptions);
} 

By default, we’re removing all the annotations and this is what causes the exception, so setting RenderComments = true fixes the issue for now. Meanwhile, we’ll further investigate and resolve the issue.

1 Like

@atirtahir3

Thank you for the workaround :+1:
It’s interesting to know the comments are causing this.

1 Like

@Clemens_Pestuka

You’re welcome.

1 Like