Update Text And Shape Color
Updates text and shape color of PSD image and saves to PDF file.
Сode Snippet
var psdProcessor = new PsdProcessor();
var psName = psdProcessor.FontResolver.FontRegistry.Add("ARIALUNI.TTF");
psdProcessor.FontResolver.FontRegistry.FallbackFonts.Add(psName);
psdProcessor.TextCallback = (processor, textFrame, textString) =>
{
var text = processor.ProcessText(textFrame);
text.String = textString;
text.Brush = new SolidBrush(RgbColor.DarkRed);
return text;
};
psdProcessor.FrameCallback = (processor, frame) =>
{
if (frame.Type != FrameType.Shape)
{
return processor.ProcessFrame(frame);
}
var shapeFrame = (PsdShapeFrame)frame;
var graphicsContainer = new GraphicsContainer(frame.X + frame.Width, frame.Y + frame.Height, frame.DpiX, frame.DpiY);
using (var graphics = graphicsContainer.GetGraphics())
{
graphics.FillPath(new SolidBrush(RgbColor.DarkGreen), shapeFrame.VectorMask);
}
return graphicsContainer;
};
psdProcessor.Render("Seal.psd", "UpdateTextAndShapeColor.pdf");
Input
Seal.psd
DownloadOutput
UpdateTextAndShapeColor.pdf
DownloadUpdateTextAndShapeColor.png
For AI-assisted development: Download Graphics Mill Code Samples XML Catalog