Book a Demo

Author Topic: export diagram picture  (Read 4086 times)

mgt

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
export diagram picture
« on: April 25, 2014, 11:31:08 pm »
Hi,

I'd like to save a picture from a diagram with automation.
Just like EA's menu "Diagram=>Save as image"

But in the diagram class, I do not see this opportunity.
http://www.sparxsystems.com/enterprise_architect_user_guide/10/automation_and_scripting/diagram2.html

There is this SaveAsPDF function I may use, but I can't find it in the API I use.
I'm using EA10.

Do you have any idea how to export a diagram as an image?

Thanks in advance,

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: export diagram picture
« Reply #1 on: April 25, 2014, 11:50:58 pm »
See the ProjectInterface SaveDiagramImageToFile (string Filename)


q.

Tehila1

  • EA User
  • **
  • Posts: 256
  • Karma: +0/-0
    • View Profile
Re: export diagram picture
« Reply #2 on: April 28, 2014, 04:54:17 pm »
Hello!

Here is the code:
Code: [Select]
var project = Repository.GetProjectInterface();
project.PutDiagramImageToFile(diagram.DiagramGUID,  @"C:\Temp\ImageFileName" + ".png", 0);
 

Hope this helps.

mgt

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: export diagram picture
« Reply #3 on: April 28, 2014, 07:05:01 pm »
Thanks for your quick answers, it worked.

Migth helps someone else, link to the related api doc :
http://www.sparxsystems.com/enterprise_architect_user_guide/9.3/automation/project_2.html