PDF dosyasına metin damgası ile çalışmak için net platformu için zengin özelliklere sahip, güçlü ve kullanımı kolay bir belge işleme API’si olan .NET için Aspose.PDF API’sini kullanacağız. NuGet paket yöneticisini açın, Aspose.PDF öğesini arayın ve yükleyin. Paket Yöneticisi Konsolu’ndan aşağıdaki komutu da kullanabilirsiniz.
PM > Install-Package Aspose.PDF
PDF Belgesine Damga Ekle C#
Ortamınızdaki kodu denemek için Aspose.PDF for .NET gerekir.
- PDF’yi bir Belge örneğiyle yükleyin.
- DocumentInfo özelliğini kullanarak DocumentInfo alın.
- Farklı Document.Info özelliklerine erişin ve görüntüleyin.
PDF'ye Damga Ekle - C#.
// Open document
Document pdfDocument = new Document(dataDir+ "AddTextStamp.pdf");
// Create text stamp
TextStamp textStamp = new TextStamp("Sample Stamp");
// Set whether stamp is background
textStamp.Background = true;
// Set origin
textStamp.XIndent = 100;
textStamp.YIndent = 100;
// Rotate stamp
textStamp.Rotate = Rotation.on90;
// Set text properties
textStamp.TextState.Font = FontRepository.FindFont("Arial");
textStamp.TextState.FontSize = 14.0F;
textStamp.TextState.FontStyle = FontStyles.Bold;
textStamp.TextState.FontStyle = FontStyles.Italic;
textStamp.TextState.ForegroundColor = Aspose.Pdf.Color.FromRgb(System.Drawing.Color.Aqua);
// Add stamp to particular page
pdfDocument.Pages[1].AddStamp(textStamp);
dataDir = dataDir + "AddTextStamp_out.pdf";
// Save output document
pdfDocument.Save(dataDir);