New upstream version 1.1.0
Dr. Tobias Quathamer
4 years ago
0 | Release 1.1.0 (2019-02-11): | |
1 | Add stable poppler-cpp interface for poppler 0.74.0+ | |
2 | ||
0 | 3 | Release 1.0.3 (2018-12-09): |
1 | 4 | Support poppler 0.72.0 |
2 | 5 |
27 | 27 | `-dPDFDontUseFontObjectNum` コマンドラインオプションが必要です。 |
28 | 28 | Ghostscript 9.22 以降は重複フォント削除ができなくなくなったため、 |
29 | 29 | フルセット埋め込みの方法を採ることができません。 |
30 | 詳細は https://ghostscript.com/pipermail/gs-devel/2017-September/date.html | |
31 | や http://lists.gnu.org/archive/html/lilypond-devel/2017-09/index.html | |
32 | をご覧ください。 | |
30 | 33 | この場合は、次に示すフォントを一切埋め込まない方法を採る必要があります。) |
31 | 34 | |
32 | 35 | さらに、図の PDF に一切フォントを埋め込まなかった場合、 |
33 | 36 | TeX システムはフォントが欠けたメイン PDF を出力します。 |
34 | 37 | この場合、Ghostscript は必要なフォントを埋め込むことができるので、 |
35 | 38 | 必要なディスク容量を劇的に減らすことができるようになります。 |
39 | (注意: Ghostscript 9.26 以降で CID フォントを埋め込みたい場合は、 | |
40 | https://bugs.ghostscript.com/show_bug.cgi?id=700367 | |
41 | と https://bugs.ghostscript.com/show_bug.cgi?id=700436 | |
42 | をご覧ください。) | |
36 | 43 | |
37 | 44 | いずれの方法でも、 |
38 | 45 | Ghostscript へ TeX システムの出力したメイン PDF を入力し、 |
53 | 60 | ## 使い方 |
54 | 61 | |
55 | 62 | $ extractpdfmark TeX出力.pdf > 抽出したPDFmark.ps |
56 | $ gs -q -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -dPDFDontUseFontObjectNum \ | |
63 | $ gs -q -dBATCH -dNOPAUSE -sDEVICE=pdfwrite \ | |
64 | -dPDFDontUseFontObjectNum -dPrinted=false \ | |
57 | 65 | -sOutputFile=最終.pdf TeX出力.pdf 抽出したPDFmark.ps |
66 | ||
67 | (注意: Ghostscript 9.26 以降は `-dPrinted=false` | |
68 | コマンドラインオプションが必要です。詳細は | |
69 | https://bugs.ghostscript.com/show_bug.cgi?id=699830 | |
70 | をご覧ください。) | |
58 | 71 | |
59 | 72 | ## バイナリパッケージからのインストール |
60 | 73 | |
72 | 85 | * Cygwin: |
73 | 86 | [2017-05](https://sourceware.org/ml/cygwin-announce/2017-05/msg00030.html). |
74 | 87 | |
75 | ## [ソース tarball](https://github.com/trueroad/extractpdfmark/releases/download/v1.0.3/extractpdfmark-1.0.3.tar.gz) からのインストール | |
88 | ## [ソース tarball](https://github.com/trueroad/extractpdfmark/releases/download/v1.1.0/extractpdfmark-1.1.0.tar.gz) からのインストール | |
76 | 89 | |
77 | 90 | ### 必要なもの |
78 | 91 | |
92 | Extract PDFmark は poppler にある 2 種類のインタフェースのうち、 | |
93 | どちらかを必要とします。 | |
94 | Extract PDFmark をビルドする際に、どちらを使用するか選択してください。 | |
95 | ||
96 | #### poppler-cpp I/F (推奨) | |
97 | ||
98 | [poppler](https://poppler.freedesktop.org/) 0.74.0 以降が必要です。 | |
99 | Extract PDFmark の configure スクリプトは、 | |
100 | pkg-config が poppler-cpp >= 0.74.0 を見つけたら | |
101 | poppler-cpp I/F を選択します。 | |
102 | ||
103 | configure スクリプトのオプション `--with-poppler=cpp` によって、 | |
104 | 本 I/F の使用を明示的に指定できます。 | |
105 | ||
106 | パッケージを使って準備したい場合には、以下が便利でしょう。 | |
107 | ||
108 | * Debian / Ubuntu | |
109 | + libpoppler-cpp-dev | |
110 | * Fedora | |
111 | + poppler-cpp-devel | |
112 | * Cygwin | |
113 | + libpoppler-cpp-devel | |
114 | ||
115 | #### poppler-core I/F | |
116 | ||
79 | 117 | [poppler](https://poppler.freedesktop.org/) 0.13.3 以降 |
80 | --enable-xpdf-headers (poppler 0.59.0 まで) | |
81 | または | |
82 | -DENABLE_XPDF_HEADERS=ON (poppler 0.60.0 以降) | |
83 | オプション付き | |
84 | (推奨 poppler 0.48.0 以降) | |
118 | に以下のオプションをつけてビルドしたものが必要です | |
119 | (推奨 poppler 0.48.0 以降)。 | |
120 | poppler 0.74.0 以降の場合は poppler-cpp I/F の方を推奨します。 | |
121 | ||
122 | * --enable-xpdf-headers (poppler 0.59.0 まで) | |
123 | * -DENABLE_XPDF_HEADERS=ON (poppler 0.60.0 から 0.72.0) | |
124 | * -DENABLE_UNSTABLE_API_ABI_HEADERS=ON (poppler 0.73.0 以降) | |
125 | ||
126 | Extract PDFmark の configure スクリプトは、 | |
127 | pkg-config が poppler-cpp >= 0.74.0 を見つけられず、 | |
128 | かつ poppler >= 0.24.4 を見つけたら | |
129 | poppler-core I/F を選択します。 | |
130 | 本 I/F には private 版と通常版の 2 種類があります。 | |
131 | poppler 0.24.4 から 0.47.0 の場合は private 版が選択されます。 | |
132 | poppler 0.48.0 以降の場合は通常版が選択されます。 | |
133 | ||
134 | configure スクリプトのオプション `--with-poppler=core-private` によって、 | |
135 | private 版の使用を明示的に指定できます(poppler 0.13.3 以降用)。 | |
136 | configure スクリプトのオプション `--with-poppler=core` によって、 | |
137 | 通常版の使用を明示的に指定できます(poppler 0.48.0 以降用)。 | |
138 | poppler 0.13.3 から 0.24.3 を使うには、 | |
139 | configure スクリプトのオプション `--with-poppler=core-private` を | |
140 | 明示的に指定する必要があります。 | |
141 | しかし、これらのバージョンでは Extract PDFmark の `make check` | |
142 | で一部のテストに失敗します。 | |
85 | 143 | |
86 | 144 | パッケージを使って準備したい場合には、以下が便利でしょう。 |
87 | 145 | |
88 | 146 | * Debian / Ubuntu |
89 | + libpoppler-private-dev | |
90 | + libpoppler-dev | |
147 | + libpoppler-private-dev | |
148 | + libpoppler-dev | |
91 | 149 | * Fedora |
92 | + poppler-devel | |
150 | + poppler-devel | |
93 | 151 | * Cygwin |
94 | + libpoppler-devel | |
152 | + libpoppler-devel | |
95 | 153 | |
96 | 154 | ### ビルド・インストール方法 |
97 | 155 | |
140 | 198 | |
141 | 199 | ## ライセンス |
142 | 200 | |
143 | Copyright (C) 2016-2018 Masamichi Hosoda | |
201 | Copyright (C) 2016-2019 Masamichi Hosoda | |
144 | 202 | |
145 | 203 | Extract PDFmark is free software: you can redistribute it and/or modify |
146 | 204 | it under the terms of the GNU General Public License as published by |
25 | 25 | commandline option for removing duplicate fonts. |
26 | 26 | If you use Ghostscript 9.22+, you cannot use this "full set embedding" method |
27 | 27 | since it cannot remove duplicate fonts. |
28 | See https://ghostscript.com/pipermail/gs-devel/2017-September/date.html | |
29 | and http://lists.gnu.org/archive/html/lilypond-devel/2017-09/index.html . | |
28 | 30 | In this case, you can use "*not* embedding" method as following.) |
29 | 31 | |
30 | 32 | Finally, |
32 | 34 | the TeX system outputs the main PDF file with some fonts missing. |
33 | 35 | In this case, Ghostscript can embed the necessary fonts. |
34 | 36 | It can significantly reduce the required disk size. |
37 | (Note: If you use Ghostscript 9.26+ and want to embed CID fonts, | |
38 | see https://bugs.ghostscript.com/show_bug.cgi?id=700367 | |
39 | and https://bugs.ghostscript.com/show_bug.cgi?id=700436 .) | |
35 | 40 | |
36 | 41 | Either way, |
37 | 42 | when Ghostscript reads the main PDF produced by the TeX system |
53 | 58 | ## Usage |
54 | 59 | |
55 | 60 | $ extractpdfmark TeX-System-Outputted.pdf > Extracted-PDFmark.ps |
56 | $ gs -q -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -dPDFDontUseFontObjectNum \ | |
61 | $ gs -q -dBATCH -dNOPAUSE -sDEVICE=pdfwrite \ | |
62 | -dPDFDontUseFontObjectNum -dPrinted=false \ | |
57 | 63 | -sOutputFile=Final.pdf TeX-System-Outputted.pdf Extracted-PDFmark.ps |
64 | ||
65 | (Note: Ghostscript 9.26+ needs `-dPrinted=false` commandline option. | |
66 | See https://bugs.ghostscript.com/show_bug.cgi?id=699830 .) | |
58 | 67 | |
59 | 68 | ## Install from binary package |
60 | 69 | |
72 | 81 | * Cygwin: |
73 | 82 | [2017-05](https://sourceware.org/ml/cygwin-announce/2017-05/msg00030.html). |
74 | 83 | |
75 | ## Install from [source tarball](https://github.com/trueroad/extractpdfmark/releases/download/v1.0.3/extractpdfmark-1.0.3.tar.gz) | |
84 | ## Install from [source tarball](https://github.com/trueroad/extractpdfmark/releases/download/v1.1.0/extractpdfmark-1.1.0.tar.gz) | |
76 | 85 | |
77 | 86 | ### Required |
78 | 87 | |
79 | [poppler](https://poppler.freedesktop.org/) 0.13.3+ | |
80 | with --enable-xpdf-headers (poppler 0.59.0 and before) | |
81 | or -DENABLE_XPDF_HEADERS=ON (poppler 0.60.0 and after) option | |
82 | (recommended poppler 0.48.0+) | |
88 | Extract PDFmark requires one of the two interfaces of poppler. | |
89 | Please choose which to use when building Extrat PDFmark. | |
90 | ||
91 | #### poppler-cpp I/F (recommended) | |
92 | ||
93 | [poppler](https://poppler.freedesktop.org/) 0.74.0+ is required. | |
94 | Extract PDFmark's configure script selects poppler-cpp I/F | |
95 | if pkg-config finds poppler-cpp >= 0.74.0. | |
96 | ||
97 | The configure script's option `--with-poppler=cpp` specifies | |
98 | explicitly using this interface. | |
83 | 99 | |
84 | 100 | When you would like to use packages for preparing the required library, |
85 | 101 | the following might be convenient. |
86 | 102 | |
87 | 103 | * Debian / Ubuntu |
88 | + libpoppler-private-dev | |
89 | + libpoppler-dev | |
104 | + libpoppler-cpp-dev | |
90 | 105 | * Fedora |
91 | + poppler-devel | |
106 | + poppler-cpp-devel | |
92 | 107 | * Cygwin |
93 | + libpoppler-devel | |
108 | + libpoppler-cpp-devel | |
109 | ||
110 | #### poppler-core I/F | |
111 | ||
112 | [poppler](https://poppler.freedesktop.org/) 0.13.3+ | |
113 | built with the following option is required | |
114 | (recommended poppler 0.48.0+). | |
115 | If you have poppler 0.74.0+, poppler-cpp I/F is recommended. | |
116 | ||
117 | * --enable-xpdf-headers (poppler 0.59.0 and before) | |
118 | * -DENABLE_XPDF_HEADERS=ON (poppler 0.60.0 - 0.72.0) | |
119 | * -DENABLE_UNSTABLE_API_ABI_HEADERS=ON (poppler 0.73.0 and after) | |
120 | ||
121 | Extract PDFmark's configure script selects poppler-core I/F | |
122 | if pkg-config does not find poppler-cpp >= 0.74.0 | |
123 | and finds poppler >= 0.24.4. | |
124 | There are two versions of this interface, private and normal. | |
125 | For popler 0.24.4 - 0.47.0, private version is selected. | |
126 | For popler 0.48.0+, normal version is selected. | |
127 | ||
128 | The configure script's option `--with-poppler=core-private` specifies | |
129 | explicitly using private version (for poppler 0.13.3+). | |
130 | The configure script's option `--with-poppler=core` specifies | |
131 | explicitly using normal version (for poppler 0.48.0+). | |
132 | If you would like to use poppler 0.13.3 - 0.24.3, | |
133 | it is necessary to specify explicitly configure script's option | |
134 | `--with-poppler=core-private`. | |
135 | However, Extract PDFmark with these versions of popler fails | |
136 | some tests in `make check`. | |
137 | ||
138 | When you would like to use packages for preparing the required library, | |
139 | the following might be convenient. | |
140 | ||
141 | * Debian / Ubuntu | |
142 | + libpoppler-private-dev | |
143 | + libpoppler-dev | |
144 | * Fedora | |
145 | + poppler-devel | |
146 | * Cygwin | |
147 | + libpoppler-devel | |
94 | 148 | |
95 | 149 | ### Build & install |
96 | 150 | |
139 | 193 | |
140 | 194 | ## Licence |
141 | 195 | |
142 | Copyright (C) 2016-2018 Masamichi Hosoda | |
196 | Copyright (C) 2016-2019 Masamichi Hosoda | |
143 | 197 | |
144 | 198 | Extract PDFmark is free software: you can redistribute it and/or modify |
145 | 199 | it under the terms of the GNU General Public License as published by |
1 | 1 | # Process this file with autoconf to produce a configure script. |
2 | 2 | |
3 | 3 | AC_PREREQ([2.69]) |
4 | AC_INIT([Extract PDFmark], [1.0.3], , [extractpdfmark], | |
4 | AC_INIT([Extract PDFmark], [1.1.0], , [extractpdfmark], | |
5 | 5 | [https://github.com/trueroad/extractpdfmark]) |
6 | 6 | AM_INIT_AUTOMAKE([foreign]) |
7 | 7 | AC_CONFIG_SRCDIR([src/main.cc]) |
8 | 8 | AC_CONFIG_HEADERS([config.h]) |
9 | 9 | |
10 | PACKAGE_COPYRIGHT="Copyright (C) 2016-2018 Masamichi Hosoda" | |
10 | PACKAGE_COPYRIGHT="Copyright (C) 2016-2019 Masamichi Hosoda" | |
11 | 11 | PACKAGE_LICENSE="License: GPL3+" |
12 | 12 | |
13 | 13 | AC_SUBST([PACKAGE_COPYRIGHT]) |
75 | 75 | PKG_PROG_PKG_CONFIG |
76 | 76 | |
77 | 77 | AC_ARG_WITH([poppler], |
78 | AS_HELP_STRING([--with-poppler=@<:@auto|glib|core|core-private@:>@], | |
78 | AS_HELP_STRING([--with-poppler=@<:@auto|cpp|glib|core|core-private@:>@], | |
79 | 79 | [Poppler I/F (default: auto)]), |
80 | 80 | , |
81 | 81 | [with_poppler=auto]) |
82 | 82 | AS_CASE(["$with_poppler"], |
83 | ["cpp"], | |
84 | [AC_MSG_NOTICE([--with-poppler=cpp requires poppler >= 0.74.0]) | |
85 | PKG_CHECK_MODULES([POPPLER_CPP], [poppler-cpp >= 0.74.0])], | |
83 | 86 | ["glib"], |
84 | [AC_MSG_NOTICE([--with-poppler=glib requires poppler >= 0.48.0]) | |
85 | PKG_CHECK_MODULES([POPPLER_GLIB], [poppler-glib >= 0.48.0])], | |
87 | [AC_MSG_NOTICE([--with-poppler=glib requires poppler >= 0.74.0]) | |
88 | PKG_CHECK_MODULES([POPPLER_GLIB], [poppler-glib >= 0.74.0])], | |
86 | 89 | ["core"], |
87 | 90 | [AC_MSG_NOTICE([--with-poppler=core requires poppler >= 0.48.0]) |
88 | 91 | PKG_CHECK_MODULES([POPPLER], [poppler >= 0.48.0])], |
89 | 92 | ["core-private"], |
90 | 93 | [AC_MSG_NOTICE( |
91 | 94 | [--with-poppler=core-private requires poppler >= 0.13.3]) |
92 | PKG_CHECK_MODULES([POPPLER], [poppler >= 0.13.3])], | |
95 | PKG_CHECK_MODULES([POPPLER], [poppler >= 0.19.2],, | |
96 | [PKG_CHECK_MODULES([POPPLER], [poppler >= 0.13.3]) | |
97 | AC_DEFINE_UNQUOTED([POPPLER_CORE_IF_VERSION], | |
98 | ["`$PKG_CONFIG --modversion poppler`"], | |
99 | [Define poppler version if POPPLER_VERSION cannot be used.])])], | |
93 | 100 | ["auto"], |
94 | 101 | [AC_MSG_NOTICE([selecting for --with-poppler=auto]) |
95 | AC_MSG_NOTICE([ trying for glib (experiment)]) | |
102 | AC_MSG_NOTICE([ trying for cpp (poppler-cpp >= 0.74.0)]) | |
96 | 103 | PKG_CHECK_MODULES( |
97 | [POPPLER_GLIB], [poppler-glib >= 99.99.99], | |
98 | [with_poppler="glib"], | |
104 | [POPPLER_CPP], [poppler-cpp >= 0.74.0], | |
105 | [with_poppler="cpp"], | |
99 | 106 | [AC_MSG_NOTICE([ trying for core (poppler >= 0.48.0)]) |
100 | 107 | PKG_CHECK_MODULES( |
101 | 108 | [POPPLER], [poppler >= 0.48.0], |
102 | 109 | [with_poppler="core"], |
103 | 110 | [AC_MSG_NOTICE( |
104 | [ trying for core-private (poppler >= 0.13.3)]) | |
105 | PKG_CHECK_MODULES([POPPLER], [poppler >= 0.13.3], | |
111 | [ trying for core-private (poppler >= 0.24.4)]) | |
112 | PKG_CHECK_MODULES([POPPLER], [poppler >= 0.24.4], | |
106 | 113 | [with_poppler="core-private"])])])] |
107 | 114 | AC_MSG_NOTICE([use --with-poppler=$with_poppler]), |
108 | 115 | [AC_MSG_ERROR([unrecognized --with-poppler argument: $with_poppler])]) |
109 | 116 | AS_CASE(["$with_poppler"], |
117 | ["cpp"], | |
118 | [POPPLER_IF="poppler-cpp" | |
119 | use_library="cpp"], | |
110 | 120 | ["glib"], |
111 | 121 | [POPPLER_IF="poppler-glib" |
112 | 122 | use_library="glib"], |
121 | 131 | [AC_MSG_ERROR([programming error])]) |
122 | 132 | AM_CONDITIONAL([USE_POPPLER_CORE], [test $use_library = core]) |
123 | 133 | AM_CONDITIONAL([USE_POPPLER_GLIB], [test $use_library = glib]) |
134 | AM_CONDITIONAL([USE_POPPLER_CPP], [test $use_library = cpp]) | |
124 | 135 | AC_DEFINE_UNQUOTED([PACKAGE_STRING], ["$PACKAGE_STRING (with $POPPLER_IF)"], |
125 | 136 | [Define to the full name and version, method of this package.]) |
126 | 137 | |
189 | 200 | src/Makefile |
190 | 201 | src/poppler-core/Makefile |
191 | 202 | src/poppler-glib/Makefile |
203 | src/poppler-cpp/Makefile | |
192 | 204 | man/Makefile |
193 | 205 | test/Makefile]) |
194 | 206 | AC_OUTPUT |
0 | 0 | # =========================================================================== |
1 | # http://www.gnu.org/software/autoconf-archive/ax_compare_version.html | |
1 | # https://www.gnu.org/software/autoconf-archive/ax_compare_version.html | |
2 | 2 | # =========================================================================== |
3 | 3 | # |
4 | 4 | # SYNOPSIS |
78 | 78 | # and this notice are preserved. This file is offered as-is, without any |
79 | 79 | # warranty. |
80 | 80 | |
81 | #serial 11 | |
81 | #serial 13 | |
82 | 82 | |
83 | 83 | dnl ######################################################################### |
84 | 84 | AC_DEFUN([AX_COMPARE_VERSION], [ |
145 | 145 | ], |
146 | 146 | [.+],[ |
147 | 147 | AC_WARNING( |
148 | [illegal OP numeric parameter: $2]) | |
148 | [invalid OP numeric parameter: $2]) | |
149 | 149 | ],[]) |
150 | 150 | |
151 | 151 | # Pad zeros at end of numbers to make same length. |
161 | 161 | [ne],[ |
162 | 162 | test "x$A" != "x$B" && ax_compare_version=true |
163 | 163 | ],[ |
164 | AC_WARNING([illegal OP parameter: $2]) | |
164 | AC_WARNING([invalid OP parameter: $2]) | |
165 | 165 | ]) |
166 | 166 | ]) |
167 | 167 |
0 | 0 | # =========================================================================== |
1 | # http://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx.html | |
1 | # https://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx.html | |
2 | 2 | # =========================================================================== |
3 | 3 | # |
4 | 4 | # SYNOPSIS |
32 | 32 | # Copyright (c) 2014, 2015 Google Inc.; contributed by Alexey Sokolov <sokolov@google.com> |
33 | 33 | # Copyright (c) 2015 Paul Norman <penorman@mac.com> |
34 | 34 | # Copyright (c) 2015 Moritz Klammler <moritz@klammler.eu> |
35 | # Copyright (c) 2016, 2018 Krzesimir Nowak <qdlacz@gmail.com> | |
35 | 36 | # |
36 | 37 | # Copying and distribution of this file, with or without modification, are |
37 | 38 | # permitted in any medium without royalty provided the copyright notice |
38 | 39 | # and this notice are preserved. This file is offered as-is, without any |
39 | 40 | # warranty. |
40 | 41 | |
41 | #serial 4 | |
42 | #serial 10 | |
42 | 43 | |
43 | 44 | dnl This macro is based on the code from the AX_CXX_COMPILE_STDCXX_11 macro |
44 | 45 | dnl (serial version number 13). |
45 | 46 | |
46 | 47 | AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl |
47 | m4_if([$1], [11], [], | |
48 | [$1], [14], [], | |
49 | [$1], [17], [m4_fatal([support for C++17 not yet implemented in AX_CXX_COMPILE_STDCXX])], | |
48 | m4_if([$1], [11], [ax_cxx_compile_alternatives="11 0x"], | |
49 | [$1], [14], [ax_cxx_compile_alternatives="14 1y"], | |
50 | [$1], [17], [ax_cxx_compile_alternatives="17 1z"], | |
50 | 51 | [m4_fatal([invalid first argument `$1' to AX_CXX_COMPILE_STDCXX])])dnl |
51 | 52 | m4_if([$2], [], [], |
52 | 53 | [$2], [ext], [], |
58 | 59 | [m4_fatal([invalid third argument `$3' to AX_CXX_COMPILE_STDCXX])]) |
59 | 60 | AC_LANG_PUSH([C++])dnl |
60 | 61 | ac_success=no |
61 | AC_CACHE_CHECK(whether $CXX supports C++$1 features by default, | |
62 | ax_cv_cxx_compile_cxx$1, | |
63 | [AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], | |
64 | [ax_cv_cxx_compile_cxx$1=yes], | |
65 | [ax_cv_cxx_compile_cxx$1=no])]) | |
66 | if test x$ax_cv_cxx_compile_cxx$1 = xyes; then | |
67 | ac_success=yes | |
68 | fi | |
69 | 62 | |
70 | 63 | m4_if([$2], [noext], [], [dnl |
71 | 64 | if test x$ac_success = xno; then |
72 | for switch in -std=gnu++$1 -std=gnu++0x; do | |
65 | for alternative in ${ax_cxx_compile_alternatives}; do | |
66 | switch="-std=gnu++${alternative}" | |
73 | 67 | cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch]) |
74 | 68 | AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch, |
75 | 69 | $cachevar, |
95 | 89 | dnl HP's aCC needs +std=c++11 according to: |
96 | 90 | dnl http://h21007.www2.hp.com/portal/download/files/unprot/aCxx/PDF_Release_Notes/769149-001.pdf |
97 | 91 | dnl Cray's crayCC needs "-h std=c++11" |
98 | for switch in -std=c++$1 -std=c++0x +std=c++$1 "-h std=c++$1"; do | |
99 | cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch]) | |
100 | AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch, | |
101 | $cachevar, | |
102 | [ac_save_CXX="$CXX" | |
103 | CXX="$CXX $switch" | |
104 | AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], | |
105 | [eval $cachevar=yes], | |
106 | [eval $cachevar=no]) | |
107 | CXX="$ac_save_CXX"]) | |
108 | if eval test x\$$cachevar = xyes; then | |
109 | CXX="$CXX $switch" | |
110 | if test -n "$CXXCPP" ; then | |
111 | CXXCPP="$CXXCPP $switch" | |
92 | for alternative in ${ax_cxx_compile_alternatives}; do | |
93 | for switch in -std=c++${alternative} +std=c++${alternative} "-h std=c++${alternative}"; do | |
94 | cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch]) | |
95 | AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch, | |
96 | $cachevar, | |
97 | [ac_save_CXX="$CXX" | |
98 | CXX="$CXX $switch" | |
99 | AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])], | |
100 | [eval $cachevar=yes], | |
101 | [eval $cachevar=no]) | |
102 | CXX="$ac_save_CXX"]) | |
103 | if eval test x\$$cachevar = xyes; then | |
104 | CXX="$CXX $switch" | |
105 | if test -n "$CXXCPP" ; then | |
106 | CXXCPP="$CXXCPP $switch" | |
107 | fi | |
108 | ac_success=yes | |
109 | break | |
112 | 110 | fi |
113 | ac_success=yes | |
111 | done | |
112 | if test x$ac_success = xyes; then | |
114 | 113 | break |
115 | 114 | fi |
116 | 115 | done |
147 | 146 | _AX_CXX_COMPILE_STDCXX_testbody_new_in_14 |
148 | 147 | ) |
149 | 148 | |
149 | m4_define([_AX_CXX_COMPILE_STDCXX_testbody_17], | |
150 | _AX_CXX_COMPILE_STDCXX_testbody_new_in_11 | |
151 | _AX_CXX_COMPILE_STDCXX_testbody_new_in_14 | |
152 | _AX_CXX_COMPILE_STDCXX_testbody_new_in_17 | |
153 | ) | |
150 | 154 | |
151 | 155 | dnl Tests for new features in C++11 |
152 | 156 | |
517 | 521 | |
518 | 522 | } |
519 | 523 | |
520 | namespace test_digit_seperators | |
524 | namespace test_digit_separators | |
521 | 525 | { |
522 | 526 | |
523 | 527 | constexpr auto ten_million = 100'000'000; |
559 | 563 | #endif // __cplusplus >= 201402L |
560 | 564 | |
561 | 565 | ]]) |
566 | ||
567 | ||
568 | dnl Tests for new features in C++17 | |
569 | ||
570 | m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_17], [[ | |
571 | ||
572 | // If the compiler admits that it is not ready for C++17, why torture it? | |
573 | // Hopefully, this will speed up the test. | |
574 | ||
575 | #ifndef __cplusplus | |
576 | ||
577 | #error "This is not a C++ compiler" | |
578 | ||
579 | #elif __cplusplus < 201703L | |
580 | ||
581 | #error "This is not a C++17 compiler" | |
582 | ||
583 | #else | |
584 | ||
585 | #include <initializer_list> | |
586 | #include <utility> | |
587 | #include <type_traits> | |
588 | ||
589 | namespace cxx17 | |
590 | { | |
591 | ||
592 | namespace test_constexpr_lambdas | |
593 | { | |
594 | ||
595 | constexpr int foo = [](){return 42;}(); | |
596 | ||
597 | } | |
598 | ||
599 | namespace test::nested_namespace::definitions | |
600 | { | |
601 | ||
602 | } | |
603 | ||
604 | namespace test_fold_expression | |
605 | { | |
606 | ||
607 | template<typename... Args> | |
608 | int multiply(Args... args) | |
609 | { | |
610 | return (args * ... * 1); | |
611 | } | |
612 | ||
613 | template<typename... Args> | |
614 | bool all(Args... args) | |
615 | { | |
616 | return (args && ...); | |
617 | } | |
618 | ||
619 | } | |
620 | ||
621 | namespace test_extended_static_assert | |
622 | { | |
623 | ||
624 | static_assert (true); | |
625 | ||
626 | } | |
627 | ||
628 | namespace test_auto_brace_init_list | |
629 | { | |
630 | ||
631 | auto foo = {5}; | |
632 | auto bar {5}; | |
633 | ||
634 | static_assert(std::is_same<std::initializer_list<int>, decltype(foo)>::value); | |
635 | static_assert(std::is_same<int, decltype(bar)>::value); | |
636 | } | |
637 | ||
638 | namespace test_typename_in_template_template_parameter | |
639 | { | |
640 | ||
641 | template<template<typename> typename X> struct D; | |
642 | ||
643 | } | |
644 | ||
645 | namespace test_fallthrough_nodiscard_maybe_unused_attributes | |
646 | { | |
647 | ||
648 | int f1() | |
649 | { | |
650 | return 42; | |
651 | } | |
652 | ||
653 | [[nodiscard]] int f2() | |
654 | { | |
655 | [[maybe_unused]] auto unused = f1(); | |
656 | ||
657 | switch (f1()) | |
658 | { | |
659 | case 17: | |
660 | f1(); | |
661 | [[fallthrough]]; | |
662 | case 42: | |
663 | f1(); | |
664 | } | |
665 | return f1(); | |
666 | } | |
667 | ||
668 | } | |
669 | ||
670 | namespace test_extended_aggregate_initialization | |
671 | { | |
672 | ||
673 | struct base1 | |
674 | { | |
675 | int b1, b2 = 42; | |
676 | }; | |
677 | ||
678 | struct base2 | |
679 | { | |
680 | base2() { | |
681 | b3 = 42; | |
682 | } | |
683 | int b3; | |
684 | }; | |
685 | ||
686 | struct derived : base1, base2 | |
687 | { | |
688 | int d; | |
689 | }; | |
690 | ||
691 | derived d1 {{1, 2}, {}, 4}; // full initialization | |
692 | derived d2 {{}, {}, 4}; // value-initialized bases | |
693 | ||
694 | } | |
695 | ||
696 | namespace test_general_range_based_for_loop | |
697 | { | |
698 | ||
699 | struct iter | |
700 | { | |
701 | int i; | |
702 | ||
703 | int& operator* () | |
704 | { | |
705 | return i; | |
706 | } | |
707 | ||
708 | const int& operator* () const | |
709 | { | |
710 | return i; | |
711 | } | |
712 | ||
713 | iter& operator++() | |
714 | { | |
715 | ++i; | |
716 | return *this; | |
717 | } | |
718 | }; | |
719 | ||
720 | struct sentinel | |
721 | { | |
722 | int i; | |
723 | }; | |
724 | ||
725 | bool operator== (const iter& i, const sentinel& s) | |
726 | { | |
727 | return i.i == s.i; | |
728 | } | |
729 | ||
730 | bool operator!= (const iter& i, const sentinel& s) | |
731 | { | |
732 | return !(i == s); | |
733 | } | |
734 | ||
735 | struct range | |
736 | { | |
737 | iter begin() const | |
738 | { | |
739 | return {0}; | |
740 | } | |
741 | ||
742 | sentinel end() const | |
743 | { | |
744 | return {5}; | |
745 | } | |
746 | }; | |
747 | ||
748 | void f() | |
749 | { | |
750 | range r {}; | |
751 | ||
752 | for (auto i : r) | |
753 | { | |
754 | [[maybe_unused]] auto v = i; | |
755 | } | |
756 | } | |
757 | ||
758 | } | |
759 | ||
760 | namespace test_lambda_capture_asterisk_this_by_value | |
761 | { | |
762 | ||
763 | struct t | |
764 | { | |
765 | int i; | |
766 | int foo() | |
767 | { | |
768 | return [*this]() | |
769 | { | |
770 | return i; | |
771 | }(); | |
772 | } | |
773 | }; | |
774 | ||
775 | } | |
776 | ||
777 | namespace test_enum_class_construction | |
778 | { | |
779 | ||
780 | enum class byte : unsigned char | |
781 | {}; | |
782 | ||
783 | byte foo {42}; | |
784 | ||
785 | } | |
786 | ||
787 | namespace test_constexpr_if | |
788 | { | |
789 | ||
790 | template <bool cond> | |
791 | int f () | |
792 | { | |
793 | if constexpr(cond) | |
794 | { | |
795 | return 13; | |
796 | } | |
797 | else | |
798 | { | |
799 | return 42; | |
800 | } | |
801 | } | |
802 | ||
803 | } | |
804 | ||
805 | namespace test_selection_statement_with_initializer | |
806 | { | |
807 | ||
808 | int f() | |
809 | { | |
810 | return 13; | |
811 | } | |
812 | ||
813 | int f2() | |
814 | { | |
815 | if (auto i = f(); i > 0) | |
816 | { | |
817 | return 3; | |
818 | } | |
819 | ||
820 | switch (auto i = f(); i + 4) | |
821 | { | |
822 | case 17: | |
823 | return 2; | |
824 | ||
825 | default: | |
826 | return 1; | |
827 | } | |
828 | } | |
829 | ||
830 | } | |
831 | ||
832 | namespace test_template_argument_deduction_for_class_templates | |
833 | { | |
834 | ||
835 | template <typename T1, typename T2> | |
836 | struct pair | |
837 | { | |
838 | pair (T1 p1, T2 p2) | |
839 | : m1 {p1}, | |
840 | m2 {p2} | |
841 | {} | |
842 | ||
843 | T1 m1; | |
844 | T2 m2; | |
845 | }; | |
846 | ||
847 | void f() | |
848 | { | |
849 | [[maybe_unused]] auto p = pair{13, 42u}; | |
850 | } | |
851 | ||
852 | } | |
853 | ||
854 | namespace test_non_type_auto_template_parameters | |
855 | { | |
856 | ||
857 | template <auto n> | |
858 | struct B | |
859 | {}; | |
860 | ||
861 | B<5> b1; | |
862 | B<'a'> b2; | |
863 | ||
864 | } | |
865 | ||
866 | namespace test_structured_bindings | |
867 | { | |
868 | ||
869 | int arr[2] = { 1, 2 }; | |
870 | std::pair<int, int> pr = { 1, 2 }; | |
871 | ||
872 | auto f1() -> int(&)[2] | |
873 | { | |
874 | return arr; | |
875 | } | |
876 | ||
877 | auto f2() -> std::pair<int, int>& | |
878 | { | |
879 | return pr; | |
880 | } | |
881 | ||
882 | struct S | |
883 | { | |
884 | int x1 : 2; | |
885 | volatile double y1; | |
886 | }; | |
887 | ||
888 | S f3() | |
889 | { | |
890 | return {}; | |
891 | } | |
892 | ||
893 | auto [ x1, y1 ] = f1(); | |
894 | auto& [ xr1, yr1 ] = f1(); | |
895 | auto [ x2, y2 ] = f2(); | |
896 | auto& [ xr2, yr2 ] = f2(); | |
897 | const auto [ x3, y3 ] = f3(); | |
898 | ||
899 | } | |
900 | ||
901 | namespace test_exception_spec_type_system | |
902 | { | |
903 | ||
904 | struct Good {}; | |
905 | struct Bad {}; | |
906 | ||
907 | void g1() noexcept; | |
908 | void g2(); | |
909 | ||
910 | template<typename T> | |
911 | Bad | |
912 | f(T*, T*); | |
913 | ||
914 | template<typename T1, typename T2> | |
915 | Good | |
916 | f(T1*, T2*); | |
917 | ||
918 | static_assert (std::is_same_v<Good, decltype(f(g1, g2))>); | |
919 | ||
920 | } | |
921 | ||
922 | namespace test_inline_variables | |
923 | { | |
924 | ||
925 | template<class T> void f(T) | |
926 | {} | |
927 | ||
928 | template<class T> inline T g(T) | |
929 | { | |
930 | return T{}; | |
931 | } | |
932 | ||
933 | template<> inline void f<>(int) | |
934 | {} | |
935 | ||
936 | template<> int g<>(int) | |
937 | { | |
938 | return 5; | |
939 | } | |
940 | ||
941 | } | |
942 | ||
943 | } // namespace cxx17 | |
944 | ||
945 | #endif // __cplusplus < 201703L | |
946 | ||
947 | ]]) |
0 | # ============================================================================ | |
1 | # http://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_11.html | |
2 | # ============================================================================ | |
0 | # ============================================================================= | |
1 | # https://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_11.html | |
2 | # ============================================================================= | |
3 | 3 | # |
4 | 4 | # SYNOPSIS |
5 | 5 | # |
32 | 32 | # and this notice are preserved. This file is offered as-is, without any |
33 | 33 | # warranty. |
34 | 34 | |
35 | #serial 17 | |
35 | #serial 18 | |
36 | 36 | |
37 | 37 | AX_REQUIRE_DEFINED([AX_CXX_COMPILE_STDCXX]) |
38 | 38 | AC_DEFUN([AX_CXX_COMPILE_STDCXX_11], [AX_CXX_COMPILE_STDCXX([11], [$1], [$2])]) |
0 | .TH EXTRACTPDFMARK 1 "December 9, 2018" | |
0 | .TH EXTRACTPDFMARK 1 "January 26, 2019" | |
1 | 1 | .SH NAME |
2 | 2 | extractpdfmark \- Extract page mode and named destinations as PDFmark from PDF |
3 | 3 | .SH SYNOPSIS |
15 | 15 | If the small PDF files contain embedded font subsets, the TeX system |
16 | 16 | includes them as-is in the main PDF. |
17 | 17 | As a result, several subsets of the same font are embedded in the main PDF. |
18 | It is not possible to remove the duplicates since they are different subsets. | |
18 | It is not possible to remove the duplicates since the subsets differ. | |
19 | 19 | This vastly increases the size of the main PDF file. |
20 | 20 | .PP |
21 | 21 | On the other hand, if the small PDF files contain embedded full font |
35 | 35 | embedded, the TeX system outputs the main PDF file with some fonts |
36 | 36 | missing. |
37 | 37 | In this case, Ghostscript can embed the necessary fonts. |
38 | It can significantly reduce the required disk size. | |
38 | It can also significantly reduce the required disk size. | |
39 | 39 | .PP |
40 | 40 | Either way, when Ghostscript reads the main PDF produced by the |
41 | 41 | TeX system and outputs the final PDF it does not preserve PDF |
42 | page\-mode and named\-destinations etc. | |
42 | page\-mode and named\-destinations, etc. | |
43 | 43 | As a result, when you open the final PDF, it is not displayed correctly. |
44 | 44 | Also, remote PDF links will not work. |
45 | 45 | .PP |
46 | This program is able to extract page mode and named destinations | |
46 | This program is able to extract the page mode and named destinations | |
47 | 47 | as PDFmark from PDF. |
48 | 48 | By using this you can get the small PDF files that have preserved them. |
49 | 49 | .SH EXAMPLE |
50 | .RS | |
50 | .EX | |
51 | 51 | $ extractpdfmark TeX-System-Outputted.pdf > Extracted-PDFmark.ps |
52 | .RE | |
53 | .RS | |
54 | $ gs -q -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -dPDFDontUseFontObjectNum -sOutputFile=Final.pdf TeX-System-Outputted.pdf Extracted-PDFmark.ps | |
55 | .RE | |
52 | $ gs -q -dBATCH -dNOPAUSE -sDEVICE=pdfwrite \e | |
53 | -dPDFDontUseFontObjectNum -dPrinted=false \e | |
54 | -sOutputFile=Final.pdf \e | |
55 | TeX-System-Outputted.pdf Extracted-PDFmark.ps | |
56 | .EE | |
57 | .PP | |
58 | (Note: Ghostscript 9.26+ needs | |
59 | .I -dPrinted=false | |
60 | commandline option.) |
24 | 24 | extractpdfmark_DEPENDENCIES += ./poppler-glib/libextractpdfmark-poppler-glib.a |
25 | 25 | endif |
26 | 26 | |
27 | if USE_POPPLER_CPP | |
28 | SUBDIRS += poppler-cpp | |
29 | extractpdfmark_LDADD += -lextractpdfmark-poppler-cpp $(POPPLER_CPP_LIBS) | |
30 | extractpdfmark_LDFLAGS += -L./poppler-cpp | |
31 | extractpdfmark_DEPENDENCIES += ./poppler-cpp/libextractpdfmark-poppler-cpp.a | |
32 | endif | |
33 | ||
27 | 34 | if USE_ICONV |
28 | 35 | extractpdfmark_SOURCES += iconv_wrapper.hh |
29 | 36 | extractpdfmark_LDADD += $(LIBICONV) |
0 | 0 | // This file is part of Extract PDFmark. |
1 | 1 | // |
2 | // Copyright (C) 2016 Masamichi Hosoda | |
2 | // Copyright (C) 2016, 2019 Masamichi Hosoda | |
3 | 3 | // |
4 | 4 | // Extract PDFmark is free software: you can redistribute it and/or modify |
5 | 5 | // it under the terms of the GNU General Public License as published by |
30 | 30 | std::unique_ptr<output_pdfmark> opdfmark {create_output_pdfmark ()}; |
31 | 31 | std::string output_filename; |
32 | 32 | |
33 | cmd.add_default (); | |
33 | cmd.add_default_help (); | |
34 | cmd.add_handler ('V', "version", | |
35 | cmdlineparse::arg_mode::no_argument, | |
36 | [&cmd, &opdfmark](const std::string &)->bool | |
37 | { | |
38 | std::cout << cmd.get_version_string () | |
39 | << std::endl | |
40 | << opdfmark->version (); | |
41 | return false; | |
42 | }, | |
43 | " Print version and exit"); | |
34 | 44 | cmd.add_string ('o', "output", &output_filename, "", |
35 | 45 | " Output filename\n" |
36 | 46 | " (Default: standard output)", |
0 | 0 | // This file is part of Extract PDFmark. |
1 | 1 | // |
2 | // Copyright (C) 2016 Masamichi Hosoda | |
2 | // Copyright (C) 2016, 2019 Masamichi Hosoda | |
3 | 3 | // |
4 | 4 | // Extract PDFmark is free software: you can redistribute it and/or modify |
5 | 5 | // it under the terms of the GNU General Public License as published by |
31 | 31 | virtual bool open (const std::string &pdf_filename) = 0; |
32 | 32 | virtual std::string pagemode (void) = 0; |
33 | 33 | virtual std::string destname (void) = 0; |
34 | virtual std::string version (void) = 0; | |
34 | 35 | |
35 | 36 | void add_options (cmdlineparse::parser *cmd); |
36 | 37 | void parse_options (void); |
0 | 0 | // This file is part of Extract PDFmark. |
1 | 1 | // |
2 | // Copyright (C) 2016 Masamichi Hosoda | |
2 | // Copyright (C) 2016, 2019 Masamichi Hosoda | |
3 | 3 | // |
4 | 4 | // Extract PDFmark is free software: you can redistribute it and/or modify |
5 | 5 | // it under the terms of the GNU General Public License as published by |
49 | 49 | |
50 | 50 | return true; |
51 | 51 | } |
52 | ||
53 | std::string poppler_core::version (void) | |
54 | { | |
55 | std::string retval; | |
56 | ||
57 | retval = "Compiled with poppler-core"; | |
58 | #ifndef HAVE_POPPLER_CORE_IF | |
59 | retval += " private"; | |
60 | #endif | |
61 | #ifdef POPPLER_CORE_IF_VERSION | |
62 | retval += " "; | |
63 | retval += POPPLER_CORE_IF_VERSION; | |
64 | #else | |
65 | #ifdef POPPLER_VERSION | |
66 | retval += " "; | |
67 | retval += POPPLER_VERSION; | |
68 | #endif | |
69 | #endif | |
70 | retval += ".\n"; | |
71 | ||
72 | return retval; | |
73 | } |
0 | 0 | // This file is part of Extract PDFmark. |
1 | 1 | // |
2 | // Copyright (C) 2016 Masamichi Hosoda | |
2 | // Copyright (C) 2016, 2019 Masamichi Hosoda | |
3 | 3 | // |
4 | 4 | // Extract PDFmark is free software: you can redistribute it and/or modify |
5 | 5 | // it under the terms of the GNU General Public License as published by |
32 | 32 | bool open (const std::string &pdf_filename); |
33 | 33 | std::string pagemode (void); |
34 | 34 | std::string destname (void); |
35 | std::string version (void); | |
35 | 36 | |
36 | 37 | private: |
37 | 38 | std::string build_destname (const std::string &name, LinkDest *link_dest); |
0 | noinst_LIBRARIES = libextractpdfmark-poppler-cpp.a | |
1 | libextractpdfmark_poppler_cpp_a_SOURCES = poppler-cpp.cc poppler-cpp.hh \ | |
2 | pagemode-cpp.cc destname-cpp.cc | |
3 | libextractpdfmark_poppler_cpp_a_CPPFLAGS = -I$(srcdir)/.. \ | |
4 | $(POPPLER_CPP_CFLAGS) |
0 | // This file is part of Extract PDFmark. | |
1 | // | |
2 | // Copyright (C) 2019 Masamichi Hosoda | |
3 | // | |
4 | // Extract PDFmark is free software: you can redistribute it and/or modify | |
5 | // it under the terms of the GNU General Public License as published by | |
6 | // the Free Software Foundation, either version 3 of the License, or | |
7 | // (at your option) any later version. | |
8 | // | |
9 | // Extract PDFmark is distributed in the hope that it will be useful, | |
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | // GNU General Public License for more details. | |
13 | // | |
14 | // You should have received a copy of the GNU General Public License | |
15 | // along with Extract PDFmark. If not, see <http://www.gnu.org/licenses/>. | |
16 | ||
17 | #include "config.h" | |
18 | ||
19 | #include "poppler-cpp.hh" | |
20 | ||
21 | #include <sstream> | |
22 | #include <string> | |
23 | #include <poppler-destination.h> | |
24 | ||
25 | std::string poppler_cpp::walk (const std::string &name, | |
26 | const poppler::destination &dest) | |
27 | { | |
28 | std::stringstream ss; | |
29 | ||
30 | switch (dest.type ()) | |
31 | { | |
32 | case poppler::destination::type_enum::xyz: | |
33 | ss | |
34 | << "[ /Dest " << encode_name (name) | |
35 | << " /Page " << dest.page_number () | |
36 | << " /View [/XYZ " << dest.left () | |
37 | << " " << dest.top () | |
38 | << " " << dest.zoom () | |
39 | << "] /DEST pdfmark" << std::endl; | |
40 | break; | |
41 | case poppler::destination::type_enum::fit: | |
42 | ss | |
43 | << "[ /Dest " << encode_name (name) | |
44 | << " /Page " << dest.page_number () | |
45 | << " /View [/Fit] /DEST pdfmark" << std::endl; | |
46 | break; | |
47 | case poppler::destination::type_enum::fit_h: | |
48 | ss | |
49 | << "[ /Dest " << encode_name (name) | |
50 | << " /Page " << dest.page_number () | |
51 | << " /View [/FitH " << dest.top () | |
52 | << "] /DEST pdfmark" << std::endl; | |
53 | break; | |
54 | case poppler::destination::type_enum::fit_v: | |
55 | ss | |
56 | << "[ /Dest " << encode_name (name) | |
57 | << " /Page " << dest.page_number () | |
58 | << " /View [/FitV " << dest.left () | |
59 | << "] /DEST pdfmark" << std::endl; | |
60 | break; | |
61 | case poppler::destination::type_enum::fit_r: | |
62 | ss | |
63 | << "[ /Dest " << encode_name (name) | |
64 | << " /Page " << dest.page_number () | |
65 | << " /View [/FitR " << dest.left () | |
66 | << " " << dest.bottom () | |
67 | << " " << dest.right () | |
68 | << " " << dest.top () | |
69 | << "] /DEST pdfmark" << std::endl; | |
70 | break; | |
71 | case poppler::destination::type_enum::fit_b: | |
72 | ss | |
73 | << "[ /Dest " << encode_name (name) | |
74 | << " /Page " << dest.page_number () | |
75 | << " /View [/FitB] /DEST pdfmark" << std::endl; | |
76 | break; | |
77 | case poppler::destination::type_enum::fit_b_h: | |
78 | ss | |
79 | << "[ /Dest " << encode_name (name) | |
80 | << " /Page " << dest. page_number () | |
81 | << " /View [/FitBH " << dest.top () | |
82 | << "] /DEST pdfmark" << std::endl; | |
83 | break; | |
84 | case poppler::destination::type_enum::fit_b_v: | |
85 | ss | |
86 | << "[ /Dest " << encode_name (name) | |
87 | << " /Page " << dest.page_number () | |
88 | << " /View [/FitBV " << dest.left () | |
89 | << "] /DEST pdfmark" << std::endl; | |
90 | break; | |
91 | case poppler::destination::type_enum::unknown: | |
92 | ss << "% dest type is unknown." << std::endl; | |
93 | break; | |
94 | default: | |
95 | ss << "% dest type error." << std::endl; | |
96 | break; | |
97 | } | |
98 | ||
99 | return ss.str (); | |
100 | } | |
101 | ||
102 | std::string poppler_cpp::destname (void) | |
103 | { | |
104 | auto map {doc->create_destination_map ()}; | |
105 | std::string retval; | |
106 | ||
107 | for (const auto& pair: map) | |
108 | retval += walk (pair.first, pair.second); | |
109 | ||
110 | return retval; | |
111 | } |
0 | // This file is part of Extract PDFmark. | |
1 | // | |
2 | // Copyright (C) 2019 Masamichi Hosoda | |
3 | // | |
4 | // Extract PDFmark is free software: you can redistribute it and/or modify | |
5 | // it under the terms of the GNU General Public License as published by | |
6 | // the Free Software Foundation, either version 3 of the License, or | |
7 | // (at your option) any later version. | |
8 | // | |
9 | // Extract PDFmark is distributed in the hope that it will be useful, | |
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | // GNU General Public License for more details. | |
13 | // | |
14 | // You should have received a copy of the GNU General Public License | |
15 | // along with Extract PDFmark. If not, see <http://www.gnu.org/licenses/>. | |
16 | ||
17 | #include "config.h" | |
18 | ||
19 | #include "poppler-cpp.hh" | |
20 | ||
21 | #include <iostream> | |
22 | #include <sstream> | |
23 | #include <string> | |
24 | #include <poppler-document.h> | |
25 | ||
26 | std::string poppler_cpp::pagemode (void) | |
27 | { | |
28 | std::stringstream ss; | |
29 | ||
30 | if (!doc) | |
31 | { | |
32 | std::cerr << "% document is null" << std::endl; | |
33 | return ""; | |
34 | } | |
35 | ||
36 | switch (doc->page_mode ()) | |
37 | { | |
38 | case poppler::document::page_mode_enum::use_none: | |
39 | ss << "[ /PageMode /UseNone /DOCVIEW pdfmark" << std::endl; | |
40 | break; | |
41 | case poppler::document::page_mode_enum::use_outlines: | |
42 | ss << "[ /PageMode /UseOutlines /DOCVIEW pdfmark" << std::endl; | |
43 | break; | |
44 | case poppler::document::page_mode_enum::use_thumbs: | |
45 | ss << "[ /PageMode /UseThumbs /DOCVIEW pdfmark" << std::endl; | |
46 | break; | |
47 | case poppler::document::page_mode_enum::fullscreen: | |
48 | ss << "[ /PageMode /FullScreen /DOCVIEW pdfmark" << std::endl; | |
49 | break; | |
50 | case poppler::document::page_mode_enum::use_oc: | |
51 | ss << "% PageMode use_oc" << std::endl; | |
52 | break; | |
53 | case poppler::document::page_mode_enum::use_attach: | |
54 | ss << "% PageMode use_attach" << std::endl; | |
55 | break; | |
56 | default: | |
57 | ss << "% PageMode unknown" << std::endl; | |
58 | break; | |
59 | } | |
60 | ||
61 | return ss.str (); | |
62 | } |
0 | // This file is part of Extract PDFmark. | |
1 | // | |
2 | // Copyright (C) 2019 Masamichi Hosoda | |
3 | // | |
4 | // Extract PDFmark is free software: you can redistribute it and/or modify | |
5 | // it under the terms of the GNU General Public License as published by | |
6 | // the Free Software Foundation, either version 3 of the License, or | |
7 | // (at your option) any later version. | |
8 | // | |
9 | // Extract PDFmark is distributed in the hope that it will be useful, | |
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | // GNU General Public License for more details. | |
13 | // | |
14 | // You should have received a copy of the GNU General Public License | |
15 | // along with Extract PDFmark. If not, see <http://www.gnu.org/licenses/>. | |
16 | ||
17 | #include "config.h" | |
18 | ||
19 | #include "poppler-cpp.hh" | |
20 | ||
21 | #include <iostream> | |
22 | #include <string> | |
23 | #include <poppler-document.h> | |
24 | #include <poppler-version.h> | |
25 | ||
26 | std::unique_ptr<output_pdfmark> create_output_pdfmark (void) | |
27 | { | |
28 | return std::unique_ptr<output_pdfmark> (new poppler_cpp ()); | |
29 | } | |
30 | ||
31 | bool poppler_cpp::open (const std::string &pdf_filename) | |
32 | { | |
33 | doc = poppler::document::load_from_file (pdf_filename); | |
34 | ||
35 | if (!doc) | |
36 | { | |
37 | std::cerr << "poppler::document::load_from_file failed: " | |
38 | << pdf_filename; | |
39 | return false; | |
40 | } | |
41 | return true; | |
42 | } | |
43 | ||
44 | std::string poppler_cpp::version (void) | |
45 | { | |
46 | std::string retval; | |
47 | ||
48 | retval = "Compiled with poppler-cpp "; | |
49 | retval += POPPLER_VERSION; | |
50 | retval += ".\nRunning with poppler-cpp "; | |
51 | retval += poppler::version_string (); | |
52 | retval += ".\n"; | |
53 | ||
54 | return retval; | |
55 | } |
0 | // This file is part of Extract PDFmark. | |
1 | // | |
2 | // Copyright (C) 2019 Masamichi Hosoda | |
3 | // | |
4 | // Extract PDFmark is free software: you can redistribute it and/or modify | |
5 | // it under the terms of the GNU General Public License as published by | |
6 | // the Free Software Foundation, either version 3 of the License, or | |
7 | // (at your option) any later version. | |
8 | // | |
9 | // Extract PDFmark is distributed in the hope that it will be useful, | |
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | // GNU General Public License for more details. | |
13 | // | |
14 | // You should have received a copy of the GNU General Public License | |
15 | // along with Extract PDFmark. If not, see <http://www.gnu.org/licenses/>. | |
16 | ||
17 | #ifndef INCLUDE_GUARD_POPPLER_CPP_HH | |
18 | #define INCLUDE_GUARD_POPPLER_CPP_HH | |
19 | ||
20 | #include <string> | |
21 | #include <poppler-destination.h> | |
22 | #include <poppler-document.h> | |
23 | ||
24 | #include "output-pdfmark.hh" | |
25 | ||
26 | class poppler_cpp : public output_pdfmark | |
27 | { | |
28 | public: | |
29 | bool open (const std::string &pdf_filename); | |
30 | std::string pagemode (void); | |
31 | std::string destname (void); | |
32 | std::string version (void); | |
33 | ||
34 | private: | |
35 | std::string walk (const std::string &name, | |
36 | const poppler::destination &dest); | |
37 | ||
38 | poppler::document *doc = nullptr; | |
39 | }; | |
40 | ||
41 | #endif // INCLUDE_GUARD_POPPLER_CPP_HH |
0 | 0 | // This file is part of Extract PDFmark. |
1 | 1 | // |
2 | // Copyright (C) 2016 Masamichi Hosoda | |
2 | // Copyright (C) 2016, 2019 Masamichi Hosoda | |
3 | 3 | // |
4 | 4 | // Extract PDFmark is free software: you can redistribute it and/or modify |
5 | 5 | // it under the terms of the GNU General Public License as published by |
27 | 27 | gpointer value, |
28 | 28 | gpointer user_data) |
29 | 29 | { |
30 | GBytes *name = static_cast<GBytes*> (key); | |
30 | gchar *name = static_cast<char*> (key); | |
31 | 31 | PopplerDest *dest = static_cast<PopplerDest*> (value); |
32 | 32 | poppler_glib *pg = static_cast<poppler_glib*> (user_data); |
33 | 33 | |
34 | 34 | return pg->walk (name, dest); |
35 | 35 | } |
36 | 36 | |
37 | bool poppler_glib::walk (GBytes *name, PopplerDest *dest) | |
37 | bool poppler_glib::walk (gchar *name, PopplerDest *dest) | |
38 | 38 | { |
39 | std::string n {static_cast<const char*> (g_bytes_get_data (name, nullptr)), | |
40 | static_cast<std::string::size_type> (g_bytes_get_size (name))}; | |
39 | gsize len; | |
40 | void *data {poppler_named_dest_to_bytestring (name, &len)}; | |
41 | std::string n {static_cast<char*> (data), | |
42 | static_cast<std::string::size_type> (len)}; | |
41 | 43 | std::stringstream ss; |
42 | 44 | if (dest) |
43 | 45 | { |
122 | 124 | std::string poppler_glib::destname (void) |
123 | 125 | { |
124 | 126 | std::unique_ptr<GTree, decltype (&g_tree_destroy)> |
125 | tree {poppler_document_build_dests_tree (document), g_tree_destroy}; | |
127 | tree {poppler_document_create_dests_tree (document), g_tree_destroy}; | |
126 | 128 | dests.clear (); |
127 | 129 | |
128 | 130 | g_tree_foreach (tree.get (), walk_entry, this); |
0 | 0 | // This file is part of Extract PDFmark. |
1 | 1 | // |
2 | // Copyright (C) 2016 Masamichi Hosoda | |
2 | // Copyright (C) 2016, 2019 Masamichi Hosoda | |
3 | 3 | // |
4 | 4 | // Extract PDFmark is free software: you can redistribute it and/or modify |
5 | 5 | // it under the terms of the GNU General Public License as published by |
20 | 20 | |
21 | 21 | #include <iostream> |
22 | 22 | #include <memory> |
23 | #include <sstream> | |
23 | 24 | #include <string> |
24 | 25 | #include <poppler.h> |
25 | 26 | |
87 | 88 | } |
88 | 89 | return true; |
89 | 90 | } |
91 | ||
92 | std::string poppler_glib::version (void) | |
93 | { | |
94 | std::stringstream ss; | |
95 | ||
96 | ss << "Compiled with poppler-glib " | |
97 | << POPPLER_MAJOR_VERSION << "." | |
98 | << POPPLER_MINOR_VERSION << "." | |
99 | << POPPLER_MICRO_VERSION | |
100 | << ", glib " | |
101 | << GLIB_MAJOR_VERSION << "." | |
102 | << GLIB_MINOR_VERSION << "." | |
103 | << GLIB_MICRO_VERSION | |
104 | << ".\nRunning with poppler-glib " | |
105 | << poppler_get_version () | |
106 | << ", glib " | |
107 | << glib_major_version << "." | |
108 | << glib_minor_version << "." | |
109 | << glib_micro_version | |
110 | << ".\n"; | |
111 | ||
112 | return ss.str (); | |
113 | } |
0 | 0 | // This file is part of Extract PDFmark. |
1 | 1 | // |
2 | // Copyright (C) 2016 Masamichi Hosoda | |
2 | // Copyright (C) 2016, 2019 Masamichi Hosoda | |
3 | 3 | // |
4 | 4 | // Extract PDFmark is free software: you can redistribute it and/or modify |
5 | 5 | // it under the terms of the GNU General Public License as published by |
28 | 28 | bool open (const std::string &pdf_filename); |
29 | 29 | std::string pagemode (void); |
30 | 30 | std::string destname (void); |
31 | std::string version (void); | |
31 | 32 | |
32 | 33 | ~poppler_glib () |
33 | 34 | { |
38 | 39 | static gboolean walk_entry (gpointer key, |
39 | 40 | gpointer value, |
40 | 41 | gpointer user_data); |
41 | bool walk (GBytes *name, PopplerDest *dest); | |
42 | bool walk (gchar *name, PopplerDest *dest); | |
42 | 43 | |
43 | 44 | PopplerDocument *document = nullptr; |
44 | 45 | std::string dests; |