string dataDir = @"C:\\temp\";
// Open document
Document pdfDocument = new Document(dataDir + "TestFile.pdf");
string html = "Line <b>One</b> </br> Line <b>Two</b> </br> Line <b>Three</b>";
// create HTML Fragment object
Aspose.Pdf.HtmlFragment htmlFragment = new Aspose.Pdf.HtmlFragment(html);
htmlFragment.IsFirstParagraphInColumn = false;
htmlFragment.IsInLineParagraph = false;
htmlFragment.IsInNewPage = false;
htmlFragment.IsKeptWithNext = false;
// create FloatingBox object to contain HTML Fragment object
Aspose.Pdf.FloatingBox floatingBox = new Aspose.Pdf.FloatingBox(500, 500);
floatingBox.Top = 500;
floatingBox.Left = -50;
floatingBox.Paragraphs.Insert(0, htmlFragment);
Aspose.Pdf.Page page = pdfDocument.Pages[1];
page.Paragraphs.Add(floatingBox);
string outFile = dataDir + "TestFileOutput.pdf";
// Save updated document
pdfDocument.Save(outFile);
TestFile.pdf (10.0 KB)
I need to keep the image button from moving when adding an HtmlFragment to existing page.
I added this issue to the wrong category. The correct category is “Aspose.PDF Product Family category”