Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

printing lines in PDF qt



  • Hi,

    I am trying to print lines in pdf document, but unable to do it.

    How to print lines in PDF document? please help me.



  • @dan1973
    What does "print lines" in a PDF document mean?



  • I want to draw lines of a Table. I can write text inside the custom created table inside PDF. but drawLine of QPainter is not working. here is my sample code:

    QPdfWriter writer(filename);
        writer.setPageSize(QPagedPaintDevice::A4);
        writer.setPageMargins(QMargins(30, 30, 30, 30));
    
        QPainter painter(&writer);
        painter.setPen(Qt::black);
        painter.setFont(QFont("Times", 10));
    
        QRect r = painter.viewport();
        QString citydate = "City, ";
        citydate += currDate();
        painter.drawText(r, Qt::AlignRight, citydate);
    
        QString sender = "COMPANY XYZ\n";
        sender += "Random Street 12/314A\n";
        sender += "123-1232 City\n";
    
        painter.drawText(r, Qt::AlignLeft, sender);
    
        painter.drawLine(20, 20, 100, 100);
    
        painter.end();
    

    I Want to have like:

    |
    |
    |

    without gaps.....straight lines... both Horizontal and Vertical lines



  • This post is deleted!

Log in to reply