Hello,
I am having an issue with ensuring that paragraphs do not split across PDF pages. I attach a screenshot of the rendering. The section with the header I need to be able to detect if it will cross from one page to the next, and take appropriate action.
My code:
…
var documentSection = new Section(pdf);
documentSection.FirstPageInfo = new PageSetup(documentSection);
foreach (var paragraph in metadata.Paragraphs)
{
if (paragraph.PageBreak == PageBreak.Before)
{
documentSection.Paragraphs.Add(new Text(CPAGEBREAK));
}
var documentTextReader = new StringReader(paragraph.Content);
var documentText = new Text(documentTextReader.ReadToEnd());
documentTextReader.Close();
documentTextReader.Dispose();
documentText.IsHtmlTagSupported = true;
documentText.IsKeptTogether = true;
documentSection.Paragraphs.Add(documentText);
if (paragraph.PageBreak == PageBreak.After)
{
documentSection.Paragraphs.Add(new Text(CPAGEBREAK));
}
}
pdf.Sections.Add(documentSection);
…
I am using v6.3.0.0. I wonder of anyone has had a similar issue?
Best regards
Iain
Do you have the same behavior when setting IsHtmlTagSupported = false? It would isolate the issue. I have logged a problem with the performance with HTML (Performance issue when building PDF with HTML tags) and another with the fact that the underline does not always work with HTML (https://forum.aspose.com/t/85298&Subj=html-underline-does-not-work-when-wrapping-italic-tag-lt-u-gt-lt-i-gt-.lt-i-gt-lt-u-gt).
Hi Lain,
jeanfrancoisrouleau:Do you have the same behavior when setting IsHtmlTagSupported = false? It would isolate the issue. I have logged a problem with the performance with HTML (Performance issue when building PDF with HTML tags) and another with the fact that the underline does not always work with HTML (https://forum.aspose.com/t/85298&Subj=html-underline-does-not-work-when-wrapping-italic-tag-lt-u-gt-lt-i-gt-.lt-i-gt-lt-u-gt).
Hello,
I have added an image to post 472466. I have also attached the html (htmlSection.txt).
The issue is that I am adding a paragraph in code (as per the post), and there appears not to be a way of determining when a paragraph will split over 2 pages, in this case page 1 of 19 and page 2 of 19.
This seems like it would be a common problem. Is there a solution to this issue, either in code or via e.g. manipulation of the PDF in code?
Best regards
Iain
Hello Nayyer,
Do you have a response to post : 473073
if possible? I have added the information you requested.
Best regards
Iain
Hi Iain,
Hello,
Has there been progress on this issue (PDFNEWNET-35450)?
Best regards
Iain
Hi Iian,
Hello,
Is there any progress on this ticket?
Best regards
Iain
Hi Lian,
Hi Lian,