Go JS Diagram Download empty pdf issue

Am programmatically loading Big Go JS Diagram with array of nodes and links.
My Diagram is taking few seconds sometimes for complex diagrams, and when i saved diagram to pdf programatically am seeing empty pdf since diagram is not fully loaded.
i want to know and verify diagram is loaded successfully before triggering downloadDiagram function.

i tried timeout and promise
and also
myDiagram = $(go.Diagram, “myDiagramDiv”,
{
// … other properties
“InitialLayoutCompleted”: function(e) {
downloadDiagramImage(e.diagram);
}
});

it didn’t work

Help me with exact possible solutions.

I appreciate for Quick Reply.

First, did you start with GoJS/samples/pdf/minimalPDF.html at master · NorthwoodsSoftware/GoJS · GitHub or a similar sample?

The code you quoted is correct. If you want to automatically produce a rendering after loading a model, do so in an “InitialLayoutCompleted” DiagramEvent listener. There must be some other reason that your PDF file is empty.