boxable icon indicating copy to clipboard operation
boxable copied to clipboard

> is replaced with > in the Inner Table with boxable

Open mailidpankaj opened this issue 5 years ago • 6 comments
trafficstars

Hi,

I am trying to write below string in the Inner Table using the boxable library with PDFBox to write to PDF:

Composers->Schubert->String

but, the it gets printed in PDF as below:

Composers-"&gt"Schubert-"&gt"String

I investigated on the HTML tags and found that we can use Entity Numbers in place of > sign, I tried below values:

  • replaced > with &#62 - still it prints &gt in the PDF

where when I replace > with ? or @ , I can see the special characters like @ and ? gets printed in the PDF.

Hence, only in case of > nothing changes and > doesn't get printed in PDF.

Looks like there is a limitation with boxable inner table API createTableCell().

Please let me know how can I print the ">" character in the inner table.

Regards, Pankaj

mailidpankaj avatar Nov 19 '20 06:11 mailidpankaj

I have found the problem. The Problem can be solved at code TableCell at line 173 and 176.

				if (col.attr("colspan") != null && !col.attr("colspan").isEmpty()) {
					Cell<T> cell = (Cell<T>) row.createCell(
							tableWidth / columnsSize * Integer.parseInt(col.attr("colspan")) / row.getWidth() * 100,
							col.html().replace("&amp;", "&").replace("&gt;", ">").replace("&lt;", "<"));
				} else {
					Cell<T> cell = (Cell<T>) row.createCell(tableWidth / columnsSize / row.getWidth() * 100,
							col.html().replace("&amp;", "&").replace("&gt;", ">").replace("&lt;", "<"));
				}

CSchemmy avatar Jan 26 '21 18:01 CSchemmy

Hi,

Thanks for fixing this issue. I need to access this fix. Did you merge the fix to "dhorions/boxable" ?

I checked the TableCell.java file and couldn't find the fix. Please let me know how can I access the fix? Which version of boxable library do I need to get this fix?

Regards, Pankaj

mailidpankaj avatar Feb 17 '21 10:02 mailidpankaj

I have no rights to merge them. A pull request is still open #224

CSchemmy avatar Feb 17 '21 12:02 CSchemmy

Ok. Any idea how can I access this fix in my application? I am using "dhorions/boxable" library.

mailidpankaj avatar Feb 17 '21 13:02 mailidpankaj

Yes, you need to pull a private copy and change the version. This can be done with the following script

git clone https://github.com/dhorions/boxable.git
cd boxable/
mvn build-helper:parse-version versions:set -DnewVersion=boxable-1.6-my-SNAPSHOT versions:commit
mvn clean install -Dgpg.skip=true

Then you can change the version in your project from boxable-1.6 to boxable-1.6-my-SNAPSHOT. Take a name with the extension SNAPSHOT so you can build the library multiple times.

After you have implemented the changes from the pull request #224 you have to rebuild the library.

mvn clean install -Dgpg.skip=true

Then you can test your project.

If pull request #224 is merged you can go back to the merged version from the library.

CSchemmy avatar Feb 17 '21 21:02 CSchemmy

Note that <sometext> is interpreted as HTML tag. Furthermore, the character "-" is also a character for the line break within a cell.

CSchemmy avatar Feb 17 '21 21:02 CSchemmy