Prevent page break inside a div

  • Hi , i have used this code for printing a text in pdf file :

    QString pdf = "<div>...</div><div>...</div>....";
    QTextDocument doc;
        doc.setHtml( pdf );
        QPrinter printer;
        printer.setOutputFileName( FileName );

    Actually I have some divs and i don't want to pdf creator break pages inside of each of them . I tried " @media print { div { page-break-inside:avoid; } } " but it does not work. How can I do it ?

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.