We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

How to change page border at run time (prior to export)

Hi,

This has to be something stupid that I'm doing wrong.
Normally there is a 2 pixel wide blue border around the diagram.
When I export it I want to remove the border.

Here's the code I'm using:

function ExportAsImage(imgType, fileName) {
    //$("#diagramcontent").ejDiagram({
    //    pageSettings: { pageBorderColor: "white", pageBorderWidth: 0 }
    //});
    diagram.update({ pageSettings: { pageBorderColor: "white", pageBorderWidth: 0 } });
    diagram.updateViewPort();

    var options = {
        //Name of the exported file
        fileName: fileName,
        //Specifies whether to export as files/data
        mode: "download",
        //mode: "data",
        //Specifies the region to be exported (pageSettings or content)
        region: "pageSettings",
        //Format of the exported file
        format: imgType
        //Can be set as a rectangle {x,y width, height}
        //bounds: { x: 0, y: 0 },
        //margin to the exported file/data
        //margin: { left: 30 }
    };
    diagram.exportDiagram(options);
}

However, the exported file has the blue border :(

What am I doing wrong?

Thanks

Jim


3 Replies

SG Shyam G Syncfusion Team October 6, 2016 01:05 PM UTC

Hi Jim, 
 
We suspect that you would have defined wrong diagram ID in your code example. However we have modified your code example to achieve your requirement. 
 
Code example: 
function ExportAsImage(imgType, fileName) { 
        $("#diagram").ejDiagram({ 
            pageSettings: { pageBorderColor: "white", pageBorderWidth: 0 } 
        }); 
        var diagram=$("#diagram").ejDiagram("instance");         
        var options = { 
            //Name of the exported file 
            fileName: fileName, 
            //Specifies whether to export as files/data 
            mode: "download", 
            //mode: "data", 
            //Specifies the region to be exported (pageSettings or content) 
            region: "pageSettings", 
            //Format of the exported file 
            format: imgType 
            //Can be set as a rectangle {x,y width, height} 
            //bounds: { x: 0, y: 0 }, 
            //margin to the exported file/data 
            //margin: { left: 30 } 
        }; 
        diagram.exportDiagram(options); 
    } 
 
Regards, 
Shyam G 



JJ Jim Jacobs October 17, 2016 06:29 PM UTC

Hi Shyam,

Thanks - you were correct.
I was using #diagramcontent instead of #DiagramContent.
Everything is working now.

Jim


KR Kameshwaran R Syncfusion Team October 18, 2016 09:45 AM UTC

Hi Jim, 
 
Please let us know if you require further assistance.  
 
Regards, 
Kameshwaran R. 


Loader.
Live Chat Icon For mobile
Up arrow icon