We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Image being repeated in next page

If first column of the row has some text which overflows to next page and second column has a image which remains in a page, then i see that image is being repeated in next page. How can i avoid this issue.

Here is the code that I’m using.

var row = documentTable.Rows.Add();

var cellHTML = @"<h2 style=""background-image: none; background-position: initial; background-size: initial; background-repeat: initial; background-attachment: initial; background-origin: initial; background-clip: initial; font-weight: normal; margin: 1em 0px 0.25em; overflow: hidden; padding: 0px; border-bottom: 1px solid #a2a9b1; font-family: 'Linux Libertine', Georgia, Times, serif; line-height: 1.3;""><span style=""font-size: 18pt;""><strong><span class=""mw-headline"" id=""Education_and_career"">Education and career</span></strong></span></h2> <p style=""margin: 0.5em 0px; line-height: inherit; color: #222222; font-family: sans-serif;"">James Gosling received a&nbsp;<a href=""https://en.wikipedia.org/wiki/Bachelor_of_Science"" title=""Bachelor of Science"" style=""text-decoration-line: none; color: #0b0080; background: none;"">Bachelor of Science</a>&nbsp;from the&nbsp;<a href=""https://en.wikipedia.org/wiki/University_of_Calgary"" title=""University of Calgary"" style=""text-decoration-line: none; color: #0b0080; background: none;"">University of Calgary</a>&nbsp;<sup id=""cite_ref-4"" class=""reference"" style=""line-height: 1; unicode-bidi: isolate; white-space: nowrap; font-size: 11.2px;""><a href=""https://en.wikipedia.org/wiki/James_Gosling#cite_note-4"" style=""text-decoration-line: none; color: #0b0080; background: none;"">[4]</a></sup>&nbsp;and his M.A. and Ph.D. from&nbsp;<a href=""https://en.wikipedia.org/wiki/Carnegie_Mellon_University"" title=""Carnegie Mellon University"" style=""text-decoration-line: none; color: #0b0080; background: none;"">Carnegie Mellon University</a>, all in&nbsp;<a href=""https://en.wikipedia.org/wiki/Computer_science"" title=""Computer science"" style=""text-decoration-line: none; color: #0b0080; background: none;"">computer science</a>.<sup id=""cite_ref-mathgene_2-1"" class=""reference"" style=""line-height: 1; unicode-bidi: isolate; white-space: nowrap; font-size: 11.2px;""><a href=""https://en.wikipedia.org/wiki/James_Gosling#cite_note-mathgene-2"" style=""text-decoration-line: none; color: #0b0080; background: none;"">[2]</a></sup><sup id=""cite_ref-goslingphd_5-0"" class=""reference"" style=""line-height: 1; unicode-bidi: isolate; white-space: nowrap; font-size: 11.2px;""><a href=""https://en.wikipedia.org/wiki/James_Gosling#cite_note-goslingphd-5"" style=""text-decoration-line: none; color: #0b0080; background: none;"">[5]</a></sup><sup id=""cite_ref-6"" class=""reference"" style=""line-height: 1; unicode-bidi: isolate; white-space: nowrap; font-size: 11.2px;""><a href=""https://en.wikipedia.org/wiki/James_Gosling#cite_note-6"" style=""text-decoration-line: none; color: #0b0080; background: none;"">[6]</a></sup>&nbsp;He wrote a version of&nbsp;<a href=""https://en.wikipedia.org/wiki/Emacs"" title=""Emacs"" style=""text-decoration-line: none; color: #0b0080; background: none;"">Emacs</a>&nbsp;called&nbsp;<a href=""https://en.wikipedia.org/wiki/Gosling_Emacs"" title=""Gosling Emacs"" style=""text-decoration-line: none; color: #0b0080; background: none;"">Gosling Emacs</a>(Gosmacs) while working toward his doctorate. He built a multi-processor version of Unix for a 16-way computer system<sup id=""cite_ref-7"" class=""reference"" style=""line-height: 1; unicode-bidi: isolate; white-space: nowrap; font-size: 11.2px;""><a href=""https://en.wikipedia.org/wiki/James_Gosling#cite_note-7"" style=""text-decoration-line: none; color: #0b0080; background: none;"">[7]</a></sup>&nbsp;while at Carnegie Mellon University, before joining&nbsp;<a href=""https://en.wikipedia.org/wiki/Sun_Microsystems"" title=""Sun Microsystems"" style=""text-decoration-line: none; color: #0b0080; background: none;"">Sun Microsystems</a>. He also developed several&nbsp;<a href=""https://en.wikipedia.org/wiki/Compiler"" title=""Compiler"" style=""text-decoration-line: none; color: #0b0080; background: none;"">compilers</a>&nbsp;and&nbsp;<a href=""https://en.wikipedia.org/wiki/Mail_transfer_agent"" class=""mw-redirect"" title=""Mail transfer agent"" style=""text-decoration-line: none; color: #0b0080; background: none;"">mail systems</a>&nbsp;there.</p> <p style=""margin: 0.5em 0px; line-height: inherit; color: #222222; font-family: sans-serif;"">Gosling was with Sun Microsystems between 1984 and 2010 (26 years). He is known as the father of the&nbsp;<a href=""https://en.wikipedia.org/wiki/Java_programming_language"" class=""mw-redirect"" title=""Java programming language"" style=""text-decoration-line: none; color: #0b0080; background: none;"">Java programming language</a>.<sup id=""cite_ref-LeavesSun_8-0"" class=""reference"" style=""line-height: 1; unicode-bidi: isolate; white-space: nowrap; font-size: 11.2px;""><a href=""https://en.wikipedia.org/wiki/James_Gosling#cite_note-LeavesSun-8"" style=""text-decoration-line: none; color: #0b0080; background: none;"">[8]</a></sup><sup id=""cite_ref-joinGoogle_9-0"" class=""reference"" style=""line-height: 1; unicode-bidi: isolate; white-space: nowrap; font-size: 11.2px;""><a href=""https://en.wikipedia.org/wiki/James_Gosling#cite_note-joinGoogle-9"" style=""text-decoration-line: none; color: #0b0080; background: none;"">[9]</a></sup>&nbsp;He got the idea for the&nbsp;<a href=""https://en.wikipedia.org/wiki/Java_virtual_machine"" title=""Java virtual machine"" style=""text-decoration-line: none; color: #0b0080; background: none;"">Java VM</a>&nbsp;while writing a program to port software from a&nbsp;<a href=""https://en.wikipedia.org/wiki/PERQ"" title=""PERQ"" style=""text-decoration-line: none; color: #0b0080; background: none;"">PERQ</a>&nbsp;by translating Perq Q-Code to VAX assembler and emulating the hardware. He left Sun Microsystems on April 2, 2010 after it was acquired by the&nbsp;<a href=""https://en.wikipedia.org/wiki/Oracle_Corporation"" title=""Oracle Corporation"" style=""text-decoration-line: none; color: #0b0080; background: none;"">Oracle Corporation</a>,<sup id=""cite_ref-LeavesSun_8-1"" class=""reference"" style=""line-height: 1; unicode-bidi: isolate; white-space: nowrap; font-size: 11.2px;""><a href=""https://en.wikipedia.org/wiki/James_Gosling#cite_note-LeavesSun-8"" style=""text-decoration-line: none; color: #0b0080; background: none;"">[8]</a></sup>&nbsp;citing reductions in pay, status, and decision-making ability, along with change of role and ethical challenges.<sup id=""cite_ref-10"" class=""reference"" style=""line-height: 1; unicode-bidi: isolate; white-space: nowrap; font-size: 11.2px;""><a href=""https://en.wikipedia.org/wiki/James_Gosling#cite_note-10"" style=""text-decoration-line: none; color: #0b0080; background: none;"">[10]</a></sup>&nbsp;He has since taken a very critical stance towards Oracle in interviews, noting that ""during the integration meetings between Sun and Oracle, where we were being grilled about the patent situation between Sun and Google, we could see the Oracle lawyer's eyes sparkle.""<sup id=""cite_ref-joinGoogle_9-1"" class=""reference"" style=""line-height: 1; unicode-bidi: isolate; white-space: nowrap; font-size: 11.2px;""><a href=""https://en.wikipedia.org/wiki/James_Gosling#cite_note-joinGoogle-9"" style=""text-decoration-line: none; color: #0b0080; background: none;"">[9]</a></sup>&nbsp;He clarified his position during the&nbsp;<a href=""https://en.wikipedia.org/wiki/Oracle_v_Google"" class=""mw-redirect"" title=""Oracle v Google"" style=""text-decoration-line: none; color: #0b0080; background: none;"">Oracle v Google</a>&nbsp;trial over Android: ""While I have differences with Oracle, in this case, they are on the right. Google totally slimed Sun. We were all really disturbed, even&nbsp;<a href=""https://en.wikipedia.org/wiki/Jonathan_I._Schwartz"" title=""Jonathan I. Schwartz"" style=""text-decoration-line: none; color: #0b0080; background: none;"">Jonathan Schwartz</a>; he just decided to put on a happy face and tried to turn lemons into lemonade, which annoyed a lot of folks on Sun.""<sup id=""cite_ref-11"" class=""reference"" style=""line-height: 1; unicode-bidi: isolate; white-space: nowrap; font-size: 11.2px;""><a href=""https://en.wikipedia.org/wiki/James_Gosling#cite_note-11"" style=""text-decoration-line: none; color: #0b0080; background: none;"">[11]</a></sup>&nbsp;However, he approved of the court's ruling that APIs should not be copyrightable.<sup id=""cite_ref-12"" class=""reference"" style=""line-height: 1; unicode-bidi: isolate; white-space: nowrap; font-size: 11.2px;""><a href=""https://en.wikipedia.org/wiki/James_Gosling#cite_note-12"" style=""text-decoration-line: none; color: #0b0080; background: none;"">[12]</a></sup></p> <p style=""margin: 0.5em 0px; line-height: inherit; color: #222222; font-family: sans-serif;"">In March 2011, Gosling left Oracle to work at&nbsp;<a href=""https://en.wikipedia.org/wiki/Google"" title=""Google"" style=""text-decoration-line: none; color: #0b0080; background: none;"">Google</a>.<sup id=""cite_ref-13"" class=""reference"" style=""line-height: 1; unicode-bidi: isolate; white-space: nowrap; font-size: 11.2px;""><a href=""https://en.wikipedia.org/wiki/James_Gosling#cite_note-13"" style=""text-decoration-line: none; color: #0b0080; background: none;"">[13]</a></sup>&nbsp;Six months later, he followed his colleague&nbsp;<a href=""https://en.wikipedia.org/wiki/Bill_Vass"" title=""Bill Vass"" style=""text-decoration-line: none; color: #0b0080; background: none;"">Bill Vass</a>&nbsp;and joined a startup called&nbsp;<a href=""https://en.wikipedia.org/wiki/Liquid_Robotics"" title=""Liquid Robotics"" style=""text-decoration-line: none; color: #0b0080; background: none;"">Liquid Robotics</a>.<sup id=""cite_ref-nighthacks1_1-1"" class=""reference"" style=""line-height: 1; unicode-bidi: isolate; white-space: nowrap; font-size: 11.2px;""><a href=""https://en.wikipedia.org/wiki/James_Gosling#cite_note-nighthacks1-1"" style=""text-decoration-line: none; color: #0b0080; background: none;"">[1]</a></sup>&nbsp;In late 2016, Liquid Robotics was acquired by&nbsp;<a href=""https://en.wikipedia.org/wiki/Boeing"" title=""Boeing"" style=""text-decoration-line: none; color: #0b0080; background: none;"">Boeing</a>.<sup id=""cite_ref-14"" class=""reference"" style=""line-height: 1; unicode-bidi: isolate; white-space: nowrap; font-size: 11.2px;""><a href=""https://en.wikipedia.org/wiki/James_Gosling#cite_note-14"" style=""text-decoration-line: none; color: #0b0080; background: none;"">[14]</a></sup>&nbsp;Following the acquisition, Gosling left Liquid Robotics to work at&nbsp;<a href=""https://en.wikipedia.org/wiki/Amazon_Web_Services"" title=""Amazon Web Services"" style=""text-decoration-line: none; color: #0b0080; background: none;"">Amazon Web Services</a>&nbsp;as Distinguished Engineer in May 2017.<sup id=""cite_ref-aws_15-0"" class=""reference"" style=""line-height: 1; unicode-bidi: isolate; white-space: nowrap; font-size: 11.2px;""><a href=""https://en.wikipedia.org/wiki/James_Gosling#cite_note-aws-15"" style=""text-decoration-line: none; color: #0b0080; background: none;"">[15]</a></sup></p> <p style=""margin: 0.5em 0px; line-height: inherit; color: #222222; font-family: sans-serif;"">He is an adviser at the&nbsp;<a href=""https://en.wikipedia.org/wiki/Scala_(programming_language)"" title=""Scala (programming language)"" style=""text-decoration-line: none; color: #0b0080; background: none;"">Scala</a>&nbsp;company&nbsp;<a href=""https://en.wikipedia.org/wiki/Lightbend"" title=""Lightbend"" style=""text-decoration-line: none; color: #0b0080; background: none;"">Lightbend</a>,<sup id=""cite_ref-16"" class=""reference"" style=""line-height: 1; unicode-bidi: isolate; white-space: nowrap; font-size: 11.2px;""><a href=""https://en.wikipedia.org/wiki/James_Gosling#cite_note-16"" style=""text-decoration-line: none; color: #0b0080; background: none;"">[16]</a></sup>&nbsp;Independent Director at&nbsp;<a href=""https://en.wikipedia.org/wiki/Jelastic"" title=""Jelastic"" style=""text-decoration-line: none; color: #0b0080; background: none;"">Jelastic</a>,<sup id=""cite_ref-17"" class=""reference"" style=""line-height: 1; unicode-bidi: isolate; white-space: nowrap; font-size: 11.2px;""><a href=""https://en.wikipedia.org/wiki/James_Gosling#cite_note-17"" style=""text-decoration-line: none; color: #0b0080; background: none;"">[17]</a></sup>&nbsp;and Strategic Advisor for&nbsp;<a href=""https://en.wikipedia.org/wiki/Eucalyptus_(computing)"" class=""mw-redirect"" title=""Eucalyptus (computing)"" style=""text-decoration-line: none; color: #0b0080; background: none;"">Eucalyptus</a>,<sup id=""cite_ref-18"" class=""reference"" style=""line-height: 1; unicode-bidi: isolate; white-space: nowrap; font-size: 11.2px;""><a href=""https://en.wikipedia.org/wiki/James_Gosling#cite_note-18"" style=""text-decoration-line: none; color: #0b0080; background: none;"">[18]</a></sup>&nbsp;and is a board member of DIRTT Environmental Solutions.<sup id=""cite_ref-19"" class=""reference"" style=""line-height: 1; unicode-bidi: isolate; white-space: nowrap; font-size: 11.2px;""><a href=""https://en.wikipedia.org/wiki/James_Gosling#cite_note-19"" style=""text-decoration-line: none; color: #0b0080; background: none;"">[19]</a></sup></p> <p style=""margin: 0.5em 0px; line-height: inherit; color: #222222; font-family: sans-serif;"">He is known for his love of proving ""the unknown"" and has noted that his favorite&nbsp;<a href=""https://en.wikipedia.org/wiki/Irrational_number"" title=""Irrational number"" style=""text-decoration-line: none; color: #0b0080; background: none;"">irrational number</a>&nbsp;is&nbsp;<a href=""https://en.wikipedia.org/wiki/Square_root_of_2"" title=""Square root of 2"" style=""text-decoration-line: none; color: #0b0080; background: none;""><span class=""nowrap"" style=""white-space: nowrap;"">&radic;<span style=""border-top: 1px solid; padding: 0px 0.1em;"">2</span></span></a>. He has a framed picture of the first 1,000 digits of&nbsp;<a href=""https://en.wikipedia.org/wiki/Square_root_of_2"" title=""Square root of 2"" style=""text-decoration-line: none; color: #0b0080; background: none;""><span class=""nowrap"" style=""white-space: nowrap;"">&radic;<span style=""border-top: 1px solid; padding: 0px 0.1em;"">2</span></span></a>in his office.<sup id=""cite_ref-20"" class=""reference"" style=""line-height: 1; unicode-bidi: isolate; white-space: nowrap; font-size: 11.2px;""><a href=""https://en.wikipedia.org/wiki/James_Gosling#cite_note-20"" style=""text-decoration-line: none; color: #0b0080; background: none;"">[20]</a></sup></p>";

