We currently have some code that exports our GoJS (v2.3.2) diagram to a PNG:
function getImage(
pedigree: go.Diagram,
usePng: boolean,
width: number = NaN,
height: number = NaN,
callback?: (data: string | Blob) => void
) {
const mimetype = usePng ? "image/png" : "image/jpeg";
const returnType = callback ? "blob" : undefined;
let size = new go.Size(width, height);
if (isNaN(width) && isNaN(height)) {
size = pedigree.documentBounds.size;
}
return pedigree.makeImageData({
background: "white",
size,
maxSize: new go.Size(Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY),
type: mimetype,
returnType,
callback,
}) as string;
}
However, we have two GoJS diagrams in the page, a genogram and its legend. We’d like the PNG output to contain both of these diagrams. Is there a way in GoJS to achieve this?