I get null reference error when trying to render document that has been cloned. I create clone document because it cannot be rendered twice, and I need the clone to be stored into blob storage. The original document is returned to user.
Stack trace:
at MigraDoc.DocumentObjectModel.Visitors.VisitorBase.VisitHeaderFooter(HeaderFooter headerFooter)
at MigraDoc.DocumentObjectModel.HeaderFooter.MigraDoc.DocumentObjectModel.Visitors.IVisitable.AcceptVisitor(DocumentObjectVisitor visitor, Boolean visitChildren)
at MigraDoc.DocumentObjectModel.HeadersFooters.MigraDoc.DocumentObjectModel.Visitors.IVisitable.AcceptVisitor(DocumentObjectVisitor visitor, Boolean visitChildren)
at MigraDoc.DocumentObjectModel.Section.MigraDoc.DocumentObjectModel.Visitors.IVisitable.AcceptVisitor(DocumentObjectVisitor visitor, Boolean visitChildren)
at MigraDoc.DocumentObjectModel.Sections.MigraDoc.DocumentObjectModel.Visitors.IVisitable.AcceptVisitor(DocumentObjectVisitor visitor, Boolean visitChildren)
at MigraDoc.DocumentObjectModel.Document.MigraDoc.DocumentObjectModel.Visitors.IVisitable.AcceptVisitor(DocumentObjectVisitor visitor, Boolean visitChildren)
at MigraDoc.DocumentObjectModel.Visitors.VisitorBase.Visit(DocumentObject documentObject)
at MigraDoc.Rendering.DocumentRenderer.PrepareDocument()
at MigraDoc.Rendering.PdfDocumentRenderer.PrepareDocumentRenderer(Boolean prepareCompletely)
at MigraDoc.Rendering.PdfDocumentRenderer.PrepareRenderPages()
at MigraDoc.Rendering.PdfDocumentRenderer.RenderDocument()
From the heap I managed to find out, that the error comes from this part of the code:
Attachment:
image.png [ 87.12 KiB | Viewed 5065 times ]
Attachment:
image2.png [ 93.79 KiB | Viewed 5065 times ]
I have tried to add styles again for the clone, but it did not work. Are there any workarounds?