Hi, I got an exception when adding an image after a floating box which has two images in it.
Now I am using Aspose.PDF 9.9, the sample code is below:
var pdf = new Pdf();
const string webImgUrl = @“https://www.google.co.nz/images/srpr/logo11w.png”;
var section = pdf.Sections.Add();
var webImg = new Image { ImageInfo = { File = webImgUrl, ImageFileType = ImageFileType.Png, FixHeight = 800 } };
var floatingBox = new Aspose.Pdf.Generator.FloatingBox();
floatingBox.Paragraphs.Add(webImg);
floatingBox.Paragraphs.Add(webImg);
section.Paragraphs.Add(floatingBox);
section.Paragraphs.Add(webImg);
//pdf.Save(@“C:\temp\Image_Error.pdf”);
using (var stream = new MemoryStream())
{
pdf.Save(stream);
using (var fileStream = File.Open(@“C:\temp\Image_Error.pdf”, FileMode.Create))
stream.CopyTo(fileStream);
}
Thanks
Hi Patrick,
Thanks for your inquiry. Please use new DOM approach for the scenario, it successfully add image after FloatingBox. However, I have noticed that second image in floating box is not rendering correctly. So logged a ticket PDFNEWNET-39067 for further investigation and rectification. We will notify you as soon as it is resolved.
var pdf = new Aspose.Pdf.Document();<o:p></o:p>
const string webImgUrl = @"https://www.google.co.nz/images/srpr/logo11w.png";
var section = pdf.Pages.Add();
Aspose.Pdf.Image
img= new Aspose.Pdf.Image();
var webImg = new Aspose.Pdf.Image {
File = webImgUrl, FixHeight = 800
};
var floatingBox = new
Aspose.Pdf.FloatingBox();
floatingBox.IsNeedRepeating = true;
floatingBox.Paragraphs.Add(webImg);
floatingBox.Paragraphs.Add(webImg);
section.Paragraphs.Add(floatingBox);
section.Paragraphs.Add(webImg);
//pdf.Save(@"C:\temp\Image_Error.pdf");
using (var stream = new MemoryStream())
{
pdf.Save(stream);
using (var fileStream
= File.Open(@"C:\temp\Image_Error.pdf",
FileMode.Create))
stream.CopyTo(fileStream);
}
We are sorry for the inconvenience caused.
Best Regards,
The issues you have found earlier (filed as PDFNEWNET-39067) have been fixed in Aspose.Pdf for .NET 10.7.0.
This message was posted using Notification2Forum from Downloads module by Aspose Notifier.