c++ - QPrinter resolution is wrong in Linux -
I'm trying to get some image printing programs to work in QT. Trying to print a custom printer, for which the PPD is. The image to be sent to the printer is calculated based on the device's information.
When looking at the printer properties, I think the In the windows, everything works well - but in Linux, the information of the computed image becomes very large, causing my file to explode ... seeing all the data I found in Linux, Code> Physical DPIX and Therefore, I set it on: Printer for defining QPrinter :: HighResolution 2 on the printer using Windows. For postScript printing, the resolution of the PostScript driver sets to 1200 dpi. I have changed my constructor to take care of it - just when the default is missed ... Task: First of all, anytime Do not rely on physical device resolution. The user can use the printer with different resolutions, once (300dpi) can print with a resolution, next time it can print with another resolution (600 dpi) or in a PDF file, or use the screen resolution The print preview window can open. Second, use screen screens only for printing on the screen, it is too thick for any high resolution device. Letters and images will be ugly and the position on the page will be very less accurately. Physical device resolution and operating system also can be obtained with independent printing, scaling. As far as I know, the QPainter base resolution is 1200dpi, which means that it can print QT's best effective resolution. The next example shows how to set scaling before drawing any content on the page. Then apply the content illustration (Set X and Y coordinate, width and height for images) to 1200dpi base QPainter resolution and the rendering process will take care that all sizes automatically The resolution of the target device will be scaled. resolution is
300dpi x 300dpi .
physical dpi (used in code count) is 1200 instead of 300.
QPrinter Printer (QPrinter :: HighResolution); Qreal resolutionFactor = 1200 / printer- & gt; Resolution (); Copanater painter; Painter.begin (& printer); Painter Scale (1 / Resolution Factor, 1 / Resolution Factor); PrintPage (& amp; portrait); // This method should print painting.ed ();
Comments
Post a Comment