public static void Run() { // ExStart:UpdateTextLayerInPSDFile // The path to the documents directory. string dataDir = RunExamples.GetDataDir_PSD(); try { // Load a PSD file as an image and caste it into PsdImage using (PsdImage image = (PsdImage)Image.Load(dataDir + "samplePsd.psd")) { PsdImage psdImage = image; TextLayer textLayer1 = psdImage.Layers[1] as TextLayer; TextLayer textLayer2 = psdImage.Layers[2] as TextLayer; Debug.Assert(textLayer2 != null, "textLayer2 != null"); textLayer2.UpdateText("test update", new Point(100, 100), 72.0f, Color.Purple); psdImage.Save(dataDir + "UpdateTextLayerInPSDFile_out.psd", new PsdOptions { CompressionMethod = CompressionMethod.RLE }); } } catch (Exception ex) { Console.WriteLine(ex.Message + "\nThis example will only work if you apply a valid Aspose License. You can purchase full license or get 30 day temporary license from http:// Www.aspose.com/purchase/default.aspx."); } // ExEnd:UpdateTextLayerInPSDFile }
public static void Run() { // ExStart:UpdateTextLayerInPSDFile // The path to the documents directory. string dataDir = RunExamples.GetDataDir_PSD(); // Load a PSD file as an image and caste it into PsdImage using (PsdImage image = (PsdImage)Image.Load(dataDir + "samplePsd.psd")) { PsdImage psdImage = image; TextLayer textLayer1 = psdImage.Layers[1] as TextLayer; TextLayer textLayer2 = psdImage.Layers[2] as TextLayer; Debug.Assert(textLayer2 != null, "textLayer2 != null"); textLayer2.UpdateText("test update", new Point(100, 100), 72.0f, Color.Purple); psdImage.Save(dataDir + "UpdateTextLayerInPSDFile_out.psd", new PsdOptions { CompressionMethod = CompressionMethod.RLE }); } // ExEnd:UpdateTextLayerInPSDFile }
public static void Run() { //ExStart:UpdateTextLayerInPSDFile // The path to the documents directory. string dataDir = RunExamples.GetDataDir_PSD(); // Load a PSD file as an image and cast it into PsdImage using (PsdImage psdImage = (PsdImage)Image.Load(dataDir + "layers.psd")) { foreach (var layer in psdImage.Layers) { if (layer is TextLayer) { TextLayer textLayer = layer as TextLayer; textLayer.UpdateText("test update", new Point(0, 0), 15.0f, Color.Purple); } } psdImage.Save(dataDir + "UpdateTextLayerInPSDFile_out.psd"); } //ExEnd:UpdateTextLayerInPSDFile }