Do not convert to ps for printing---at least sometimes

Review Request #130055 - Created March 28, 2017 and updated

Information
Oliver Sander
okular
Reviewers
okular

This patch is an improved version of what is in the pdfprintpdf branch. (There is really only a single patch in that branch.)

The patch tries to avoid converting pdf files to ps files for printing as much as possible. In particular:

  • If we are printing a file, and printing of annotations is not requested, then the pdf file is sent straight to the printer.
  • If rasterization is requested, then the short previously-windows-only printing code is used, because it does exactly that: printing by rasterization.
  • In all other cases, the file is converted to ps as before.
  • The big #ifdef Q_OS_WIN ... #else ... #endif is removed. All code is compiled on all platforms, but on Windows forceRasterize is always set. Therefore, the behavior on Windows remains unchanged.

There are a few behavioral changes that I know of:
- The resolution of the rasterization most likely changes. Don't know whether this is a problem.
- Previously, when printing without printAnnots to a file, the result file did not have the annotations anymore. With the new code, the annotations are still there, but they are still actual annotations, unlike what you get when using the old code to print annotations. I am not sure whether to call this a regression or a feature.

I am motivated to improve this patch some more, but I need some guidance. What direction should I take to obtain something mergeable?

Also: in the file fileprinter.h it says:

// This Class is a temporary addition to Okular for the duration of KDE 4.0.
// In KDE 4.1 this class will either be moved to kdelibs if still required,
// or replaced with a Qt 4.4 based solution.

KDE 4.1 is long gone. What is fileprinter supposed to be replaced with?


  
Oliver Sander
Review request changed

Change Summary:

Don't claim that the output of rasterized printing is always greyscale. That was my mistake: I simply had the 'greyscale' option selected by accident. Rasterized color printing does work as expected.

Description:

   

This patch is an improved version of what is in the pdfprintpdf branch. (There is really only a single patch in that branch.)

   
   

The patch tries to avoid converting pdf files to ps files for printing as much as possible. In particular:

   
   
  • If we are printing a file, and printing of annotations is not requested, then the pdf file is sent straight to the printer.
   
  • If rasterization is requested, then the short previously-windows-only printing code is used, because it does exactly that: printing by rasterization.
   
  • In all other cases, the file is converted to ps as before.
   
  • The big #ifdef Q_OS_WIN ... #else ... #endif is removed. All code is compiled on all platforms, but on Windows forceRasterize is always set. Therefore, the behavior on Windows remains unchanged.
   
   

There are a few behavioral changes that I know of:

    - The resolution of the rasterization most likely changes. Don't know whether this is a problem.
-   - The output of the old windows-only rasterization code is greyscale only. I have no idea what happens to the colors. Any ideas?
    - Previously, when printing without printAnnots to a file, the result file did not have the annotations anymore. With the new code, the annotations are still there, but they are still actual annotations, unlike what you get when using the old code to print annotations. I am not sure whether to call this a regression or a feature.

   
   

I am motivated to improve this patch some more, but I need some guidance. What direction should I take to obtain something mergeable?

   
   

Also: in the file fileprinter.h it says:

   
   

// This Class is a temporary addition to Okular for the duration of KDE 4.0.

    // In KDE 4.1 this class will either be moved to kdelibs if still required,
    // or replaced with a Qt 4.4 based solution.

   
   

KDE 4.1 is long gone. What is fileprinter supposed to be replaced with?

Loading...