Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. printing lines in PDF qt
Forum Updated to NodeBB v4.3 + New Features

printing lines in PDF qt

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 369 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    dan1973
    wrote on last edited by
    #1

    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.

    JonBJ 1 Reply Last reply
    0
    • D dan1973

      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.

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

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

      D 1 Reply Last reply
      0
      • D Offline
        D Offline
        dan1973
        wrote on last edited by dan1973
        #3

        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

        1 Reply Last reply
        0
        • JonBJ JonB

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

          D Offline
          D Offline
          dan1973
          wrote on last edited by dan1973
          #4
          This post is deleted!
          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved