[Okular-devel] Review Request 111410: Selection tool: copy/extract as vector graphic by calling "pdftocairo"

Thomas Fischer fischer at unix-ag.uni-kl.de
Sun Jul 7 22:22:31 UTC 2013


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/111410/
-----------------------------------------------------------

(Updated July 7, 2013, 10:22 p.m.)


Review request for Okular.


Changes
-------

> it's not in the correct place, why is all this exporting
> functionality in pageview.cpp? If at all this should be
> integrated with the File->Export functionality and not be
> coded in pageview.cpp but in the proper appropiate backend
This is a misunderstanding. My code does not export whole pages (which File->Export implies and what pdftocairo supports, too), but only the user's selection just like the existing text and image extraction. I made some screenshots which should clarify the situation: http://imgur.com/iHxAws1,Vgjbb5l,VavhqMv (img #1: new context menu when selecting a region of a PDF page; img #2: bitmap as extract with the current "Image" solution; img #3: PDF file extract using the "Vector" option, opened in Okular)
The location of the code in pageview.cpp is therefore justified as the image and text extract code is located in the same class. However, I agree that pageview.cpp is rather large and should be refactored.

Having a vector graphic extract is an serious feature. As my screenshots document, if you want to extract a tiny piece of a PDF file, the existing bitmap feature gives you an image of the size as you see it. Inserting such bitmaps in other documents or slides results in badly scaled images. Obviously, a vector graphic does not suffer from this problem.

> I don't think calling an external tool is a good idea,
> but it is true it's the only "easy" way to provide the
> functionality
Indeed. As pdftocairo's code is Gtk-based, inserting it into Okular may cause problems on its own. The best solution I would see is if the Qt4 backend would support this feature or if a solution using QPrinter-to-PDF would work. I could investigate those two options, but only if there is a realistic chance that the result will be included in Okular.


Description
-------

This patch implements the feature request of bug 321350: if a PDF file is viewed, the selection tool offers the new extraction method "vector" which allows to save to a file (PDF, SVG, EPS, PostScript). The crop operation is performed by calling "pdftocairo" with matching arguments. The resulting file contains the original PDF file's content without rendering it to a pixmap.

I am not sure if calling an external program is an acceptable solution for this problem. However, it is tested if the program is available before showing the new option. Alternatively, the code of pdftocairo (as part of poppler) would had to be copied and integrated into Okular increasing the solution's complexity. I am not aware of a similar solution available using poppler-qt4 only. Maybe using a QPrinter printing to PDF would have been an alternative, but again this seemed to be too complex.


Diffs (updated)
-----

  ui/pageview.cpp 16b00ab 

Diff: http://git.reviewboard.kde.org/r/111410/diff/


Testing
-------


Thanks,

Thomas Fischer

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/okular-devel/attachments/20130707/49b721d1/attachment.html>


More information about the Okular-devel mailing list