Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

> is replaced with > in the Inner Table with boxable #216

Open
mailidpankaj opened this issue Nov 19, 2020 · 6 comments
Open

> is replaced with > in the Inner Table with boxable #216

mailidpankaj opened this issue Nov 19, 2020 · 6 comments
Milestone

Comments

@mailidpankaj
Copy link

mailidpankaj commented Nov 19, 2020

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:

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

CSchemmy added a commit to CSchemmy/boxable that referenced this issue Jan 26, 2021
@CSchemmy
Copy link
Contributor

CSchemmy commented Jan 26, 2021

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 added a commit to CSchemmy/boxable that referenced this issue Jan 26, 2021
CSchemmy added a commit to CSchemmy/boxable that referenced this issue Jan 26, 2021
CSchemmy added a commit to CSchemmy/boxable that referenced this issue Jan 26, 2021
CSchemmy added a commit to CSchemmy/boxable that referenced this issue Jan 29, 2021
@mailidpankaj
Copy link
Author

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

@CSchemmy
Copy link
Contributor

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

@mailidpankaj
Copy link
Author

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

@CSchemmy
Copy link
Contributor

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
Copy link
Contributor

CSchemmy commented Feb 17, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants