Adjust line breaks to fit information on one page

Line breaks appear automatically once a row with content will not fit on the page. If you're using custom options, line breaks will automatically try to give custom options more space by putting them in a separate row, which can lead to them being on a separate page. To adjust this behaviour and prevent splitting over two pages:

1. Copy the following file to your own theme (update to the latest version of Fooman Pdf Customiser if you don't have this file): 

/app/design/frontend/base/default/template/fooman/pdfcustomiser/item.phtml 

2. Edit the file and move the line 

            <?php $options = $pdfItem['productDetails']['Options'] ?>            
            <?php if ($options) : ?>
                <?php if (isset($options['options'])) : ?>
                    <?php foreach ($options['options'] as $option) : ?>
                        <?php if ($option['label'] == 'Detail') : ?>
                            <?php foreach (explode("\n", $option['value']) as $detailLines) : ?>
                                <?php echo '<br/>  ' . $this->getPdfHelper()->fixEncoding($detailLines) ?>
                            <?php endforeach; ?> 
                        <?php else : ?>
                            <?php //Aitoc Custom Product Options adds a whole bunch of JS ?>     
                            <?php //filter it out here ?>            
                            <?php if (strpos($option['value'], 'Aitcg.Main') === false) : ?>        
                                <?php $printValue = isset($option['print_value']) ? $option['print_value'] : $option['value'] ?>
                                <?php echo '<br/>  ' . $this->getPdfHelper()->fixEncoding($option['label'] . ': ' . $printValue) ?>
                            <?php endif; ?>
                        <?php endif; ?>
                    <?php endforeach; ?>    
                    <?php echo '<br/>' ?>
                <?php endif; ?>
                <?php if (isset($options['additional_options'])) : ?>
                    <?php foreach ($options['additional_options'] as $additionalOption) : ?>
                        <?php echo '<br/>  ' . $this->getPdfHelper()->fixEncoding(
                                    $additionalOption['label'] . ': ' . $additionalOption['value']) ?>
                    <?php endforeach; ?>        
                    <?php echo '<br/>' ?>  
                <?php endif; ?>
                <?php if (isset($options['attributes_info'])) : ?>
                    <?php foreach ($options['attributes_info'] as $attribute) : ?>
                        <?php echo '<br/>  ' . $this->getPdfHelper()->fixEncoding(
                                    $attribute['label'] . ': ' . $attribute['value']) ?> 
                    <?php endforeach; ?>  
                <?php endif; ?>
            <?php endif; ?>
            <?php if(!empty($pdfItem['productDetails']['Subitems'])):?>
                <?php foreach ($pdfItem['productDetails']['Subitems'] as $subitem) :?>
                    <br/>    <?php echo $subitem['qty']?> x <?php echo $subitem['Name']?>
                <?php endforeach;?>
            <?php endif;?>

to the code block below (before </td>)

        case 'name':
            ?>
            <td style="<?php echo $style ?>" align="<?php echo  $column['align'] ?>"
                width="<?php echo $column['width'] ?>%"><?php echo $vertSpacing
                    . $pdfItem['productDetails']['Name']
                    . ($isNotLast ? '' : $vertSpacing) ?><br/></td>
            <?php break;

Still need help? Contact Us Contact Us