Image img2 = new Image();
img2.File = @"C:\temp\images\surface-pro-6.JPG";


var cell1 = row.Cells.Add();

cell1.Margin = new MarginInfo(5, 5, 10, 5);

var htmlContent = new HtmlFragment(cellHTML);

cell1.Paragraphs.Add(htmlContent);
cell1.Paragraphs[0].HorizontalAlignment = HorizontalAlignment.Left;

var cell2 = row.Cells.Add();

cell2.Margin = new MarginInfo(5, 5, 5, 5); ;

cell2.Paragraphs.Add(img2);

page.Paragraphs.Add(documentTable);

try
{
    document.Save(@"c:\temp\report.pdf");
}
catch (Exception ex)
{
}

Also, it looks like, margin is not being applied. I have added a very long html to reproduce the issue.

Thanks,
Anuj

report.pdf (971.3 KB)

@anujshukla

Thank you for contacting support.

We have worked with the data shared by you and have been able to reproduce image repetition in our environment. A ticket with ID PDFNET-46262 has been logged in our issue management system for further investigation and resolution. The ticket ID has been linked with this thread so that you will receive notification as soon as the ticket is resolved.

However, we have modified the value of cell margins and noted them to be working fine. You may create SSCCE code if you still notice this problem with Aspose.PDF for .NET 19.4.

We are sorry for the inconvenience.