Comments (2)
I have this block that creates a set of TCPDF MultiCell()
s in a multicolumn pdf.
$TColW0 = 29;
$DColW0 = 37;
$mbh = $pdf->getStringHeight($DColW0, $reqHeader['partPackingInfo'], false, true, '', 1);
$pdf->MultiCell($TColW0, $mbh, 'Packaging Details:', 1, 'R', '', 0, '', '', true, 0, false, false, '', 'M', false);
$pdf->MultiCell($DColW0, $mbh, $reqHeader['partPackingInfo'], 1, 'L', '', 1, '', '', true, 0, false, false, '', 'M', false);
- The first line uses TCPDF's native function to get the height of the multi line string and sets the
$mbh
variable to later set both cells to the same height. - The
$DColW0
and$TColW0
variables are predetermined and set column widths.
My problem is the result looks like this,
I tried using the title column's width in the x
value of the data cell, but that just shifts the content out of the column.
The content looks to be in the right place the border for the data cell is just drawn in the wrong spot. Is there a setting or something I'm missing when it comes to MultiCell()
borders? Any help/suggestions much appreciated.
Updating the block to make use of SetX
$TColW0 = 29;
$DColW0 = 37;
$mbh = $pdf->getStringHeight($DColW0, $reqHeader['partPackingInfo'], false, true, '', 1);
$pdf->MultiCell($TColW0, $mbh, 'Packaging Details:', 1, 'R', '', 0, '', '', true, 0, false, false, '', 'M', false);
$pdf->SetX($TColW0);
$pdf->MultiCell($DColW0, $mbh, $reqHeader['partPackingInfo'], 1, 'L', '', 1, '', '', true, 0, false, false, '', 'M', false);
Shifts the content independent of where the border is drawn.
Using the x specification inside of MultiCell()
$TColW0 = 29;
$DColW0 = 37;
$mbh = $pdf->getStringHeight($DColW0, $reqHeader['partPackingInfo'], false, true, '', 1);
$pdf->MultiCell($TColW0, $mbh, 'Packaging Details:', 1, 'R', '', 0, '', '', true, 0, false, false, '', 'M', false);
$pdf->MultiCell($DColW0, $mbh, $reqHeader['partPackingInfo'], 1, 'L', '', 1, $TColW0, '', true, 0, false, false, '', 'M', false);
Again content shifts, border is drawn over previous cell.
Result with cell fill turned on.
$TColW0 = 29;
$DColW0 = 37;
$mbh = $pdf->getStringHeight($DColW0, $reqHeader['partPackingInfo'], false, true, '', 1);
$pdf->MultiCell($TColW0, $mbh, 'Packaging Details:', 1, 'R', 1, 0, '', '', true, 0, false, false, '', 'M', false);
$pdf->MultiCell($DColW0, $mbh, $reqHeader['partPackingInfo'], 1, 'L', 1, 1, '', '', true, 0, false, false, '', 'M', false);
Turning fill on paints over all previously drawn borders for that row with the exception of the border for the last cell. The content of both cells is still in the expected position, the border is drawn to the expected size, but is drawn in the wrong position.
from tc-lib-pdf.
Please report this to:
https://github.com/tecnickcom/TCPDF/issues
from tc-lib-pdf.
Related Issues (20)
- Implicit conversion from float HOT 1
- signDocument() / Fix the $pdfDoc variable to have duplicates appended to the content. HOT 1
- support of emoji HOT 1
- how can i install tc-lib-pdf by offline HOT 2
- Is it support PDF/A-3 HOT 2
- Support for multiple digital signature HOT 3
- how do I retrieve a list of all available fonts? HOT 1
- tcpdf cyrillic letters displayed as question marks "?" HOT 1
- External images with presigned url from amazon s3 service fail to load.
- External images with presigned url from amazon s3 service fail to load. HOT 1
- the project is not usable : Missing at least 2 properties HOT 2
- There is no documentations for this project , the exist one is old HOT 1
- Two signatures in the same PDF HOT 5
- Simple text example HOT 2
- How do I add text to a document? HOT 3
- Integration with Fpdi HOT 1
- Text support HOT 2
- This PDF document probably uses a compression technique HOT 1
- Datamatrix Barcode wrong on some texts HOT 1
- Documentation lag HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tc-lib-pdf.