in classes/api/base.php [1292:1358]
protected function process_tags($dom, $xpath) {
// List of tags we are processing.
$tags = array('h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'td');
// Font sizes for each tag.
$tagfontsizes = array('h1' => '24px', 'h2' => '22px', 'h3' => '18px',
'h4' => '16px', 'h5' => '12px', 'h6' => '10px' , 'td' => '10.5pt');
// Process each tag.
foreach ($tags as $tag) {
$nodes = $xpath->query('//'.$tag);
if ($nodes->length) {
$nodesarray = array();
foreach ($nodes as $tagnode) {
$nodesarray[] = $tagnode;
}
foreach ($nodesarray as $node) {
$childnodes = $node->childNodes;
$childnodesarray = array();
foreach ($childnodes as $child) {
$childnodesarray[] = $child;
}
foreach ($childnodesarray as $childnode) {
if (in_array($childnode->nodeName, array('#text', 'b', 'a', 'i', 'span', 'em', 'strong'))) {
$spannode = $dom->createElement('span');
$style = "font-family:'Helvetica',Arial,sans-serif;";
$style .= "font-size:". $tagfontsizes[$tag] ."; color:rgb(51,51,51);";
$spannode->setAttribute("style", $style);
$spannode->appendChild($node->removeChild($childnode));
$node->insertBefore($spannode);
} else {
$node->insertBefore($node->removeChild($childnode));
}
}
}
}
}
// Get all tables.
$tables = $xpath->query('//table');
if ($tables) {
foreach ($tables as $table) {
// Check if table have border attribute set.
$border = $table->getAttribute('border');
// If not, set default border of table.
if ($border == '') {
$table->setAttribute("border", "2");
}
}
}
}