Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
印章 类允许您在PDF文件中添加水印。您可以使用 BindImage 方法指定要作为印章添加的图像。SetOrigin 方法允许您设置添加的印章的原点;该原点是印章的左下角坐标。您还可以使用 SetImageSize 方法设置图像的大小。
现在,我们来看一下如何围绕印章的中心旋转印章。印章 类提供了一个名为 Rotation 的属性。该属性设置或获取印章内容的旋转角度,范围从0到360。我们可以指定从0到360的任何旋转值。通过指定旋转值,我们可以围绕其中心点旋转印章。如果一个印章是印章类型的对象,则可以指定旋转值为 aStamp.Rotation = 90。在这种情况下,印章将围绕印章内容的中心旋转90度。以下代码片段向您展示了如何围绕中心点旋转印章:
// For complete examples and data files, visit https://github.com/aspose-pdf/Aspose.PDF-for-.NET
private static void AddRotatingStampToPdf()
{
// The path to the documents directory
var dataDir = RunExamples.GetDataDir_AsposePdfFacades_TechnicalArticles();
// Create PdfFileInfo object to get height and width of the pages
using (var fileInfo = new Aspose.Pdf.Facades.PdfFileInfo(dataDir + "RotatingStamp.pdf"))
{
// Create Stamp object
var aStamp = new Aspose.Pdf.Facades.Stamp();
// Bind image file with the Stamp object
aStamp.BindImage(dataDir + "RotatingStamp.jpg");
// Specify whether the stamp will be added as a background or not
aStamp.IsBackground = false;
// Specifies at which pages to add the watermark
aStamp.Pages = new int[] { 1 };
// Specifies the watermark rotation - rotate at 90 degrees
aStamp.Rotation = 90;
// Specifies the position of stamp - lower left corner of the stamp
aStamp.SetOrigin(fileInfo.GetPageWidth(1) / 2, fileInfo.GetPageHeight(1) / 2);
// Set the size of the watermark
aStamp.SetImageSize(100, 100);
// Open PDF document
using (var document = new Aspose.Pdf.Document(dataDir + "RotatingStamp_out.pdf"))
{
// Create PdfFileStamp class to bind input and output files
using (var stamper = new Aspose.Pdf.Facades.PdfFileStamp(document))
{
// Add the stamp in the PDF file
stamper.AddStamp(aStamp);
}
}
}
}
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.