Hi,
In order to hide the document border of a diagram you should use the following line of code:
document.BackgroundStyle.FrameStyle.Visible = false;
We tested it on our side and it works fine. If it does not work for you, then please submit a support ticket with your sample project. We will then be able to analyze your code and tell you what's wrong and how to fix it.