इस चरण-दर-चरण ट्यूटोरियल में, हम विस्तृत करेंगे कि बिना PowerPoint स्थापित किए PowerPoint Presentation में C# में ड्राफ्ट वॉटरमार्क कैसे डालें। PPTX प्रारूप अब व्यापक रूप से PowerPoint प्रस्तुतियों के लिए उपयोग किया जाने वाला प्रारूप है, लेकिन यह उदाहरण गोपनीय वॉटरमार्क PowerPoint को जोड़ने के लिए विरासत पीपीटी पर भी लागू होता है।
C# में PowerPoint में गोपनीय वॉटरमार्क जोड़ने के चरण
- NuGet.org से Aspose.Slides for .NET पैकेज प्राप्त करें
- प्रस्तुति लोड करने और वॉटरमार्क डालने के लिए Aspose.Slides नाम स्थान का उपयोग करें
- SetLicense विधि का उपयोग करके लाइसेंस सेट करें
- Presentation Class ऑब्जेक्ट में वॉटरमार्क डालने के लिए पावरपॉइंट प्रेजेंटेशन लोड करें
- प्रस्तुति के अंदर Master Slide/s के माध्यम से पहुंचें और पुनरावृति करें
- प्रत्येक मास्टर स्लाइड के लिए, एक ऑटोशेप जोड़ें
- जोड़े गए आकार के लिए गोपनीय ड्राफ़्ट टेक्स्ट डालें TextFrame
- आकृति और पाठ्य गुणों को प्रारूपित करें
- वॉटरमार्क की सुरक्षा के लिए जोड़े गए आकार पर लॉकिंग लागू करें
- वॉटरमार्क प्रस्तुति सहेजें
पहले, हमने एक और कैसे करें विषय में C# .NET में पावरपॉइंट प्रेजेंटेशन को कैसे सुरक्षित करें? पर गौर किया। लेकिन यह विषय C# में पावरपॉइंट में गोपनीय वॉटरमार्क जोड़ने के चरणों का वर्णन करता है। आप इस सुविधा का उपयोग करने के लिए माइक्रोसॉफ्ट पावरपॉइंट या इंटरऑप पर निर्भर नहीं हैं और इस कोड को सभी प्लेटफॉर्म पर निर्बाध रूप से चला सकते हैं।
हर चीज के ऊपर, शेप लॉकिंग फीचर Aspose.Slides द्वारा दी जाने वाली एक अनूठी विशेषता है जो सार्वजनिक रूप से PowerPoint में भी उपलब्ध नहीं है। आप लॉकिंग सुविधा का उपयोग करके और इसे वॉटरमार्क आकार में लागू करके और PowerPoint में किसी को संशोधित करने या हटाने की अनुमति देकर प्रस्तुति के बौद्धिक संपदा अधिकारों की रक्षा कर सकते हैं।
इंटरऑप के बिना सी # में पावरपॉइंट में ड्राफ्ट वॉटरमार्क जोड़ने के लिए कोड
using System; | |
using Aspose.Slides; | |
using Aspose.Slides.Export; | |
namespace WatermarkPPTXinC_Sharp | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
string PathForWatermarkPptFile = @".\"; | |
//Loading the product license | |
License license = new License(); | |
license.SetLicense(PathForWatermarkPptFile+"Conholdate.Total.Product.Family.lic"); | |
//Load the presentation to insert watermark | |
Presentation WatermarkPptxPresentation = new Presentation(PathForWatermarkPptFile + "Draft.pptx"); | |
//Accessing the master slides for adding watermark | |
foreach (IMasterSlide masterSlide in WatermarkPptxPresentation.Masters) | |
{ | |
//Adding a Ppt watermark shape | |
IAutoShape PptxWatermark = masterSlide.Shapes.AddAutoShape(ShapeType.Rectangle, | |
WatermarkPptxPresentation.SlideSize.Size.Width / 2 - 50, | |
WatermarkPptxPresentation.SlideSize.Size.Height / 2 - 50, | |
200, 50); | |
//Setting rotation angle and fill type of the shape | |
PptxWatermark.Rotation = 325; | |
PptxWatermark.FillFormat.FillType = FillType.NoFill; | |
//Adding Text frame with watermark text | |
ITextFrame WatermarkText = PptxWatermark.AddTextFrame("Confidential Draft"); | |
//Setting textual properties of the watermark text | |
IPortionFormat WatermarkTextFormat = WatermarkText.Paragraphs[0].Portions[0].PortionFormat; | |
WatermarkTextFormat.FontBold = NullableBool.True; | |
WatermarkTextFormat.FontItalic = NullableBool.True; | |
WatermarkTextFormat.FontHeight = 20; | |
WatermarkTextFormat.FillFormat.FillType = FillType.Solid; | |
WatermarkTextFormat.FillFormat.SolidFillColor.Color = System.Drawing.Color.Red; | |
//Locking Pptx watermark shape to be uneditable in PowerPoint | |
PptxWatermark.AutoShapeLock.TextLocked=true; | |
PptxWatermark.AutoShapeLock.SelectLocked = true; | |
PptxWatermark.AutoShapeLock.PositionLocked = true; | |
} | |
//Saving the watermark PowerPoint presentation file | |
WatermarkPptxPresentation.Save(PathForWatermarkPptFile+"WatermarkPresentation.pptx", | |
SaveFormat.Pptx); | |
} | |
} | |
} |
उदाहरण का उपयोग किसी भी .NET अनुप्रयोग वातावरण में C# कोड का उपयोग करके किया जा सकता है, चाहे वह ASP.NET वेब अनुप्रयोग हो, Windows प्रपत्र अनुप्रयोग हो, या कंसोल आधारित हो। आप इसे अपने स्थानीय कार्य मशीन पर या .NET Framework स्थापित किसी भी सर्वर पर भी उपयोग कर सकते हैं।