Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
背景画像は、文書にウォーターマークやその他の微妙なデザインを追加するために使用できます。Aspose.PDF for .NETでは、各PDF文書はページのコレクションであり、各ページはアーティファクトのコレクションを含んでいます。BackgroundArtifactクラスを使用して、ページオブジェクトに背景画像を追加できます。
次のコードスニペットは、Aspose.PDF.Drawingライブラリでも動作します。
次のコードスニペットは、C#を使用してBackgroundArtifactオブジェクトでPDFページに背景画像を追加する方法を示しています。
// For complete examples and data files, visit https://github.com/aspose-pdf/Aspose.PDF-for-.NET
private static void AddBackgroundToPdf()
{
// The path to the documents directory
var dataDir = RunExamples.GetDataDir_AsposePdf_Pages();
// Create PDF document
using (var document = new Aspose.Pdf.Document())
{
// Image for background artifact object
using (var image = File.OpenRead(dataDir + "aspose-total-for-net.jpg"))
{
// Add page
Page page = document.Pages.Add();
// Create Background Artifact object
var background = new Aspose.Pdf.BackgroundArtifact();
// Specify the image for background artifact object
background.BackgroundImage = image;
// Add background artifact to artifacts collection of page
page.Artifacts.Add(background);
// Save PDF document
document.Save(dataDir + "ImageAsBackground_out.pdf");
}
}
}
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.