Review Request 130055: Do not convert to ps for printing---at least sometimes

Oliver Sander oliver.sander at tu-dresden.de
Wed Jul 12 14:30:36 UTC 2017



> On July 2, 2017, 10:34 p.m., Albert Astals Cid wrote:
> > > KDE 4.1 is long gone.  What is fileprinter supposed to be replaced with?
> > 
> > Some code in Qt that was never made public
> > 
> > > What direction should I take to obtain something mergeable?
> > 
> > Get people that actually use Okular to print with different printers to test it. Or otherwise just say "fuck it" and merge it and fix all the things that break afterwards :D
> > 
> > 
> > 
> > Have you tested printing to different sizes? What about margins?
> 
> Oliver Sander wrote:
>     > Some code in Qt that was never made public
>     
>     Does this mean that fileprinter is here to stay now?
>     
>     > Get people that actually use Okular to print with different printers to test it. Or
>     > otherwise just say "fuck it" and merge it and fix all the things that break afterwards :D
>     
>     I tested a few configurations, but I don't think one person can exhaustively test these things anyway.  How about the following: we merge it, but we add a new option to the print dialog "Fall back to ghostscript printing" (default: off).  That would allow to pacify angry users quickly, and it may help with debugging, too.  If things are quiet for a year or two we can then remove the option.
>     
>     I don't really have any clue how to do printing with annotations without ghostscript.  Any ideas?  Will that require poppler support?  Like a new option in Poppler::PdfConverter?
> 
> Albert Astals Cid wrote:
>     > Does this mean that fileprinter is here to stay now?
>     
>     Guess so, yeah
>     
>     > How about the following: we merge it, but we add a new option to the print dialog "Fall back to ghostscript printing" (default: off).  That would allow to pacify angry users quickly, and it may help with debugging, too.  If things are quiet for a year or two we can then remove the option.
>     
>     Postscript, not ghostscript
>     
>     > I don't really have any clue how to do printing with annotations without ghostscript.  Any ideas?  Will that require poppler support?  Like a new option in Poppler::PdfConverter?
>     
>     Yeah guess so.

> > I don't really have any clue how to do printing with annotations without ghostscript.
> > Any ideas? Will that require poppler support? Like a new option in 
> > Poppler::PdfConverter?
> Yeah guess so.

I thought about this a bit more.  According to the Qt docs, the 'true' way would be to have poppler render the file directly into a QPrinter/QPainter, and then let Qt do the actual printing.  That would simplify the Okular printing code considerably, and it would also work on Windows (unlike what we do currently).

Interestingly, you can kind-of already do that, by using the poppler renderToPainter method.  First experiments have been promising, but you need the Arthur backend and I think I am seeing a few of its deficiencies.  Is it worth pursuing this approach any further?


- Oliver


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/130055/#review103401
-----------------------------------------------------------


On July 12, 2017, 10:37 a.m., Oliver Sander wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/130055/
> -----------------------------------------------------------
> 
> (Updated July 12, 2017, 10:37 a.m.)
> 
> 
> Review request for Okular.
> 
> 
> Repository: okular
> 
> 
> 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.
> - 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?
> 
> 
> Diffs
> -----
> 
>   generators/poppler/generator_pdf.h a078f50bd 
>   generators/poppler/generator_pdf.cpp 42ccb3a26 
>   part.cpp df38e85e9 
> 
> Diff: https://git.reviewboard.kde.org/r/130055/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Oliver Sander
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/okular-devel/attachments/20170712/04483326/attachment-0001.html>


More information about the Okular-devel mailing list