הגדרת מאפיינים על תמונות
עדכון מטמון פונטים
על ידי השתמשות ב- Aspose.PSD עבור .NET, המפתחים יכולים להוסיף אפשרות לרענון מטמון הפונטים. להלן הדגמת קוד של הפונקציונליות המדוברת.
// For complete examples and data files, please go to https://github.com/aspose-psd/Aspose.PSD-for-.NET | |
using (PsdImage image = (PsdImage)Image.Load(dataDir + "sample.psd")) | |
{ | |
image.Save("NoFont.psd"); | |
} | |
Console.WriteLine("You have 2 minutes to install the font"); | |
Thread.Sleep(TimeSpan.FromMinutes(2)); | |
OpenTypeFontsCache.UpdateCache(); | |
using (PsdImage image = (PsdImage)Image.Load(dataDir + @"sample.psd")) | |
{ | |
image.Save(dataDir + "HasFont.psd"); | |
} |
הגדרת החלפה עבור פונטים חסרים
על ידי השתמשות ב- Aspose.PSD עבור .NET, המפתחים יכולים להחליף פונטים חסרים. באמצעות קוד המדגמה למטה, המפתחים יהיו מסוגלים להגדיר שם פונט ברירת מחדל בעת שמירת מסמכי PSD כתמונה רסטרית (לפורמטים PNG, JPG ו-BMP). פונט ברירת המחדל צריך לשמש כהחלפה עבור כל הפונטים החסרים, כלומר פונטים שאינם נמצאים במערכת ההפעלה הנוכחית. להלן הדגמת קוד של הפונקציונליות המדוברת.
// For complete examples and data files, please go to https://github.com/aspose-psd/Aspose.PSD-for-.NET | |
string sourceFileName = "sample_konstanting.psd"; | |
string[] outputs = new string[] | |
{ | |
"replacedfont0.tiff", | |
"replacedfont1.png", | |
"replacedfont2.jpg" | |
}; | |
using (PsdImage image = (PsdImage)Image.Load(sourceFileName, new PsdLoadOptions())) | |
{ | |
// This way you can use different fonts for different outputs | |
image.Save(outputs[0], new TiffOptions(TiffExpectedFormat.TiffJpegRgb) { DefaultReplacementFont = "Arial" }); | |
image.Save(outputs[1], new PngOptions { DefaultReplacementFont = "Verdana" }); | |
image.Save(outputs[2], new JpegOptions { DefaultReplacementFont = "Times New Roman" }); | |
} |