Protect and Unprotect Diagrams in Ruby

Aspose.Diagram - Protect and Unprotect Diagrams

To Protect and Unprotect Diagrams using Aspose.Diagram Java for Ruby, simply invoke ProtectUnprotectDiagram module. Here you can see example code.

Ruby Code

 data_dir = File.dirname(File.dirname(File.dirname(File.dirname(__FILE__)))) + '/data/'

\# Create instance of Diagram

diagram = Rjb::import('com.aspose.diagram.Diagram').new(data_dir + "Drawing.vsd")

diagram.getDocumentSettings().setProtectBkgnds(1)

diagram.getDocumentSettings().setProtectMasters(1)

diagram.getDocumentSettings().setProtectShapes(1)

diagram.getDocumentSettings().setProtectStyles(1)

\# Save diagram

diagram.save(data_dir + "ProtectUnprotectDiagram.vdx", Rjb::import('com.aspose.diagram.SaveFileFormat').VDX)

puts "Applied protection on diagram successfully!"

Download Running Code

Download Protect and Unprotect Diagrams (Aspose.Diagram) from any of the below mentioned social coding sites: