Quantcast
Channel: All Discussions - mPDF Forum
Viewing all 108 articles
Browse latest View live

6.0: css 'font'-attribute not properly detected

$
0
0
please have a look at:
” erwartet." class="error"><html>
<head>
<style type="text/css">
html, body, * { font: normal 10pt sans-serif;}
/* html, body, * { font-family: sans-serif}*/
</style>
</head>
<body>
Test Unicode:
#9744: <span style="font-size:12pt">&nbsp;</span>
#9746: <span style="font-size:12pt">&nbsp;</span>
</body>
</html>
include('./MPDF60/mpdf.php');
$mpdf=new mPDF('utf-8','A4' , 0, '', '20', '15', 0, 0, '5mm', '5mm');
$mpdf->WriteHTML($html);
$mpdf->Output("myDocument","I");
defining "font: normal 10pt sans-serif;" always results in serif-font "DejaVuSerifCondensed". Activating the second css-line the result is as expected.
How can i fix that?
tnx

BUG FIX: multiple nth childs not displaying.

$
0
0
<?php
$prob = '
<style>
tr:nth-child(odd) td:nth-child(2n+2){
    background: yellow;
}
</style>

<table>';

for($i=1;$i<=4;$i++){
    $prob .= '<tr>';
    for($j=1;$j<=10;$j++){
        $prob .= '<td>'.$j.'</td>';
    }
    $prob .= '</tr>';
}
$prob .= '</table>';

include_once($_SERVER['DOCUMENT_ROOT']."/mpdf60b/mpdf.php");
$mpdf=new mPDF();
$mpdf->WriteHTML($prob);
$mpdf->Output();
?>


This code will not parse the td section correctly.
This can be fixed by commenting out line 251 in the css manager.

                    $tg = preg_replace('/NTH-CHILD\(.*\)/', 'NTH-CHILD('.str_replace(' ','',$m[1]).')', $tg);


I'm not really even sure what this line is for. I can see why it is failing (the * is greedy and grabbing everything between the parenthesis), but for what purpose is it replacing the text?

Printing on custom sized paper - Minor Issues

$
0
0
I have a quirky problem that I cannot seem to get a hang on as it is inconsistent.

I have a very small piece of paper (a label) wherein I use the Header and Footer to print specific information on every page printed.

The quirk is that sometimes (not always) the Footer won't appear on the first page. Like I said, it's not consistent and I cannot find any evidence of something wrong as it works fine with other prints.

Another quirk is that sometimes the page will print over the footer instead of printing to a new page.

Any help regarding these issues would be great.

Kannada not getting in freeserif font family it shows "???" symbol

$
0
0
Im using mpdf in my project where I want to print Malyalam,tamil,Kannada,Arabic, etc When I used MPDF57 I was getting all languages but there was some mistakes in some words. Now I changed to MPDF60 now all malyalam words are correct but not getting Kannada. On browser it shows blank space but when downloads it shows "?????" symbol. font family I have used is "freeserif". I have changed it to "lohitkannada" then it gets kannada but not others. and also I have used autoScriptToLang="TRUE" even though its not getting. How can I solve this problem.

How to set DisplayMode for multiple pages

$
0
0
I am printing a display on 3 pages.
$this->mpdf = new mPDF('C', 'A4', '', '', 8, 8, 50, 5, 16, 13, 'L');
$this->mpdf->SetProtection(array('print'));
$this->mpdf->SetTopMargin('8mm');
$this->mpdf->SetDisplayMode('fullpage');

$pages  = array('1','2','3');
            $size = sizeof($pages);
            foreach ($pages as $page) {
            $this->mpdf->SetHeader($page. ' of '.$size. ' pages');
            $this->mpdf->AddPage();
            $html .= $this->load->view("template/" . $page_name, $data, true);
            $this->mpdf->WriteHTML($html);
            }
