mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-10 11:45:45 +03:00
pdftowrite: init at 2021.05.03 (#377379)
This commit is contained in:
commit
a8bfe58abc
3 changed files with 128 additions and 0 deletions
|
@ -9468,6 +9468,12 @@
|
|||
githubId = 49935860;
|
||||
name = "Henri Rosten";
|
||||
};
|
||||
henrispriet = {
|
||||
email = "henri.spriet@gmail.com";
|
||||
github = "henrispriet";
|
||||
githubId = 36509362;
|
||||
name = "Henri Spriet";
|
||||
};
|
||||
henrytill = {
|
||||
email = "henrytill@gmail.com";
|
||||
github = "henrytill";
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
From b3cd46bf1ea7ddc7ce26e9b713bb7fb5faadba40 Mon Sep 17 00:00:00 2001
|
||||
From: Ulysses Zhan <ulysseszhan@gmail.com>
|
||||
Date: Wed, 20 Mar 2024 21:57:47 -0700
|
||||
Subject: [PATCH] fix `Unknown option --pdf-page` when calling inkscape
|
||||
|
||||
---
|
||||
pdftowrite/pdftowrite.py | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/pdftowrite/pdftowrite.py b/pdftowrite/pdftowrite.py
|
||||
index 6c12515..4d03fc2 100644
|
||||
--- a/pdftowrite/pdftowrite.py
|
||||
+++ b/pdftowrite/pdftowrite.py
|
||||
@@ -79,7 +79,7 @@ def process_page(filename: str, page_num: int, output_dir: str, ns: argparse.Nam
|
||||
opts = ['--pdf-poppler'] if ns.mode is Mode.POPPLER or ns.mode is Mode.MIXED else []
|
||||
utils.inkscape_run([
|
||||
*opts,
|
||||
- f'--pdf-page={page_num}',
|
||||
+ f'--pages={page_num}',
|
||||
f'--export-dpi={ns.dpi}',
|
||||
'--export-plain-svg',
|
||||
'-o', output,
|
||||
@@ -90,7 +90,7 @@ def process_page(filename: str, page_num: int, output_dir: str, ns: argparse.Nam
|
||||
if ns.mode is Mode.MIXED:
|
||||
text_layer_output = str(Path(output_dir) / f'output-{page_num}-text.svg')
|
||||
utils.inkscape_run([
|
||||
- f'--pdf-page={page_num}',
|
||||
+ f'--pages={page_num}',
|
||||
f'--export-dpi={ns.dpi}',
|
||||
'--export-plain-svg',
|
||||
'-o', text_layer_output,
|
91
pkgs/by-name/pd/pdftowrite/package.nix
Normal file
91
pkgs/by-name/pd/pdftowrite/package.nix
Normal file
|
@ -0,0 +1,91 @@
|
|||
{
|
||||
lib,
|
||||
python3Packages,
|
||||
fetchFromGitHub,
|
||||
makeWrapper,
|
||||
versionCheckHook,
|
||||
nix-update-script,
|
||||
|
||||
# shared
|
||||
gzip,
|
||||
# pdftowrite
|
||||
poppler-utils,
|
||||
inkscape,
|
||||
ghostscript,
|
||||
imagemagick,
|
||||
libxml2,
|
||||
libxslt,
|
||||
# writetopdf
|
||||
wkhtmltopdf,
|
||||
pdftk,
|
||||
librsvg,
|
||||
}:
|
||||
python3Packages.buildPythonApplication rec {
|
||||
pname = "pdftowrite";
|
||||
version = "2021.05.03";
|
||||
pyproject = true;
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "apebl";
|
||||
repo = "pdftowrite";
|
||||
tag = version;
|
||||
hash = "sha256-IFX9K74tfGKyMtqlc/RsV00baZEzE3HcPAGfrmTHnDQ=";
|
||||
};
|
||||
|
||||
dependencies = [
|
||||
python3Packages.shortuuid
|
||||
python3Packages.picosvg
|
||||
];
|
||||
|
||||
build-system = [
|
||||
python3Packages.setuptools
|
||||
python3Packages.setuptools-scm
|
||||
makeWrapper
|
||||
];
|
||||
|
||||
patches = [
|
||||
# fix inkscape flag (see https://gitlab.com/inkscape/inkscape/-/issues/4536)
|
||||
./inkscape-unknown-option-pdf-page.patch
|
||||
];
|
||||
|
||||
postInstall =
|
||||
let
|
||||
pdftowritePath = lib.makeBinPath [
|
||||
# shared
|
||||
gzip
|
||||
# pdftowrite
|
||||
poppler-utils
|
||||
inkscape
|
||||
ghostscript
|
||||
imagemagick
|
||||
libxml2
|
||||
libxslt
|
||||
];
|
||||
writetopdfPath = lib.makeBinPath [
|
||||
# shared
|
||||
gzip
|
||||
# writetopdf
|
||||
wkhtmltopdf
|
||||
pdftk
|
||||
librsvg
|
||||
];
|
||||
in
|
||||
# `SELF_CALL=xxx` prevents inkscape shananigans (see https://gitlab.com/inkscape/inkscape/-/issues/4716)
|
||||
''
|
||||
wrapProgram $out/bin/pdftowrite --prefix PATH : ${pdftowritePath} \
|
||||
--set SELF_CALL=xxx
|
||||
wrapProgram $out/bin/writetopdf --prefix PATH : ${writetopdfPath}
|
||||
'';
|
||||
|
||||
nativeCheckInputs = [ versionCheckHook ];
|
||||
versionCheckProgramArg = "--version";
|
||||
passthru.updateScript = nix-update-script { };
|
||||
|
||||
meta = {
|
||||
homepage = "https://github.com/apebl/pdftowrite";
|
||||
description = "Utility that converts PDF to Stylus Labs Write documents, and vice versa";
|
||||
platforms = lib.platforms.linux;
|
||||
license = lib.licenses.mit;
|
||||
maintainers = with lib.maintainers; [ henrispriet ];
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue