Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
Imagens de fundo podem ser usadas para adicionar uma marca d’água ou outro design sutil aos documentos. No Aspose.PDF for .NET, cada documento PDF é uma coleção de páginas e cada página contém uma coleção de artefatos. A classe BackgroundArtifact pode ser usada para adicionar uma imagem de fundo a um objeto de página.
O seguinte trecho de código também funciona com a biblioteca Aspose.PDF.Drawing.
O seguinte trecho de código mostra como adicionar uma imagem de fundo às páginas PDF usando o objeto BackgroundArtifact com 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.