$this->mpdf->Output('Form'.pdf','I');

setDisplayMode('fullpage') only applied on the first page, how can apply this function on all pages ?

BUG FIX: div width carries over instead of resetting.

$
0
0
Example code that displays problem:
<?php
$prob = '
<div style="width:100%;" id="ONEHUNDREDWIDTH">
<div style="float:right; width:70mm; height:30mm; background:rgba(0,0,0,0.5); font-size:15pt;" id="RIGHTFLOAT">right</div>
';

$letters = ['a','b','c','d','e'];
for($i=0;$i<4;$i++){
    $prob .= '
    <div style="float:left; " id="'.$bg[$i].'">
        <div style="float:left; background:rgba(255,0,0,0.5); height:20mm; width:30%;" id="LETTER '.$letters[$i].'1">'.$letters[$i].'1</div>
        <div style="float:left; background:rgba(255,0,0,0.5); height:20mm; width:49%;" id="LETTER '.$letters[$i].'1">'.$letters[$i].'2</div>
    </div>
    ';
}
$prob .= '</div>';

include_once($_SERVER['DOCUMENT_ROOT']."/mpdf60/mpdf.php");
$mpdf=new mPDF('utf-8',[100,30], 0, 'times', 0, 0, 0, 0, 0, 0);
$mpdf->WriteHTML($prob);
$mpdf->Output();
?>


Notice how when the second set of divs appears on the page it doesn't expand to the page width?
Here's a workaround I found (it can probably be modified a bit so it only effects nested floated divs).

On line 14701 add the bit in green:
            $this->OpenTag($tag,$attr,$a,$i);    // mPDF 6
            if( $this->blk[$this->blklvl]['NewPageStart'] == 'y'){
                $i -= (count($this->blk)+1)/2;
                $this->blklvl = 0;
                $temp = $this->blk[0];
                unset($this->blk);
                $this->blk[0] = $temp;
                continue;
            };


And on line 17182 add the bit in green:
    if (isset($properties['HEIGHT'])) {
        $currblk['css_set_height'] = $this->ConvertSize($properties['HEIGHT'],($this->h - $this->tMargin - $this->bMargin),$this->FontSize,false);
        if (($currblk['css_set_height'] + $this->y) > $this->PageBreakTrigger && $this->y > $this->tMargin+5 && $currblk['css_set_height'] < ($this->h - ($this->tMargin + $this->bMargin))) {
            $currblk['NewPageStart'] = 'y';
            $this->AddPage($this->CurOrientation);
            return;            
           
        }
    }






header only first page and {nb} in text. mpdf 6.

$
0
0
Hello!

Firstly, I do not know why {nb} used only in header and footer.
How can I be, if I need to insert the number of pages in the text?

In my situation I can get away with using header, but I need only the first page. According to the document this can be done as follows: 


$html = "
<htmlpageheader name=\"MyHeader1\">
<table><tr><td>{nb}</td></tr></table>
</htmlpageheader>
    
<sethtmlpageheader name=\"MyHeader1\" value=\"on\" show-this-page=\"1\" />
";

$html = "long html...";

$mpdf->AddPage('','',1,1,'','','',90,60,'',5);                                    
$mpdf->WriteHTML($html, 2);

header on all pages...

What to do???

$mpdf->shrink_tables_to_fit = false not work

$
0
0
the document includes a large table. in some of the columns using 'rowspan'. line turns out very high, and when it does not fit on one page, instead of the transfer of the text reduces the font. the documentation should be that it is necessary to apply to the table property 'autosize="0"' or $ mpdf-> shrink_tables_to_fit = false or $ mpdf-> shrink_tables_to_fit = 0. but it does not give the desired result. the font is still decreasing. 

what to do?

gradients

$
0
0
hallo, i have an issue with css-gradients in the pdfs i create with mpdf. my script applies each time a same (generated) gradient to mulitiple divs, of which some show up as predicted (which is wonderful), but some not at all. the divs are identical, except the text. if it works yes or no per div seems rather random. wondering if anyone had similar experiences (and solved them!). thanks.

multiple backgrounds

$
0
0
hi,

i am keen to stack multiple backgrounds (images or gradients) like this: background: gradient1, gradient2, gradient3
(which creates interesting patterns in most browsers).
somehow it seems not supported by mpdf. any suggestions for a work-around?

thanks!!!!




using anchors with rtl content not working

$
0
0
Hi , I have recently switched to mpdf for creating pdfs on my website.

I am having some problems with creating anchors when I have rtl content in the pdf (hebrew charchters)

for example the following anchor works:
$mpdf = new mPDF('');
$mpdf->WriteHTML('<a href="#top">only english works</a>');
$mpdf->addPage();
$mpdf->WriteHTML('<a name="top">top</a>');
$mpdf->Output();


The foolowing examples dont work:
$mpdf = new mPDF('he');
$mpdf->WriteHTML('<a href="#top">only english works עברית</a>');
$mpdf->addPage();
$mpdf->WriteHTML('<a name="top">top</a>');
$mpdf->Output();

$mpdf = new mPDF('');
$mpdf->WriteHTML('<a href="#top">only english works עברית</a>');
$mpdf->addPage();
$mpdf->WriteHTML('<a name="top">top</a>');
$mpdf->Output();
Thanks alot.

background-repeat

$
0
0
hi,
is there in mpdf any way to repeat a linear-gradient defined as background-image?
('background-repeat' works fine, but only if the background-image is a link to an image file.)
thanks again for your help!

row height

$
0
0
Greetings.

Is there any way to calculate the height of a table cell with multiple text lines in that cell?
It might have one line of text, or three.

I want to add empty rows in that table, but if there are multiple lines, it will add another page (because of extra space from multiple lines).

Thanks

SVG background transparent not working

$
0
0
Is there anything I can do to an SVG to make it render with background transparent?

I'm using
$mpdf->Image('images/pos.svg',64.5,12.8,134.5);

It appears with a black backgound in my PDF but is fine in a web browser.
I exported the SVG from Illustrator but it has transparent b/g there as well.
(I'm not averse to editing the SVG in a text editor)

Use PDF background - automatically change template page

$
0
0
Hello,

is it possible to use a two-page-PDF as template/PDI and use page one of this PDF. AND if i have pure HTML content that flows MAYBE to a second and some more pages and use the second page of the template PDF then?

Thanks,

Christian 

Windows 10 edge

$
0
0
Has anyone come across blank page rendering when using edge browser on Windows 10? Any hacks to make it work? Or ideas where to look. I tried on mpdf6.0 and 5.7 .

Detecting auto page break based on content length and content block condition

$
0
0
Hi,
I am hoping someone can reply to this or start commenting on this with your idea for solution.
Problem that I am facing is that I am trying to generate multi page document that contains combination of images text, and block header (not just page header)
For example:
I may have page that contents several blocks of text each are it's on item and has sub items such as:
  •  block1 header (line of text)
  • text content (paragraphs)
  • images (2 or more but 2 images per row)
  • attachments (files)
  •  block2 header (line of text)
  • text content (paragraphs)
  • images (2 or more but 2 images per row)
  • attachments (files)

and so on.

What i am trying to do is that if the whole block 2 doesn't fit on the current page along with block1 I would like to move the entire block2 to new page.

And if there is a case where first page can take block1, block2 and half of block3 for example, I want to move block3 and it's internal content to next page.

So far I am not able to get that to the pdf when the final pdf is generated. I am however able to preview in html print view and they look exactly how I have setup in the html with all possible auto page break css3 tags.

Question is are all pagebreak supported in mpdf version 6 or later? Is there a way to do look ahead and check to see where in the page line we are when we want to detected the end of page?

Any feedback from core team would be appreciated. Also if Ian N Back can respond to me I would like to get in touch to see if we can resolve this. I am happy to compensate for the effort on this.

Thx

Google chart image url not loading in PDF

$
0
0
HI Iann,

I am httml which contains image tag which contains google chart image url(<img src="

[1/29/16, 11:12 AM] Pavan Kumar (pavan.k@vtiger.com):


But when I exported to PDF , it is showing cross mark in place of image in PDF.  I tried setting debug=true to get the image error and I got following image error.

mPDF error: IMAGE Error (https://chart.googleapis.com/chart?cht=p3&chd=t:60,40&chs=250x100&chl=Hello|pavan): Could not find image file

But when you use the same url in browser, we are getting the image properly.

Please help us.

Thanks,

Regards,
Pavan Kumar

Recto-Verso

$
0
0
Hi,
I need to print a recto-verso report with a table on recto an the same verso on each page.
Is there a way to do this ?

Thanks

problems once i use the progress bar

$
0
0
i have this code :
     
    define('_MPDF_URI','./classes/mpdf/');
    include_once('classes/mpdf/mpdf.php');

    $mpdf=new mPDF();
    $mpdf->SetDirectionality('rtl');
    $mpdf->autoLangToFont = true;
    $mpdf->debug = true;
   
    $mpdf->StartProgressBarOutput(1);

  
    ob_start();

    require_once("./emails/weekreport.php");


    $html = ob_get_contents();

    ob_end_clean();


    $mpdf->WriteHTML($html);

    $mpdf->Output();
    deleteFiles("/images/drealtimereport/");

if i am not using the progressbar and the _MPDF_URI part, the graphs images are being deleted, but one i use the progressbar the images are not being deleted.
any idea?
Viewing all 108 articles
Browse latest View live