Stack Empty Error while saving to PDF after deleting a a paragraph from Header section

HI

I am trying to delete a paragraph from a word template and save the doc as pdf it gives me stack empty error

the code used to remove is provided below and i am doing it based on bookmark

DocumentBuilder builder = new DocumentBuilder(doc);
builder.MoveToBookmark(bookmark);
if (builder.CurrentParagraph != null)
    builder.CurrentParagraph.Remove();

after this when i call doc.SaveToPdf it shows stack empty error the whole code works fine if i comment the above lines

Please Help on this

Hi

Thanks for your request. Could you please attach your template here for testing? I will check the problem and provide you more information.

Best regards,