Analyzing your prompt, please hold on...
An error occurred while retrieving the results. Please refresh the page and try again.
تعمل مقتطفات الشيفرة التالية أيضًا مع مكتبة Aspose.PDF.Drawing.
من الممكن تعيين حجم صورة تتم إضافتها إلى ملف PDF. لتعيين الحجم، يمكنك استخدام خصائص FixWidth و FixHeight من فئة Aspose.Pdf.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.