boxable
boxable copied to clipboard
> is replaced with > in the Inner Table with boxable
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-">"Schubert-">"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 > - still it prints > 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
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("&", "&").replace(">", ">").replace("<", "<"));
} else {
Cell<T> cell = (Cell<T>) row.createCell(tableWidth / columnsSize / row.getWidth() * 100,
col.html().replace("&", "&").replace(">", ">").replace("<", "<"));
}
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
I have no rights to merge them. A pull request is still open #224
Ok. Any idea how can I access this fix in my application? I am using "dhorions/boxable" library.
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.
Note that <sometext> is interpreted as HTML tag. Furthermore, the character "-" is also a character for the line break within a cell.