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.
Unfortunately, activation email could not send to your email. Please try again.

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

Thread ID:

Created:

Updated:

Platform:

Replies:

126285 Oct 5,2016 12:56 PM Oct 18,2016 05:45 AM JavaScript 3
loading
Tags: ejDiagram
Jim Jacobs
Asked On October 5, 2016 12:56 PM

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


Shyam G [Syncfusion]
Replied On October 6, 2016 09:05 AM

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 


Jim Jacobs
Replied On October 17, 2016 02:29 PM

Hi Shyam,

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

Jim

Kameshwaran R [Syncfusion]
Replied On October 18, 2016 05:45 AM

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


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;