Quantcast
Viewing all articles
Browse latest Browse all 3131

Cannot add new section after a multi-columns section

Got System.NullReferenceException when adding a new section which is not a page after another section which has an image inside.
var pdf = new Pdf();
const string webImgUrl = @"https://www.google.co.nz/images/srpr/logo11w.png";
var section = pdf.Sections.Add();
var img = new Image { ImageInfo = { File = webImgUrl, ImageFileType = ImageFileType.Png } };
section.Paragraphs.Add(img);
section.ColumnInfo.ColumnCount = 2;
section.Paragraphs.Add(new Text("Text 1"));

var thirdSection = pdf.Sections.Add();
thirdSection.IsNewPage = false;
using (var stream = new MemoryStream())
{
pdf.Save(stream);
using (var fileStream = File.Open(@"C:\temp\Image_Error.pdf", FileMode.Create))
stream.CopyTo(fileStream);
}

Viewing all articles
Browse latest Browse all 3131

Trending Articles