Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QtWebEngine
  4. QWebEnginePage::printToPdf output differs from Chrome
Forum Updated to NodeBB v4.3 + New Features

QWebEnginePage::printToPdf output differs from Chrome

Scheduled Pinned Locked Moved Solved QtWebEngine
4 Posts 3 Posters 780 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.
  • T Offline
    T Offline
    Tarae
    wrote on last edited by
    #1

    My simple html file:

    <!DOCTYPE html> <html>
    <body>
    <h1 style="font-size: 100px">This is a Heading</h1> 
    </body>
    </html>
    

    When I print it to pdf in Chrome (Margins: None, Scale: Default), text fits to one line. In chromium it's same.
    But printing it using QWebEnginePage::printToPdf with layout = QPageLayout(QPageSize(QPageSize::A4), QPageLayout::Portrait, QMarginsF(0,0,0,0)); produces pdf file containing two lines. Text is bigger. Why?
    How can I make it print same file as Chrome? Or how can I make Chrome print same file as QWebEnginePage::printToPdf?

    You can check pdf files on drive: https://drive.google.com/drive/folders/1-NQJGwLL9M--q7tURUdTrFXHcikR8j2C?usp=sharing

    jsulmJ JonBJ 2 Replies Last reply
    0
    • T Tarae

      My simple html file:

      <!DOCTYPE html> <html>
      <body>
      <h1 style="font-size: 100px">This is a Heading</h1> 
      </body>
      </html>
      

      When I print it to pdf in Chrome (Margins: None, Scale: Default), text fits to one line. In chromium it's same.
      But printing it using QWebEnginePage::printToPdf with layout = QPageLayout(QPageSize(QPageSize::A4), QPageLayout::Portrait, QMarginsF(0,0,0,0)); produces pdf file containing two lines. Text is bigger. Why?
      How can I make it print same file as Chrome? Or how can I make Chrome print same file as QWebEnginePage::printToPdf?

      You can check pdf files on drive: https://drive.google.com/drive/folders/1-NQJGwLL9M--q7tURUdTrFXHcikR8j2C?usp=sharing

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Tarae I guess you need to reduce font size?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • T Tarae

        My simple html file:

        <!DOCTYPE html> <html>
        <body>
        <h1 style="font-size: 100px">This is a Heading</h1> 
        </body>
        </html>
        

        When I print it to pdf in Chrome (Margins: None, Scale: Default), text fits to one line. In chromium it's same.
        But printing it using QWebEnginePage::printToPdf with layout = QPageLayout(QPageSize(QPageSize::A4), QPageLayout::Portrait, QMarginsF(0,0,0,0)); produces pdf file containing two lines. Text is bigger. Why?
        How can I make it print same file as Chrome? Or how can I make Chrome print same file as QWebEnginePage::printToPdf?

        You can check pdf files on drive: https://drive.google.com/drive/folders/1-NQJGwLL9M--q7tURUdTrFXHcikR8j2C?usp=sharing

        JonBJ Online
        JonBJ Online
        JonB
        wrote on last edited by
        #3

        @Tarae
        You could print each of them to file and then have a look at the PDF, e.g. the font sizes, to see if you can see how they differ and what you might do about it?

        1 Reply Last reply
        0
        • T Offline
          T Offline
          Tarae
          wrote on last edited by
          #4

          @jsulm @JonB thanks for your advice. Problem wasn't font size. But I look at files using pdffonts a there was a problem. Chrome uses fonts set in chrome://settings/fonts but QWebEngine uses different fonts.

          1 Reply Last reply
          2

          • Login

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