@nethmi
We were able to achieve the expected output PDF using the code below:
using (var document = new Aspose.Html.HTMLDocument(File.ReadAllText(dataDir + "CurrentHTMLCode.html"), "."))
{
// Find the paragraph element to set a style attribute
var images = document.GetElementsByTagName("img").Skip(1);
foreach(var img in images)
{
// Set the style attribute
img.SetAttribute("style", "float: left;");
}
// Save the HTML document to a file
document.Save(Path.Combine(dataDir, "edit-inline-css.html"));
string file = dataDir + "edit-inline-css.html";
MemoryStream ms = new MemoryStream(File.ReadAllBytes(file));
Aspose.Html.Saving.PdfSaveOptions options = new Html.Saving.PdfSaveOptions()
{
JpegQuality = 100,
};
options.PageSetup.PageLayoutOptions = Html.Rendering.PageLayoutOptions.FitToWidestContentWidth;
using (var htmldocument = new Aspose.Html.HTMLDocument(ms, dataDir))
{
Aspose.Html.Converters.Converter.ConvertHTML(htmldocument, options, dataDir + "ouptut.pdf");
}
}
ouptut.pdf (150.6 KB)