Problem: First line with extra indents/blanks when pdf file generated by TCPDF lib using print module
Environments: print 6.x-1.18, TCPDF 6_0_038, drupal 6.22

Use case:
I have a node with html like these below:

<div class="print-content">
    
  <div id="node-61" class="node clear-block">

  <div class="content">
  
  <div class="item-info">
  
  <div class="code">Code: 05416.4048.0004</div>
  <div class="barcode">Barcode: </div>
  <div class="description">Description: dan xiang fa</div>
  <div class="supplier">Supplier: Item supplier</div>
  <div class="supp-code">Supplier Code: </div>
  <div class="buy-price">Buy Price: 0.00</div>
  <div class="rrp-price">RRP Price: 0.00</div>
  <div class="our-price">Sell Price: 2019.60</div>
  <div class="active">Active</div>
  
  </div>
  </div>
  </div>
  </div>

After theming by function theme_print_pdf_tcpdf_content from print_pdf, the output html changed as:

<span class="print-content">
<span id="node-61" class="node clear-block">
<span class="content">
<span class="item-info">

<span class="code">Code: 05416.4048.0004</span><br />
<span class="barcode">Barcode: </span><br />
<span class="description">Description: dan xiang fa</span><br />
<span class="supplier">Supplier: Item Supplier</span><br />
<span class="supp-code">Supplier Code: </span><br />
<span class="buy-price">Buy Price: 0.00</span><br />
<span class="rrp-price">RRP Price: 0.00</span><br />
<span class="our-price">Sell Price: 2019.60</span><br />
<span class="active">Active</span>  

</span><br />
</span><br />
</span><br />
</span><br />

Then the output pdf file will has extra indents: see attached figure.

I found the clue from file print_pdf.pages.inc in function theme_print_pdf_tcpdf_content from print_pdf at line 580:

$matches[1] = str_replace(array('<div', 'div>'), array('<span', 'span><br />'), $matches[1]); 

Where the div tags will be replaced by span, but why span tag will cause the problem?

BTW, I had tested both the div and the span separately with TCPDF directly, the html with div has no problem, but the span has the problem.

CommentFileSizeAuthor
#3 tcpdf-div.png10.37 KBWeijian
#1 tcpdf-issue.png9.45 KBWeijian
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Weijian’s picture

FileSize
9.45 KB
jcnventura’s picture

How does it look without that line, can you send a screenshot?

It used to add a lot of space around the divs, which looked frankly ugly. But that was about 4 years ago, and way too many versions of TCPDF...

Weijian’s picture

FileSize
10.37 KB

Thanks jcnventura very much for your quick response. See the enclosed tcpdf-div.png.

Weijian’s picture

Issue summary: View changes

attach figure

jcnventura’s picture

Status: Active » Closed (works as designed)

Closing the issue, as it is for the Drupal 6 version of the module.