Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-86094

Generating large pdf files when using pen with zero width

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2: Important
    • Resolution: Done
    • Affects Version/s: 5.12.9
    • Fix Version/s: 5.15.7, 6.2.1, 6.3.0 Alpha
    • Component/s: PDF
    • Labels:
      None
    • Platform/s:
      Windows
    • Commits:
      6d41b64d45cda12370653300fdc2d2685c450014 (qt/qtbase/dev) 7befef2588be12137b7b82b2b82954b637c0fbef (qt/qtbase/6.2) c93c8e84a1aae1ef5762047fb1f3f84af8166b2c (qt/tqtc-qtbase/5.15)

      Description

      When Qt exports pdf with pen of zero width, the output file will be very large.
      QPen (QBrush(Qt::black), 0, Qt::DashLine) file size: 1504k
      QPen (QBrush(Qt::black), 1, Qt::DashLine) file size: 6k

      QPdfWriter *writer = new QPdfWriter("c:/a.pdf");
      
      QPainter *painter = new QPainter(writer);
      
      QPen pen(QBrush(Qt::black), 0, Qt::DashLine);
      
      painter->setPen(pen);
      
      for (int i = 0; i < 1000; i++) 
      { 
           painter->drawLine(100, i, 500, i); 
      }
      
      delete painter;
      
      delete writer;
      

        Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            vgt Eirik Aavitsland
            Reporter:
            piggestbaby lei chen
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: