double x = 100.0, y = 600.0, width = 200.0, height = 200.0;
auto rect = MakeObject<Aspose::Pdf::Rectangle>(x, y, x + width, y + height);
stream->Seek(0, System::IO::SeekOrigin::Begin);
page->AddImage(stream, rect);
auto text = MakeObject<TextFragment>(u"This example is created by Aspose.Pdf for C++.");
auto ts = text->get_TextState();
ts->set_FontSize(16);
ts->set_FontStyle(FontStyles::Italic);
paragraps->Add(text);
doc->Save(u"C:\\Users\\孙啸\\Documents\\Example1.pdf");
// Load the PDF file
auto pdfDocument = MakeObject<Document>(u"SourceDirectory\\PDF\\Sample 1.pdf");
// Retrieve the first page
auto page = pdfDocument->get_Pages()->idx_get(1);
// Create an instance of the Rectangle class
double x = 100.0, y = 600.0, width = 200.0, height = 200.0;
auto rectangle = MakeObject<Aspose::Pdf::Rectangle>(x, y, x + width, y + height);
// Add image to the page
page->AddImage(u"SourceDirectory\\Images\\AsposeLogo.png", rectangle);
// Save the PDF file
pdfDocument->Save(u"OutputDirectory\\add_image_output.pdf");