Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
Les images d’arrière-plan peuvent être utilisées pour ajouter un filigrane ou un autre design subtil aux documents. Dans Aspose.PDF for .NET, chaque document PDF est une collection de pages et chaque page contient une collection d’artefacts. La classe BackgroundArtifact peut être utilisée pour ajouter une image d’arrière-plan à un objet page.
Le code suivant fonctionne également avec la bibliothèque Aspose.PDF.Drawing.
Le code suivant montre comment ajouter une image d’arrière-plan aux pages PDF en utilisant l’objet BackgroundArtifact avec C#.
// 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.