Prevent page break in text block with iText, XMLWorker - itext

I have a text block in a <div> or <p> which I want not to have a page break within. If the text block does not fit on the current page then I want it on a new page. How can I setup XMLWorker to prevent page breaks within certain tags?

As of version 5.5.7 the XMLWorker in iText supports page-break-inside: avoid; See Changelog
Update 2023-01-17: iText 5 is now legacy software and has been superseeded by iText 7. I don't know if version 7 works like 4. An archoved version of the changelog has been archived.

Related

Fancybox issues after installation

I'm using Fancybox v4 and have setup the css and js according to installation guide, but still my image opens as if no Fancybox is present.
I'm no wiz on these things, so I hope someone can help me out :-)
The site I'm working on is locates at https://new.bigbox8700.dk/
It's the image in the "PRAKTISK INFORMATION" section.
Regards
Thomas
After some debugging I found out that your JavaScript file js-18a51-27218.js contains Mootools v1.4.5 (released 10 years ago!) and, unfortunately, Mootools changes global objects and that breaks Fancybox. It's amazing that you're using 10-year-old Mootools and 6-year-old jQuery at the same time on the new project.
Since MooTools is causing this problem and has not been updated for 6 years, it is recommended that you remove it.

Generate PDF with pie chart -iText7

The obvious primary reason for using iText being , our company already have a license.
Requirement:
Generate a report that includes pie chart.
Our UX gave us a HTML, And I'm using html2pdf plugin to generate pdf.
We're using tlx-chart for its simplest code.
Issue:
PDF doesn't render/show piechart. No errors seen in logs.
HTML is being created perfectly (Althought iText conversion seems to be not so good), and When I load it with chromedriver as provided in KB article below, it renders overlapped 2 piecharts instead of 1.
So, This knowledgebase article from iText doesn't help.
Infact, I've thought I cannot keep on updating chromedriver,selenium on prod server.
I've to provide a loosely coupled (OS>PDF>PIE) to generate PDF.
Code Snippet:
HtmlConverter.convertToPdf(reportHtml, pdfWriter, new ConverterProperties());
"<tlx-chart id=\"mychart\" chart-type=\"PieChart\" chart-editable=\"true\" chart-columns=\"${['Element','Percentage']}\" chart-data=\"${${pieData}}\" </tlx-chart>"
Please Help!
So the issue is to embed piechart in PDF since JavaScript tags were not being rendered by iText library. And I resolved this in my case using jFreeChart.
Generate an image using jFreechart and embed that image in HTML
iText perfectly renders this as per HTML CSS
For detailed explanation and code snippet on this please visit here
An alternative way is also documented here

TinyMCE 4 Issues on IE 11

I have recently updated some admin systems on websites to use TinyMCE 4, using the JS version.
I have just discovered a bug that only occurs in IE11, which is the following:
When a Textarea loads it contains the posted html data, but then after the split second it takes for TinyMCE to trigger, all the content within the Textarea is hidden - and TinyMCE is just empty.
It seems to work on all other browsers, including other versions of Internet Explorer. Has anyone else had this issue and know of a solution?
Cheers
We've fixed this bug since then. Updating to the latest version should fix this.

HTML comment tag <!-- --> Removed in CQ5

I'm using Rich Text Editor with MiscTools plugin to edit text in CQ%
However when I open the HTML editor and create sth like this
<div id="test">Test <!-- Test Comment --></div>
the CQ rewrites it to after switch back to HTML mode and source edit mode
<div id="test">Test </div>
Is it possible to keep HTML comment tag <!-- --> in the source code?
Thank you for answer my question
I would suggest taking it out of the div and see if that works.
In CQ5.4-5.6.1 (not sure about latest version AEM6), the Rich Text Editor intentionally strips out all HTML comments. The only way to stop it from doing this is to modify the product javascript source code in WhitespaceProcessor.js. However, allowing HTML comments in this way wouldn't be recommended as it hasn't been fully tested it might cause other errors. If you still need this feature, then you might consider contacting Adobe Customer Care to request it to be officially added to the product.

new PloneFormGen Form Folder has Plain Text Format for Prologue and Epilogue

When I create a new PFG Form Folder, the Prologue and Epilogue textareas come up with a default Text Format = Plain Text. Is this intended?
If the user's default text editor is TinyMCE (both in /personalize_form and in portal_memberdata wysiwyg_editor), I would expect the Prologue and Epilogue to behave the same as a new Page content type, which comes up with TinyMCE.
When I look at Products.PloneFormGen-1.5.5 in content/form.py, the TextField('formPrologue') has a default_content_type = zconf.ATDocument.default_content_type, so it would seem that it would behave the same way as a normal Document content type.
Thanks!
This is a known issue due to a bad interaction between a bug in Archetypes and some changes to how the mimetype is determined in recent releases of TinyMCE. If you're on Plone 4 you can upgrade to Products.Archetypes 1.6.6 or later to fix it (this Archetypes release is included in the latest Plone release, 4.0.5).