How to make border not "thin" in PHPWord to prevent behaviours of "Enhance thin line" setting in Adobe Reader

104 Views Asked by At

First you have to understand the flow :

 PHPWord -> document.docx -> Microsoft Word -> document.pdf -> Adobe Reader

I create some tables in a .docx document with PHPWord :

private const CS_BORDER = 
[
    'borderSize' => 7, 
    'borderColor' => '000000',
];

$table = $section->addTable();
$row = $table->addRow();
$cell = $row->addCell(Font::centimeterSizeToTwips(5.3), self::CS_BORDER);
$cell->addText('Text', self::FS_CALIBRI_10_BOLD, self::PS_CENTER_ALIGN_NO_SPACE);
$cell = $row->addCell(Font::centimeterSizeToTwips(2.2), self::CS_BORDER);
$cell->addText('Text', self::FS_CALIBRI_10_BOLD, self::PS_CENTER_ALIGN_NO_SPACE);
$cell = $row->addCell(Font::centimeterSizeToTwips(2.4), self::CS_BORDER);
$cell->addText('Text', self::FS_CALIBRI_10_BOLD, self::PS_CENTER_ALIGN_NO_SPACE);

Then I manually export .docx to .pdf using Microsoft Word and opening it with Adobe Reader.

Like a lot of peoples I get render issues because of "Enhance thin line" setting in Adobe Reader.

The point is : lines are optimized even if I use following code :

private const CS_BORDER = 
[
    'borderSize' => 50, 
    'borderColor' => '000000',
];

My question is : Is there something to do in PHPWord to make Adobe Reader don't treats borders as thin line ?

1

There are 1 best solutions below

0
John Korchok On

In my experience, the way to prevent Acrobat or Reader from its excessive bolding of rectangles is to insert additional anchor points on all straight lines of the shape. I do this in Adobe Illustrator, then export to EMF for use in Word. You'll have to investigate whether phpword can edit vectors at that level of detail.