Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
Stampクラスは、PDFファイルに透かしを追加することを可能にします。 BindImageメソッドを使用して、スタンプとして追加する画像を指定できます。SetOriginメソッドを使用すると、追加されたスタンプの原点を設定できます。この原点は、スタンプの左下の座標です。また、SetImageSizeメソッドを使用して画像のサイズを設定することもできます。
次に、スタンプをスタンプの中心の周りで回転させる方法を見ていきます。Stampクラスは、Rotationという名前のプロパティを提供します。このプロパティは、スタンプコンテンツの回転を0から360の範囲で設定または取得します。0から360の任意の回転値を指定できます。回転値を指定することで、スタンプを中心点の周りで回転させることができます。StampがStamp型のオブジェクトである場合、回転値は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.