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.