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

How can I prevent the width overflowing? #545

Open
diegodyd opened this issue Feb 17, 2020 · 3 comments
Open

How can I prevent the width overflowing? #545

diegodyd opened this issue Feb 17, 2020 · 3 comments

Comments

@diegodyd
Copy link

@diegodyd diegodyd commented Feb 17, 2020

I use this tool to print differents reports on my system. Those are with dynamic content obviouslly, so I can't set a fixed width per table column. I tried setting a width as style on the table and didn't helped, tried setting a parent div over the table with fixed witdh and either worked. The problem happens when a column content is too large, the ideal solution is resolving it with linebreak, i dont care the height, but I need the width to fit

This is the report on the system.
report

This is the report on pdf.
pdf

@mateusznitka

This comment has been minimized.

Copy link

@mateusznitka mateusznitka commented Feb 20, 2020

Hi,
I have a same problem. Html2Pdf is very useful library and I using it in my GLPI plugin, but there is no word-break or table width support which makes this overflowing problems. This issue was reported few times but unfortunately rejected. @spipu please consider implement word-breaking again.
Regards,
Mateusz

@Urc0m

This comment has been minimized.

Copy link

@Urc0m Urc0m commented Mar 1, 2020

Hi Mateusnitka. On your code you can implement a some word wrapping function simple like this

function strWrap(&$cadena, $intLong = 50){
	$intLen					= 0;
	$cadIzq					= "";
	$intLen 				= strlen($cadena) - 1;
	$cadIzq					= "";
	$j							= 0;
	for ($i=0; $i<=$intLen; $i++){
		$j							= $j + 1;
		$cadIzq					= $cadIzq . $cadena[$i];
		if(($cadena[$i] == " " or $cadena[$i] == "." or $cadena[$i] == ",") and $j >= $intLong) {
			$cadIzq					= $cadIzq . "<br />";
			$j							= 0;
		}
	}
	$cadena					= $cadIzq;
}

And call on your php like this

			$strContenidoCampo = $ArrHdr002['lsver_value'];
			strWrap($strContenidoCampo, 30);

I hope this can solve your issue.

@mateusznitka

This comment has been minimized.

Copy link

@mateusznitka mateusznitka commented Mar 3, 2020

@Urc0m thanks for reply.
I will check your solution soon.

Regards,
Mateusz

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

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.