-
-
Notifications
You must be signed in to change notification settings - Fork 512
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Trac #33005: Add feature for pdftocairo
feature `pdf2svg` was introduced in #32650 in order to be used in #20343. But it turns out that `pdftocairo -svg` is more widely used, for instance it is available on cygwin as opposed to `pdf2svg`, see https://trac.sagemath.org/ticket/32650#comment:43 URL: https://trac.sagemath.org/33005 Reported by: slabbe Ticket author(s): Sébastien Labbé Reviewer(s): Vincent Delecroix
- Loading branch information
Showing
1 changed file
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# -*- coding: utf-8 -*- | ||
r""" | ||
Check for poppler features | ||
poppler-utils is a collection of tools built on Poppler's library API, to | ||
manage PDF and extract contents: | ||
- ``pdfattach`` - add a new embedded file (attachment) to an existing PDF | ||
- ``pdfdetach`` - extract embedded documents from a PDF | ||
- ``pdffonts`` - lists the fonts used in a PDF | ||
- ``pdfimages`` - extract all embedded images at native resolution from a PDF | ||
- ``pdfinfo`` - list all information of a PDF | ||
- ``pdfseparate`` - extract single pages from a PDF | ||
- ``pdftocairo`` - convert single pages from a PDF to vector or bitmap formats using cairo | ||
- ``pdftohtml`` - convert PDF to HTML format retaining formatting | ||
- ``pdftoppm`` - convert a PDF page to a bitmap | ||
- ``pdftops`` - convert PDF to printable PS format | ||
- ``pdftotext`` - extract all text from PDF | ||
- ``pdfunite`` - merges several PDF | ||
Currently we only check for the presence of ``pdftocairo``. | ||
""" | ||
# **************************************************************************** | ||
# Copyright (C) 2021 Sebastien Labbe <slabqc@gmail.com> | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 2 of the License, or | ||
# (at your option) any later version. | ||
# https://www.gnu.org/licenses/ | ||
# **************************************************************************** | ||
|
||
from . import Executable | ||
|
||
class pdftocairo(Executable): | ||
r""" | ||
A :class:`sage.features.Feature` describing the presence of | ||
``pdftocairo`` | ||
EXAMPLES:: | ||
sage: from sage.features.poppler import pdftocairo | ||
sage: pdftocairo().is_present() # optional: pdftocairo | ||
FeatureTestResult('pdftocairo', True) | ||
""" | ||
def __init__(self): | ||
r""" | ||
TESTS:: | ||
sage: from sage.features.poppler import pdftocairo | ||
sage: isinstance(pdftocairo(), pdftocairo) | ||
True | ||
""" | ||
Executable.__init__(self, "pdftocairo", executable="pdftocairo", | ||
url="https://poppler.freedesktop.org/") | ||
|
||
def all_features(): | ||
return [pdftocairo()] |