Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
Le code suivant fonctionne également avec la bibliothèque Aspose.PDF.Drawing.
Il est possible de définir la taille d’une image qui est ajoutée à un fichier PDF. Pour définir la taille, vous pouvez utiliser les propriétés FixWidth et FixHeight de la classe Aspose.Pdf.Image. Le code suivant démontre comment définir la taille d’une image :
// For complete examples and data files, visit https://github.com/aspose-pdf/Aspose.PDF-for-.NET
private static void SetImageSizeInPDF()
{
// The path to the documents directory
var dataDir = RunExamples.GetDataDir_AsposePdf_Images();
// Create PDF document
using (var document = new Aspose.Pdf.Document())
{
// Add page
var page = document.Pages.Add();
// Create an image instance
var img = new Aspose.Pdf.Image();
// Set Image Width and Height in Points
img.FixWidth = 100;
img.FixHeight = 100;
// Set image type as SVG
img.FileType = Aspose.Pdf.ImageFileType.Unknown;
// Path for source file
img.File = dataDir + "InputImage.jpg";
// Add image to the page
page.Paragraphs.Add(img);
// Set page properties
page.PageInfo.Width = 800;
page.PageInfo.Height = 800;
// Save PDF document
document.Save(dataDir + "SetImageSize_out.pdf");
}
}
Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.