Jump to content

Printing problem and PDF


Studio381

Recommended Posts

I've got an application that prints out to a file in PDF fomat.

The PDF routine I'm using truncates the input strings if they are over approx 100 characters.

So I wanted to check the input strings (length unknown) and split them before calling the PDF routine.

I'd thought of something like...

 

$workingstring = $_POST[inputstring];

while (strlen($workingstring)>90

{$printstring=substr($workingstring(0,90);

$pdf->Cell(0,10,$printstring,0,1);

$workingstring=substr_replace($workingstring,"",0,90);

}

$pdf->Cell(0,10,$workingstring,0,1);

 

This (assuming it works, I haven't tried it yet) has the drawback that it splits the string after 90 characters which could be in the middle of a word and I'd much rather split the string after eg 85 or 94 characters to avoid splitting words.

 

Can anyone show me a better way to do this?

 

Thanks,

John.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.