Revision 9212
org.gvsig.pdf/tags/org.gvsig.pdf-1.0.146/pom.xml | ||
---|---|---|
1 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|
2 |
|
|
3 |
<modelVersion>4.0.0</modelVersion> |
|
4 |
<parent> |
|
5 |
<groupId>org.gvsig</groupId> |
|
6 |
<artifactId>org.gvsig.desktop</artifactId> |
|
7 |
<version>2.0.438</version> |
|
8 |
</parent> |
|
9 |
<artifactId>org.gvsig.pdf</artifactId> |
|
10 |
<version>1.0.146</version> |
|
11 |
<packaging>pom</packaging> |
|
12 |
<name>${project.artifactId}</name> |
|
13 |
|
|
14 |
<url>https://devel.gvsig.org/svn/gvsig-projects-pool/${project.artifactId}/trunk/${project.artifactId}</url> |
|
15 |
|
|
16 |
<distributionManagement> |
|
17 |
<site> |
|
18 |
<id>gvsig-repository</id> |
|
19 |
<url>dav:https://devel.gvsig.org/sites/${project.artifactId}/${project.version}</url> |
|
20 |
</site> |
|
21 |
</distributionManagement> |
|
22 |
|
|
23 |
<scm> |
|
24 |
<connection>scm:svn:https://devel.gvsig.org/svn/gvsig-projects-pool/org.gvsig.pdf/tags/org.gvsig.pdf-1.0.146</connection> |
|
25 |
<developerConnection>scm:svn:https://devel.gvsig.org/svn/gvsig-projects-pool/org.gvsig.pdf/tags/org.gvsig.pdf-1.0.146</developerConnection> |
|
26 |
<url>https://devel.gvsig.org/svn/gvsig-projects-pool/org.gvsig.pdf/tags/org.gvsig.pdf-1.0.146</url> |
|
27 |
</scm> |
|
28 |
|
|
29 |
<developers> |
|
30 |
<developer> |
|
31 |
<id>jjdelcerro</id> |
|
32 |
<name>Joaquin Jose del Cerro</name> |
|
33 |
<email>jjdelcerro@gvsig.com</email> |
|
34 |
<roles> |
|
35 |
<role>Architect</role> |
|
36 |
<role>Developer</role> |
|
37 |
</roles> |
|
38 |
</developer> |
|
39 |
</developers> |
|
40 |
|
|
41 |
<repositories> |
|
42 |
<repository> |
|
43 |
<id>gvsig-public-http-repository</id> |
|
44 |
<name>gvSIG maven public HTTP repository</name> |
|
45 |
<url>http://devel.gvsig.org/m2repo/j2se</url> |
|
46 |
<releases> |
|
47 |
<enabled>true</enabled> |
|
48 |
<updatePolicy>daily</updatePolicy> |
|
49 |
<checksumPolicy>warn</checksumPolicy> |
|
50 |
</releases> |
|
51 |
<snapshots> |
|
52 |
<enabled>true</enabled> |
|
53 |
<updatePolicy>daily</updatePolicy> |
|
54 |
<checksumPolicy>warn</checksumPolicy> |
|
55 |
</snapshots> |
|
56 |
</repository> |
|
57 |
<!-- <repository> |
|
58 |
|
|
59 |
https://stackoverflow.com/questions/26993105/i-get-an-error-downloading-javax-media-jai-core1-1-3-from-maven-central |
|
60 |
|
|
61 |
<id>geotoolkit-org</id> |
|
62 |
<name>geotoolkit.org repository</name> |
|
63 |
<url>http://maven.geotoolkit.org/</url> |
|
64 |
</repository>--> |
|
65 |
</repositories> |
|
66 |
|
|
67 |
<build> |
|
68 |
<plugins> |
|
69 |
<plugin> |
|
70 |
<groupId>org.apache.maven.plugins</groupId> |
|
71 |
<artifactId>maven-release-plugin</artifactId> |
|
72 |
<configuration> |
|
73 |
<tagBase>https://devel.gvsig.org/svn/gvsig-projects-pool/${project.artifactId}/tags</tagBase> |
|
74 |
<goal>deploy</goal> |
|
75 |
</configuration> |
|
76 |
</plugin> |
|
77 |
</plugins> |
|
78 |
</build> |
|
79 |
|
|
80 |
|
|
81 |
<dependencyManagement> |
|
82 |
<dependencies> |
|
83 |
<dependency> |
|
84 |
<groupId>org.gvsig</groupId> |
|
85 |
<artifactId>org.gvsig.pdf.app.mainplugin</artifactId> |
|
86 |
<version>1.0.146</version> |
|
87 |
</dependency> |
|
88 |
<dependency> |
|
89 |
<groupId>org.gvsig</groupId> |
|
90 |
<artifactId>org.gvsig.pdf.lib.api</artifactId> |
|
91 |
<version>1.0.146</version> |
|
92 |
</dependency> |
|
93 |
<dependency> |
|
94 |
<groupId>org.gvsig</groupId> |
|
95 |
<artifactId>org.gvsig.pdf.lib.impl</artifactId> |
|
96 |
<version>1.0.146</version> |
|
97 |
</dependency> |
|
98 |
<dependency> |
|
99 |
<groupId>org.gvsig</groupId> |
|
100 |
<artifactId>org.gvsig.pdf.swing.api</artifactId> |
|
101 |
<version>1.0.146</version> |
|
102 |
</dependency> |
|
103 |
<dependency> |
|
104 |
<groupId>org.gvsig</groupId> |
|
105 |
<artifactId>org.gvsig.pdf.swing.impl</artifactId> |
|
106 |
<version>1.0.146</version> |
|
107 |
</dependency> |
|
108 |
<dependency> |
|
109 |
<groupId>org.icepdf.os</groupId> |
|
110 |
<artifactId>icepdf-core</artifactId> |
|
111 |
<version>6.2.2</version> |
|
112 |
<exclusions> |
|
113 |
<exclusion> |
|
114 |
<groupId>batik</groupId> |
|
115 |
<artifactId>batik-awt-util</artifactId> |
|
116 |
</exclusion> |
|
117 |
<exclusion> |
|
118 |
<groupId>batik</groupId> |
|
119 |
<artifactId>batik-dom</artifactId> |
|
120 |
</exclusion> |
|
121 |
<exclusion> |
|
122 |
<groupId>batik</groupId> |
|
123 |
<artifactId>batik-svg-dom</artifactId> |
|
124 |
</exclusion> |
|
125 |
<exclusion> |
|
126 |
<groupId>batik</groupId> |
|
127 |
<artifactId>batik-svggen</artifactId> |
|
128 |
</exclusion> |
|
129 |
<exclusion> |
|
130 |
<groupId>batik</groupId> |
|
131 |
<artifactId>batik-util</artifactId> |
|
132 |
</exclusion> |
|
133 |
<exclusion> |
|
134 |
<groupId>batik</groupId> |
|
135 |
<artifactId>batik-xml</artifactId> |
|
136 |
</exclusion> |
|
137 |
<!-- |
|
138 |
<exclusion> |
|
139 |
<groupId>javax.media</groupId> |
|
140 |
<artifactId>jai_core</artifactId> |
|
141 |
</exclusion> |
|
142 |
--> |
|
143 |
</exclusions> |
|
144 |
</dependency> |
|
145 |
<dependency> |
|
146 |
<groupId>org.icepdf.os</groupId> |
|
147 |
<artifactId>icepdf-viewer</artifactId> |
|
148 |
<version>6.2.2</version> |
|
149 |
<exclusions> |
|
150 |
<exclusion> |
|
151 |
<groupId>batik</groupId> |
|
152 |
<artifactId>batik-awt-util</artifactId> |
|
153 |
</exclusion> |
|
154 |
<exclusion> |
|
155 |
<groupId>batik</groupId> |
|
156 |
<artifactId>batik-dom</artifactId> |
|
157 |
</exclusion> |
|
158 |
<exclusion> |
|
159 |
<groupId>batik</groupId> |
|
160 |
<artifactId>batik-svg-dom</artifactId> |
|
161 |
</exclusion> |
|
162 |
<exclusion> |
|
163 |
<groupId>batik</groupId> |
|
164 |
<artifactId>batik-svggen</artifactId> |
|
165 |
</exclusion> |
|
166 |
<exclusion> |
|
167 |
<groupId>batik</groupId> |
|
168 |
<artifactId>batik-util</artifactId> |
|
169 |
</exclusion> |
|
170 |
<exclusion> |
|
171 |
<groupId>batik</groupId> |
|
172 |
<artifactId>batik-xml</artifactId> |
|
173 |
</exclusion> |
|
174 |
<!-- |
|
175 |
<exclusion> |
|
176 |
<groupId>javax.media</groupId> |
|
177 |
<artifactId>jai_core</artifactId> |
|
178 |
</exclusion> |
|
179 |
--> |
|
180 |
</exclusions> |
|
181 |
</dependency> |
|
182 |
<!-- |
|
183 |
<dependency> |
|
184 |
<groupId>com.cosium.jai-imageio</groupId> |
|
185 |
<artifactId>jai-imageio-core</artifactId> |
|
186 |
<version>1.3.0.1</version> |
|
187 |
</dependency> |
|
188 |
--> |
|
189 |
<dependency> |
|
190 |
<groupId>org.bouncycastle</groupId> |
|
191 |
<artifactId>bcpkix-jdk15on</artifactId> |
|
192 |
<version>1.54</version> |
|
193 |
</dependency> |
|
194 |
<dependency> |
|
195 |
<groupId>org.bouncycastle</groupId> |
|
196 |
<artifactId>bcprov-jdk15on</artifactId> |
|
197 |
<version>1.54</version> |
|
198 |
</dependency> |
|
199 |
<dependency> |
|
200 |
<groupId>org.bouncycastle</groupId> |
|
201 |
<artifactId>bcprov-ext-jdk15on</artifactId> |
|
202 |
<version>1.54</version> |
|
203 |
</dependency> |
|
204 |
<!-- <dependency> |
|
205 |
<groupId>com.itextpdf</groupId> |
|
206 |
<artifactId>itextpdf</artifactId> |
|
207 |
<version>5.5.8</version> |
|
208 |
</dependency>--> |
|
209 |
<dependency> |
|
210 |
<groupId>org.apache.pdfbox</groupId> |
|
211 |
<artifactId>pdfbox</artifactId> |
|
212 |
<version>2.0.16</version> |
|
213 |
</dependency> |
|
214 |
<dependency> |
|
215 |
<groupId>org.apache.pdfbox</groupId> |
|
216 |
<artifactId>fontbox</artifactId> |
|
217 |
<version>2.0.16</version> |
|
218 |
</dependency> |
|
219 |
<dependency> |
|
220 |
<groupId>de.rototor.pdfbox</groupId> |
|
221 |
<artifactId>graphics2d</artifactId> |
|
222 |
<version>0.24</version> |
|
223 |
</dependency> |
|
224 |
<dependency> |
|
225 |
<groupId>org.apache.pdfbox</groupId> |
|
226 |
<artifactId>xmpbox</artifactId> |
|
227 |
<version>2.0.16</version> |
|
228 |
<type>bundle</type> |
|
229 |
</dependency> |
|
230 |
|
|
231 |
<dependency> |
|
232 |
<groupId>com.openhtmltopdf</groupId> |
|
233 |
<artifactId>openhtmltopdf-pdfbox</artifactId> |
|
234 |
<version>1.0.10</version> |
|
235 |
</dependency> |
|
236 |
<dependency> |
|
237 |
<groupId>com.openhtmltopdf</groupId> |
|
238 |
<artifactId>openhtmltopdf-objects</artifactId> |
|
239 |
<version>1.0.10</version> |
|
240 |
</dependency> |
|
241 |
<dependency> |
|
242 |
<groupId>com.openhtmltopdf</groupId> |
|
243 |
<artifactId>openhtmltopdf-core</artifactId> |
|
244 |
<version>1.0.10</version> |
|
245 |
</dependency> |
|
246 |
<dependency> |
|
247 |
<groupId>com.openhtmltopdf</groupId> |
|
248 |
<artifactId>openhtmltopdf-java2d</artifactId> |
|
249 |
<version>1.0.10</version> |
|
250 |
</dependency> |
|
251 |
<dependency> |
|
252 |
<groupId>com.openhtmltopdf</groupId> |
|
253 |
<artifactId>openhtmltopdf-slf4j</artifactId> |
|
254 |
<version>1.0.10</version> |
|
255 |
</dependency> |
|
256 |
<dependency> |
|
257 |
<groupId>com.openhtmltopdf</groupId> |
|
258 |
<artifactId>openhtmltopdf-rtl-support</artifactId> |
|
259 |
<version>1.0.10</version> |
|
260 |
</dependency> |
|
261 |
<dependency> |
|
262 |
<groupId>com.openhtmltopdf</groupId> |
|
263 |
<artifactId>openhtmltopdf-svg-support</artifactId> |
|
264 |
<version>1.0.10</version> |
|
265 |
</dependency> |
|
266 |
<dependency> |
|
267 |
<groupId>org.jsoup</groupId> |
|
268 |
<artifactId>jsoup</artifactId> |
|
269 |
<version>1.13.1</version> |
|
270 |
</dependency> |
|
271 |
|
|
272 |
</dependencies> |
|
273 |
</dependencyManagement> |
|
274 |
|
|
275 |
<modules> |
|
276 |
<module>org.gvsig.pdf.lib</module> |
|
277 |
<module>org.gvsig.pdf.swing</module> |
|
278 |
<module>org.gvsig.pdf.app</module> |
|
279 |
</modules> |
|
280 |
|
|
281 |
</project> |
org.gvsig.pdf/tags/org.gvsig.pdf-1.0.146/org.gvsig.pdf.app/pom.xml | ||
---|---|---|
1 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|
2 |
<modelVersion>4.0.0</modelVersion> |
|
3 |
<parent> |
|
4 |
<groupId>org.gvsig</groupId> |
|
5 |
<artifactId>org.gvsig.pdf</artifactId> |
|
6 |
<version>1.0.146</version> |
|
7 |
</parent> |
|
8 |
<artifactId>org.gvsig.pdf.app</artifactId> |
|
9 |
<packaging>pom</packaging> |
|
10 |
<name>${project.artifactId}</name> |
|
11 |
<modules> |
|
12 |
<module>org.gvsig.pdf.app.mainplugin</module> |
|
13 |
</modules> |
|
14 |
</project> |
org.gvsig.pdf/tags/org.gvsig.pdf-1.0.146/org.gvsig.pdf.app/org.gvsig.pdf.app.mainplugin/buildNumber.properties | ||
---|---|---|
1 |
#Sun Nov 26 21:15:06 CET 2023 |
|
2 |
buildNumber=149 |
org.gvsig.pdf/tags/org.gvsig.pdf-1.0.146/org.gvsig.pdf.app/org.gvsig.pdf.app.mainplugin/src/main/resources-plugin/i18n/text.properties | ||
---|---|---|
1 |
#Translations for language [es] |
|
2 |
#Thu Nov 20 10:10:09 CET 2014 |
|
3 |
_Open=Abrir |
|
4 |
_Print_form=Imprimir formulario |
|
5 |
_Simple_form=Formulario sencillo |
|
6 |
_Reports=Informes |
|
7 |
_Copy_template=Copiar plantilla |
org.gvsig.pdf/tags/org.gvsig.pdf-1.0.146/org.gvsig.pdf.app/org.gvsig.pdf.app.mainplugin/src/main/resources-plugin/i18n/text_en.properties | ||
---|---|---|
1 |
#Translations for language [en] |
|
2 |
#Thu Nov 20 10:10:15 CET 2014 |
|
3 |
_Open=Open |
|
4 |
_Print_form=Print form |
|
5 |
_Simple_form=Simple form |
|
6 |
_Reports=Reports |
|
7 |
_Copy_template=Copy template |
org.gvsig.pdf/tags/org.gvsig.pdf-1.0.146/org.gvsig.pdf.app/org.gvsig.pdf.app.mainplugin/src/main/resources-plugin/config.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ISO-8859-1"?> |
|
2 |
<!-- gvSIG. Desktop Geographic Information System. Copyright (C) 2007-2014 gvSIG |
|
3 |
Association. This program is free software; you can redistribute it and/or modify |
|
4 |
it under the terms of the GNU General Public License as published by the Free Software |
|
5 |
Foundation; either version 3 of the License, or (at your option) any later version. |
|
6 |
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; |
|
7 |
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR |
|
8 |
PURPOSE. See the GNU General Public License for more details. You should have received |
|
9 |
a copy of the GNU General Public License along with this program; if not, write to |
|
10 |
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, |
|
11 |
USA. For any additional information, do not hesitate to contact us at info AT gvsig.com, |
|
12 |
or visit our website www.gvsig.com. --> |
|
13 |
<plugin-config> |
|
14 |
<depends plugin-name="org.gvsig.app.mainplugin" /> |
|
15 |
<resourceBundle name="text" /> |
|
16 |
<libraries library-dir="lib" /> |
|
17 |
<extensions> |
|
18 |
|
|
19 |
|
|
20 |
<extension class-name="org.gvsig.pdf.app.mainplugin.PDFExtension" |
|
21 |
description="" active="true" priority="1"> |
|
22 |
|
|
23 |
<action |
|
24 |
name= "show-pdf" |
|
25 |
label="_Show_pdf" |
|
26 |
tooltip="_Show_pdf" |
|
27 |
action-command="show-pdf" |
|
28 |
icon="show-pdf" |
|
29 |
position="1" |
|
30 |
accelerator="" |
|
31 |
/> |
|
32 |
|
|
33 |
</extension> |
|
34 |
|
|
35 |
|
|
36 |
</extensions> |
|
37 |
</plugin-config> |
org.gvsig.pdf/tags/org.gvsig.pdf-1.0.146/org.gvsig.pdf.app/org.gvsig.pdf.app.mainplugin/src/main/assembly/gvsig-plugin-package.xml | ||
---|---|---|
1 |
<!-- |
|
2 |
|
|
3 |
gvSIG. Desktop Geographic Information System. |
|
4 |
|
|
5 |
Copyright (C) 2007-2013 gvSIG Association. |
|
6 |
|
|
7 |
This program is free software; you can redistribute it and/or |
|
8 |
modify it under the terms of the GNU General Public License |
|
9 |
as published by the Free Software Foundation; either version 3 |
|
10 |
of the License, or (at your option) any later version. |
|
11 |
|
|
12 |
This program is distributed in the hope that it will be useful, |
|
13 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
15 |
GNU General Public License for more details. |
|
16 |
|
|
17 |
You should have received a copy of the GNU General Public License |
|
18 |
along with this program; if not, write to the Free Software |
|
19 |
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
20 |
MA 02110-1301, USA. |
|
21 |
|
|
22 |
For any additional information, do not hesitate to contact us |
|
23 |
at info AT gvsig.com, or visit our website www.gvsig.com. |
|
24 |
|
|
25 |
--> |
|
26 |
<assembly> |
|
27 |
<id>gvsig-plugin-package</id> |
|
28 |
<formats> |
|
29 |
<format>zip</format> |
|
30 |
</formats> |
|
31 |
<baseDirectory>${project.artifactId}</baseDirectory> |
|
32 |
<includeBaseDirectory>true</includeBaseDirectory> |
|
33 |
<files> |
|
34 |
<file> |
|
35 |
<source>target/${project.artifactId}-${project.version}.jar</source> |
|
36 |
<outputDirectory>lib</outputDirectory> |
|
37 |
</file> |
|
38 |
<file> |
|
39 |
<source>target/package.info</source> |
|
40 |
</file> |
|
41 |
</files> |
|
42 |
|
|
43 |
<fileSets> |
|
44 |
<fileSet> |
|
45 |
<directory>src/main/resources-plugin</directory> |
|
46 |
<outputDirectory>.</outputDirectory> |
|
47 |
</fileSet> |
|
48 |
</fileSets> |
|
49 |
|
|
50 |
|
|
51 |
<dependencySets> |
|
52 |
<dependencySet> |
|
53 |
<useProjectArtifact>false</useProjectArtifact> |
|
54 |
<useTransitiveDependencies>false</useTransitiveDependencies> |
|
55 |
<outputDirectory>lib</outputDirectory> |
|
56 |
<includes> |
|
57 |
<include>org.gvsig:org.gvsig.pdf.lib.api</include> |
|
58 |
<include>org.gvsig:org.gvsig.pdf.lib.impl</include> |
|
59 |
<include>org.gvsig:org.gvsig.pdf.swing.api</include> |
|
60 |
<include>org.gvsig:org.gvsig.pdf.swing.impl</include> |
|
61 |
<include>org.icepdf.os:icepdf-viewer</include> |
|
62 |
<include>org.icepdf.os:icepdf-core</include> |
|
63 |
|
|
64 |
<include>javax.media:jai_core</include> |
|
65 |
<include>org.bouncycastle:bcpkix-jdk15on</include> |
|
66 |
|
|
67 |
<include>org.apache.pdfbox:pdfbox</include> |
|
68 |
<include>de.rototor.pdfbox:graphics2d</include> |
|
69 |
<include>org.apache.pdfbox:xmpbox</include> |
|
70 |
<include>org.apache.pdfbox:fontbox</include> |
|
71 |
<include>org.apache.tika:tika-core</include> |
|
72 |
|
|
73 |
<include>com.openhtmltopdf:openhtmltopdf-objects</include> |
|
74 |
<include>com.openhtmltopdf:openhtmltopdf-core</include> |
|
75 |
<include>com.openhtmltopdf:openhtmltopdf-java2d</include> |
|
76 |
<include>com.openhtmltopdf:openhtmltopdf-slf4j</include> |
|
77 |
<include>com.openhtmltopdf:openhtmltopdf-rtl-support</include> |
|
78 |
<include>com.openhtmltopdf:openhtmltopdf-svg-support</include> |
|
79 |
<include>com.openhtmltopdf:openhtmltopdf-pdfbox</include> |
|
80 |
|
|
81 |
<include>org.jsoup:jsoup</include> |
|
82 |
|
|
83 |
<!-- |
|
84 |
<include>com.ibm.icu:icu4j</include> |
|
85 |
<include>org.apache.xmlgraphics:batik-transcoder</include> |
|
86 |
<include>org.apache.xmlgraphics:batik-shared-resources</include> |
|
87 |
<include>org.apache.xmlgraphics:batik-svggen</include> |
|
88 |
<include>org.apache.xmlgraphics:batik-codec</include> |
|
89 |
<include>org.apache.xmlgraphics:xmlgraphics-commons</include> |
|
90 |
--> |
|
91 |
|
|
92 |
|
|
93 |
|
|
94 |
<!-- |
|
95 |
Estos dos jars ya se los esta llevando andami |
|
96 |
<include>org.bouncycastle:bcprov-jdk15on</include> |
|
97 |
<include>org.bouncycastle:bcprov-ext-jdk15on</include> |
|
98 |
--> |
|
99 |
</includes> |
|
100 |
</dependencySet> |
|
101 |
</dependencySets> |
|
102 |
|
|
103 |
</assembly> |
|
104 |
|
org.gvsig.pdf/tags/org.gvsig.pdf-1.0.146/org.gvsig.pdf.app/org.gvsig.pdf.app.mainplugin/src/main/java/org/gvsig/pdf/app/mainplugin/PDFExtension.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 3 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
package org.gvsig.pdf.app.mainplugin; |
|
25 |
|
|
26 |
import javax.swing.JOptionPane; |
|
27 |
import org.apache.commons.lang3.StringUtils; |
|
28 |
import org.gvsig.andami.plugins.Extension; |
|
29 |
import org.gvsig.pdf.lib.api.PDFDocument; |
|
30 |
import org.gvsig.pdf.lib.api.PDFLocator; |
|
31 |
import org.gvsig.pdf.lib.api.PDFManager; |
|
32 |
import org.gvsig.pdf.swing.api.PDFSwingLocator; |
|
33 |
import org.gvsig.pdf.swing.api.PDFSwingManager; |
|
34 |
import org.gvsig.pdf.swing.api.PDFViewer; |
|
35 |
import org.gvsig.tools.ToolsLocator; |
|
36 |
import org.gvsig.tools.arguments.Arguments; |
|
37 |
import org.gvsig.tools.exception.BaseException; |
|
38 |
import org.gvsig.tools.i18n.I18nManager; |
|
39 |
import org.gvsig.tools.swing.api.ToolsSwingLocator; |
|
40 |
import org.gvsig.tools.swing.api.threadsafedialogs.ThreadSafeDialogsManager; |
|
41 |
import org.gvsig.tools.swing.api.windowmanager.WindowManager; |
|
42 |
|
|
43 |
/** |
|
44 |
* |
|
45 |
* @author jjdelcerro |
|
46 |
*/ |
|
47 |
public class PDFExtension extends Extension { |
|
48 |
|
|
49 |
@Override |
|
50 |
public void initialize() { |
|
51 |
|
|
52 |
} |
|
53 |
|
|
54 |
@Override |
|
55 |
public void postInitialize() { |
|
56 |
} |
|
57 |
|
|
58 |
@Override |
|
59 |
public void execute(String action) { |
|
60 |
} |
|
61 |
|
|
62 |
@Override |
|
63 |
public void execute(String command, Object[] args) { |
|
64 |
if(StringUtils.equalsIgnoreCase(command, "show-pdf")) { |
|
65 |
Arguments arguments = Arguments.create(args); |
|
66 |
String title = (String) arguments.get("title", "PDF"); |
|
67 |
WindowManager.MODE mode = (WindowManager.MODE) arguments.get("mode", WindowManager.MODE.WINDOW); |
|
68 |
if(arguments.contains("pdfdoc")){ |
|
69 |
PDFDocument pdfdoc = (PDFDocument) arguments.get("pdfdoc"); |
|
70 |
showPdf(pdfdoc, title, mode); |
|
71 |
return; |
|
72 |
} |
|
73 |
if(arguments.contains("source")){ |
|
74 |
Object source = arguments.get("source"); |
|
75 |
showPdf(source, title, mode); |
|
76 |
return; |
|
77 |
} |
|
78 |
} |
|
79 |
} |
|
80 |
|
|
81 |
|
|
82 |
|
|
83 |
@Override |
|
84 |
public boolean isEnabled() { |
|
85 |
return true; |
|
86 |
} |
|
87 |
|
|
88 |
@Override |
|
89 |
public boolean isVisible() { |
|
90 |
return false; |
|
91 |
} |
|
92 |
|
|
93 |
public void showPdf(Object source, String title, WindowManager.MODE mode) { |
|
94 |
PDFManager pdfManager = PDFLocator.getPDFManager(); |
|
95 |
PDFDocument pdfDoc = pdfManager.createPDFDocument(); |
|
96 |
pdfDoc.setSource(source); |
|
97 |
showPdf(pdfDoc, title, mode); |
|
98 |
} |
|
99 |
|
|
100 |
public void showPdf(PDFDocument pdfDoc, String title, WindowManager.MODE mode) { |
|
101 |
try { |
|
102 |
|
|
103 |
final PDFSwingManager pdfSwingManager = PDFSwingLocator.getPDFSwingManager(); |
|
104 |
PDFViewer viewer = pdfSwingManager.createPDFViewer(); |
|
105 |
viewer.put(pdfDoc); |
|
106 |
viewer.setMode(PDFViewer.MODE_LIGHT); |
|
107 |
WindowManager winManager = ToolsSwingLocator.getWindowManager(); |
|
108 |
winManager.showWindow(viewer.asJComponent(), title, mode); |
|
109 |
} catch (Exception ex) { |
|
110 |
logger.warn("Can't show Pdf.'", ex); |
|
111 |
I18nManager i18n = ToolsLocator.getI18nManager(); |
|
112 |
ThreadSafeDialogsManager dialogs = ToolsSwingLocator.getThreadSafeDialogsManager(); |
|
113 |
dialogs.messageDialog( |
|
114 |
i18n.getTranslation("_Cant_show_pdf") + ")\n\n" + BaseException.getMessageStack(ex, 0), |
|
115 |
i18n.getTranslation("_Show_pdf"), |
|
116 |
JOptionPane.WARNING_MESSAGE |
|
117 |
); |
|
118 |
} |
|
119 |
|
|
120 |
} |
|
121 |
} |
org.gvsig.pdf/tags/org.gvsig.pdf-1.0.146/org.gvsig.pdf.app/org.gvsig.pdf.app.mainplugin/pom.xml | ||
---|---|---|
1 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|
2 |
<modelVersion>4.0.0</modelVersion> |
|
3 |
<parent> |
|
4 |
<groupId>org.gvsig</groupId> |
|
5 |
<artifactId>org.gvsig.pdf.app</artifactId> |
|
6 |
<version>1.0.146</version> |
|
7 |
</parent> |
|
8 |
<artifactId>org.gvsig.pdf.app.mainplugin</artifactId> |
|
9 |
<name>${project.artifactId}</name> |
|
10 |
<dependencies> |
|
11 |
<dependency> |
|
12 |
<groupId>org.gvsig</groupId> |
|
13 |
<artifactId>org.gvsig.app.mainplugin</artifactId> |
|
14 |
<scope>compile</scope> |
|
15 |
</dependency> |
|
16 |
<dependency> |
|
17 |
<groupId>org.gvsig</groupId> |
|
18 |
<artifactId>org.gvsig.andami</artifactId> |
|
19 |
<scope>compile</scope> |
|
20 |
</dependency> |
|
21 |
<dependency> |
|
22 |
<groupId>org.gvsig</groupId> |
|
23 |
<artifactId>org.gvsig.pdf.lib.api</artifactId> |
|
24 |
<scope>compile</scope> |
|
25 |
</dependency> |
|
26 |
<dependency> |
|
27 |
<groupId>org.gvsig</groupId> |
|
28 |
<artifactId>org.gvsig.pdf.lib.impl</artifactId> |
|
29 |
<scope>runtime</scope> |
|
30 |
</dependency> |
|
31 |
<dependency> |
|
32 |
<groupId>org.gvsig</groupId> |
|
33 |
<artifactId>org.gvsig.pdf.swing.api</artifactId> |
|
34 |
<scope>compile</scope> |
|
35 |
</dependency> |
|
36 |
<dependency> |
|
37 |
<groupId>org.gvsig</groupId> |
|
38 |
<artifactId>org.gvsig.pdf.swing.impl</artifactId> |
|
39 |
<scope>runtime</scope> |
|
40 |
</dependency> |
|
41 |
<dependency> |
|
42 |
<groupId>org.icepdf.os</groupId> |
|
43 |
<artifactId>icepdf-core</artifactId> |
|
44 |
<scope>runtime</scope> |
|
45 |
</dependency> |
|
46 |
<dependency> |
|
47 |
<groupId>org.icepdf.os</groupId> |
|
48 |
<artifactId>icepdf-viewer</artifactId> |
|
49 |
<scope>runtime</scope> |
|
50 |
</dependency> |
|
51 |
<dependency> |
|
52 |
<groupId>javax.media</groupId> |
|
53 |
<artifactId>jai_core</artifactId> |
|
54 |
<scope>runtime</scope> |
|
55 |
</dependency> |
|
56 |
<dependency> |
|
57 |
<groupId>org.jsoup</groupId> |
|
58 |
<artifactId>jsoup</artifactId> |
|
59 |
<scope>runtime</scope> |
|
60 |
</dependency> |
|
61 |
<dependency> |
|
62 |
<groupId>org.bouncycastle</groupId> |
|
63 |
<artifactId>bcpkix-jdk15on</artifactId> |
|
64 |
<scope>runtime</scope> |
|
65 |
</dependency> |
|
66 |
<dependency> |
|
67 |
<groupId>org.bouncycastle</groupId> |
|
68 |
<artifactId>bcprov-jdk15on</artifactId> |
|
69 |
<scope>runtime</scope> |
|
70 |
</dependency> |
|
71 |
<dependency> |
|
72 |
<groupId>org.bouncycastle</groupId> |
|
73 |
<artifactId>bcprov-ext-jdk15on</artifactId> |
|
74 |
<scope>runtime</scope> |
|
75 |
</dependency> |
|
76 |
<dependency> |
|
77 |
<groupId>org.apache.pdfbox</groupId> |
|
78 |
<artifactId>pdfbox</artifactId> |
|
79 |
<scope>runtime</scope> |
|
80 |
</dependency> |
|
81 |
<dependency> |
|
82 |
<groupId>org.apache.pdfbox</groupId> |
|
83 |
<artifactId>fontbox</artifactId> |
|
84 |
<scope>runtime</scope> |
|
85 |
</dependency> |
|
86 |
<dependency> |
|
87 |
<groupId>de.rototor.pdfbox</groupId> |
|
88 |
<artifactId>graphics2d</artifactId> |
|
89 |
<scope>runtime</scope> |
|
90 |
</dependency> |
|
91 |
<dependency> |
|
92 |
<groupId>org.apache.tika</groupId> |
|
93 |
<artifactId>tika-core</artifactId> |
|
94 |
</dependency> |
|
95 |
|
|
96 |
<dependency> |
|
97 |
<groupId>com.openhtmltopdf</groupId> |
|
98 |
<artifactId>openhtmltopdf-objects</artifactId> |
|
99 |
<scope>runtime</scope> |
|
100 |
</dependency> |
|
101 |
<dependency> |
|
102 |
<groupId>com.openhtmltopdf</groupId> |
|
103 |
<artifactId>openhtmltopdf-core</artifactId> |
|
104 |
<scope>runtime</scope> |
|
105 |
</dependency> |
|
106 |
<dependency> |
|
107 |
<groupId>com.openhtmltopdf</groupId> |
|
108 |
<artifactId>openhtmltopdf-java2d</artifactId> |
|
109 |
<scope>runtime</scope> |
|
110 |
</dependency> |
|
111 |
<dependency> |
|
112 |
<groupId>com.openhtmltopdf</groupId> |
|
113 |
<artifactId>openhtmltopdf-slf4j</artifactId> |
|
114 |
<scope>runtime</scope> |
|
115 |
</dependency> |
|
116 |
<dependency> |
|
117 |
<groupId>com.openhtmltopdf</groupId> |
|
118 |
<artifactId>openhtmltopdf-rtl-support</artifactId> |
|
119 |
<scope>runtime</scope> |
|
120 |
</dependency> |
|
121 |
<dependency> |
|
122 |
<groupId>com.openhtmltopdf</groupId> |
|
123 |
<artifactId>openhtmltopdf-svg-support</artifactId> |
|
124 |
<scope>runtime</scope> |
|
125 |
</dependency> |
|
126 |
<dependency> |
|
127 |
<groupId>com.openhtmltopdf</groupId> |
|
128 |
<artifactId>openhtmltopdf-pdfbox</artifactId> |
|
129 |
<scope>compile</scope> |
|
130 |
</dependency> |
|
131 |
<dependency> |
|
132 |
<groupId>org.apache.pdfbox</groupId> |
|
133 |
<artifactId>xmpbox</artifactId> |
|
134 |
<scope>runtime</scope> |
|
135 |
<!--<type>bundle</type>--> |
|
136 |
<version>2.0.16</version> |
|
137 |
</dependency> |
|
138 |
|
|
139 |
<!-- |
|
140 |
<dependency> |
|
141 |
<groupId>com.ibm.icu</groupId> |
|
142 |
<artifactId>icu4j</artifactId> |
|
143 |
<scope>runtime</scope> |
|
144 |
</dependency> |
|
145 |
<dependency> |
|
146 |
<groupId>org.apache.xmlgraphics</groupId> |
|
147 |
<artifactId>batik-transcoder</artifactId> |
|
148 |
<scope>runtime</scope> |
|
149 |
</dependency> |
|
150 |
<dependency> |
|
151 |
<groupId>org.apache.xmlgraphics</groupId> |
|
152 |
<artifactId>batik-shared-resources</artifactId> |
|
153 |
<scope>runtime</scope> |
|
154 |
</dependency> |
|
155 |
<dependency> |
|
156 |
<groupId>org.apache.xmlgraphics</groupId> |
|
157 |
<artifactId>batik-svggen</artifactId> |
|
158 |
<scope>runtime</scope> |
|
159 |
</dependency> |
|
160 |
<dependency> |
|
161 |
<groupId>org.apache.xmlgraphics</groupId> |
|
162 |
<artifactId>batik-codec</artifactId> |
|
163 |
<scope>runtime</scope> |
|
164 |
</dependency> |
|
165 |
<dependency> |
|
166 |
<groupId>org.apache.xmlgraphics</groupId> |
|
167 |
<artifactId>xmlgraphics-commons</artifactId> |
|
168 |
<scope>runtime</scope> |
|
169 |
</dependency> |
|
170 |
--> |
|
171 |
</dependencies> |
|
172 |
|
|
173 |
<properties> |
|
174 |
<gvsig.package.info.state>testing</gvsig.package.info.state> |
|
175 |
<gvsig.package.info.official>true</gvsig.package.info.official> |
|
176 |
<gvsig.package.info.dependencies>required: org.gvsig.app -ge 2.2.0</gvsig.package.info.dependencies> |
|
177 |
<gvsig.package.info.categories /> |
|
178 |
<gvsig.package.info.name>PDF framework</gvsig.package.info.name> |
|
179 |
<gvsig.package.info.description>PDF framework and basic rules</gvsig.package.info.description> |
|
180 |
<gvsig.package.info.owner>gvSIG Association</gvsig.package.info.owner> |
|
181 |
<gvsig.package.info.javaVM>j1_8</gvsig.package.info.javaVM> |
|
182 |
<gvsig.package.info.sourcesURL>${project.scm.url}</gvsig.package.info.sourcesURL> |
|
183 |
<gvsig.package.info.poolURL>https://devel.gvsig.org/download/projects/gvsig-pdf/pool</gvsig.package.info.poolURL> |
|
184 |
</properties> |
|
185 |
|
|
186 |
</project> |
|
0 | 187 |
org.gvsig.pdf/tags/org.gvsig.pdf-1.0.146/org.gvsig.pdf.lib/org.gvsig.pdf.lib.impl/pom.xml | ||
---|---|---|
1 |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|
2 |
<modelVersion>4.0.0</modelVersion> |
|
3 |
<parent> |
|
4 |
<groupId>org.gvsig</groupId> |
|
5 |
<artifactId>org.gvsig.pdf.lib</artifactId> |
|
6 |
<version>1.0.146</version> |
|
7 |
</parent> |
|
8 |
<artifactId>org.gvsig.pdf.lib.impl</artifactId> |
|
9 |
<name>${project.artifactId}</name> |
|
10 |
<dependencies> |
|
11 |
<dependency> |
|
12 |
<groupId>org.gvsig</groupId> |
|
13 |
<artifactId>org.gvsig.pdf.lib.api</artifactId> |
|
14 |
<scope>compile</scope> |
|
15 |
</dependency> |
|
16 |
<dependency> |
|
17 |
<groupId>org.gvsig</groupId> |
|
18 |
<artifactId>org.gvsig.tools.swing.api</artifactId> |
|
19 |
<scope>compile</scope> |
|
20 |
</dependency> |
|
21 |
<dependency> |
|
22 |
<groupId>org.gvsig</groupId> |
|
23 |
<artifactId>org.gvsig.tools.swing.impl</artifactId> |
|
24 |
<scope>test</scope> |
|
25 |
</dependency> |
|
26 |
<dependency> |
|
27 |
<groupId>org.gvsig</groupId> |
|
28 |
<artifactId>org.gvsig.tools.lib</artifactId> |
|
29 |
<scope>test</scope> |
|
30 |
<type>test-jar</type> |
|
31 |
</dependency> |
|
32 |
<dependency> |
|
33 |
<groupId>org.gvsig</groupId> |
|
34 |
<artifactId>org.gvsig.fmap.dal.api</artifactId> |
|
35 |
<scope>compile</scope> |
|
36 |
</dependency> |
|
37 |
<dependency> |
|
38 |
<groupId>org.gvsig</groupId> |
|
39 |
<artifactId>org.gvsig.fmap.dal.swing.api</artifactId> |
|
40 |
<scope>compile</scope> |
|
41 |
</dependency> |
|
42 |
<dependency> |
|
43 |
<groupId>commons-codec</groupId> |
|
44 |
<artifactId>commons-codec</artifactId> |
|
45 |
<scope>compile</scope> |
|
46 |
</dependency> |
|
47 |
<!-- <dependency> |
|
48 |
<groupId>com.lowagie</groupId> |
|
49 |
<artifactId>itext</artifactId> |
|
50 |
<scope>compile</scope> |
|
51 |
</dependency>--> |
|
52 |
<dependency> |
|
53 |
<groupId>org.apache.pdfbox</groupId> |
|
54 |
<artifactId>pdfbox</artifactId> |
|
55 |
<scope>compile</scope> |
|
56 |
</dependency> |
|
57 |
<dependency> |
|
58 |
<groupId>de.rototor.pdfbox</groupId> |
|
59 |
<artifactId>graphics2d</artifactId> |
|
60 |
<scope>compile</scope> |
|
61 |
</dependency> |
|
62 |
<dependency> |
|
63 |
<groupId>org.apache.tika</groupId> |
|
64 |
<artifactId>tika-core</artifactId> |
|
65 |
<scope>compile</scope> |
|
66 |
</dependency> |
|
67 |
|
|
68 |
<dependency> |
|
69 |
<groupId>com.openhtmltopdf</groupId> |
|
70 |
<artifactId>openhtmltopdf-pdfbox</artifactId> |
|
71 |
<scope>compile</scope> |
|
72 |
</dependency> |
|
73 |
<dependency> |
|
74 |
<groupId>com.openhtmltopdf</groupId> |
|
75 |
<artifactId>openhtmltopdf-core</artifactId> |
|
76 |
<scope>compile</scope> |
|
77 |
</dependency> |
|
78 |
<dependency> |
|
79 |
<groupId>org.jsoup</groupId> |
|
80 |
<artifactId>jsoup</artifactId> |
|
81 |
<scope>compile</scope> |
|
82 |
</dependency> |
|
83 |
</dependencies> |
|
84 |
</project> |
org.gvsig.pdf/tags/org.gvsig.pdf-1.0.146/org.gvsig.pdf.lib/org.gvsig.pdf.lib.impl/src/test/java/org/gvsig/pdf/lib/impl/TestPDFToImage.java | ||
---|---|---|
1 |
package org.gvsig.pdf.lib.impl; |
|
2 |
/* |
|
3 |
* To change this license header, choose License Headers in Project Properties. |
|
4 |
* To change this template file, choose Tools | Templates |
|
5 |
* and open the template in the editor. |
|
6 |
*/ |
|
7 |
import java.io.InputStream; |
|
8 |
import org.gvsig.pdf.lib.api.PDFDocument; |
|
9 |
import org.gvsig.pdf.lib.api.PDFLocator; |
|
10 |
import org.gvsig.pdf.lib.api.PDFManager; |
|
11 |
import org.gvsig.tools.junit.AbstractLibraryAutoInitTestCase; |
|
12 |
|
|
13 |
/** |
|
14 |
* |
|
15 |
* @author fdiaz |
|
16 |
*/ |
|
17 |
public class TestPDFToImage extends AbstractLibraryAutoInitTestCase { |
|
18 |
|
|
19 |
@Override |
|
20 |
protected void doSetUp() throws Exception { |
|
21 |
} |
|
22 |
|
|
23 |
public void test1() { |
|
24 |
InputStream in = this.getClass().getResourceAsStream("21-262.pdf"); |
|
25 |
PDFManager manager = PDFLocator.getPDFManager(); |
|
26 |
PDFDocument pdfDoc = manager.createPDFDocument(); |
|
27 |
pdfDoc.setSource(in); |
|
28 |
assertEquals(1, pdfDoc.getNumberOfPages()); |
|
29 |
assertNotNull(pdfDoc.toImage(0)); |
|
30 |
} |
|
31 |
|
|
32 |
} |
org.gvsig.pdf/tags/org.gvsig.pdf-1.0.146/org.gvsig.pdf.lib/org.gvsig.pdf.lib.impl/src/main/resources/org/gvsig/pdf/lib/impl/dejavu/LICENSE | ||
---|---|---|
1 |
Fonts are (c) Bitstream (see below). DejaVu changes are in public domain. |
|
2 |
Glyphs imported from Arev fonts are (c) Tavmjong Bah (see below) |
|
3 |
|
|
4 |
Bitstream Vera Fonts Copyright |
|
5 |
------------------------------ |
|
6 |
|
|
7 |
Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Bitstream Vera is |
|
8 |
a trademark of Bitstream, Inc. |
|
9 |
|
|
10 |
Permission is hereby granted, free of charge, to any person obtaining a copy |
|
11 |
of the fonts accompanying this license ("Fonts") and associated |
|
12 |
documentation files (the "Font Software"), to reproduce and distribute the |
|
13 |
Font Software, including without limitation the rights to use, copy, merge, |
|
14 |
publish, distribute, and/or sell copies of the Font Software, and to permit |
|
15 |
persons to whom the Font Software is furnished to do so, subject to the |
|
16 |
following conditions: |
|
17 |
|
|
18 |
The above copyright and trademark notices and this permission notice shall |
|
19 |
be included in all copies of one or more of the Font Software typefaces. |
|
20 |
|
|
21 |
The Font Software may be modified, altered, or added to, and in particular |
|
22 |
the designs of glyphs or characters in the Fonts may be modified and |
|
23 |
additional glyphs or characters may be added to the Fonts, only if the fonts |
|
24 |
are renamed to names not containing either the words "Bitstream" or the word |
|
25 |
"Vera". |
|
26 |
|
|
27 |
This License becomes null and void to the extent applicable to Fonts or Font |
|
28 |
Software that has been modified and is distributed under the "Bitstream |
|
29 |
Vera" names. |
|
30 |
|
|
31 |
The Font Software may be sold as part of a larger software package but no |
|
32 |
copy of one or more of the Font Software typefaces may be sold by itself. |
|
33 |
|
|
34 |
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
|
35 |
OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, |
|
36 |
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, |
|
37 |
TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL BITSTREAM OR THE GNOME |
|
38 |
FOUNDATION BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING |
|
39 |
ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, |
|
40 |
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF |
|
41 |
THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE |
|
42 |
FONT SOFTWARE. |
|
43 |
|
|
44 |
Except as contained in this notice, the names of Gnome, the Gnome |
|
45 |
Foundation, and Bitstream Inc., shall not be used in advertising or |
|
46 |
otherwise to promote the sale, use or other dealings in this Font Software |
|
47 |
without prior written authorization from the Gnome Foundation or Bitstream |
|
48 |
Inc., respectively. For further information, contact: fonts at gnome dot |
|
49 |
org. |
|
50 |
|
|
51 |
Arev Fonts Copyright |
|
52 |
------------------------------ |
|
53 |
|
|
54 |
Copyright (c) 2006 by Tavmjong Bah. All Rights Reserved. |
|
55 |
|
|
56 |
Permission is hereby granted, free of charge, to any person obtaining |
|
57 |
a copy of the fonts accompanying this license ("Fonts") and |
|
58 |
associated documentation files (the "Font Software"), to reproduce |
|
59 |
and distribute the modifications to the Bitstream Vera Font Software, |
|
60 |
including without limitation the rights to use, copy, merge, publish, |
|
61 |
distribute, and/or sell copies of the Font Software, and to permit |
|
62 |
persons to whom the Font Software is furnished to do so, subject to |
|
63 |
the following conditions: |
|
64 |
|
|
65 |
The above copyright and trademark notices and this permission notice |
|
66 |
shall be included in all copies of one or more of the Font Software |
|
67 |
typefaces. |
|
68 |
|
|
69 |
The Font Software may be modified, altered, or added to, and in |
|
70 |
particular the designs of glyphs or characters in the Fonts may be |
|
71 |
modified and additional glyphs or characters may be added to the |
|
72 |
Fonts, only if the fonts are renamed to names not containing either |
|
73 |
the words "Tavmjong Bah" or the word "Arev". |
|
74 |
|
|
75 |
This License becomes null and void to the extent applicable to Fonts |
|
76 |
or Font Software that has been modified and is distributed under the |
|
77 |
"Tavmjong Bah Arev" names. |
|
78 |
|
|
79 |
The Font Software may be sold as part of a larger software package but |
|
80 |
no copy of one or more of the Font Software typefaces may be sold by |
|
81 |
itself. |
|
82 |
|
|
83 |
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
|
84 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF |
|
85 |
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT |
|
86 |
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL |
|
87 |
TAVMJONG BAH BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
|
88 |
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL |
|
89 |
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
|
90 |
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM |
|
91 |
OTHER DEALINGS IN THE FONT SOFTWARE. |
|
92 |
|
|
93 |
Except as contained in this notice, the name of Tavmjong Bah shall not |
|
94 |
be used in advertising or otherwise to promote the sale, use or other |
|
95 |
dealings in this Font Software without prior written authorization |
|
96 |
from Tavmjong Bah. For further information, contact: tavmjong @ free |
|
97 |
. fr. |
|
98 |
|
|
99 |
$Id: LICENSE 2133 2007-11-28 02:46:28Z lechimp $ |
org.gvsig.pdf/tags/org.gvsig.pdf-1.0.146/org.gvsig.pdf.lib/org.gvsig.pdf.lib.impl/src/main/resources/META-INF/services/org.gvsig.tools.library.Library | ||
---|---|---|
1 |
org.gvsig.pdf.lib.impl.PDFImplLibrary |
org.gvsig.pdf/tags/org.gvsig.pdf-1.0.146/org.gvsig.pdf.lib/org.gvsig.pdf.lib.impl/src/main/java/org/gvsig/pdf/lib/impl/DefaultPDFDocument.java | ||
---|---|---|
1 |
package org.gvsig.pdf.lib.impl; |
|
2 |
|
|
3 |
import com.openhtmltopdf.extend.FSSupplier; |
|
4 |
import com.openhtmltopdf.outputdevice.helper.BaseRendererBuilder.FontStyle; |
|
5 |
import com.openhtmltopdf.outputdevice.helper.ExternalResourceControlPriority; |
|
6 |
import com.openhtmltopdf.pdfboxout.PdfRendererBuilder; |
|
7 |
import java.awt.image.BufferedImage; |
|
8 |
import java.io.ByteArrayInputStream; |
|
9 |
import java.io.ByteArrayOutputStream; |
|
10 |
import java.io.File; |
|
11 |
import java.io.FileInputStream; |
|
12 |
import java.io.FileNotFoundException; |
|
13 |
import java.io.IOException; |
|
14 |
import java.io.InputStream; |
|
15 |
import java.net.URL; |
|
16 |
import org.gvsig.pdf.lib.api.PDFDocument; |
|
17 |
import org.slf4j.LoggerFactory; |
|
18 |
import org.apache.commons.codec.binary.Hex; |
|
19 |
import org.apache.commons.codec.DecoderException; |
|
20 |
import org.apache.commons.codec.binary.Base64; |
|
21 |
import org.apache.commons.io.IOUtils; |
|
22 |
import org.apache.commons.lang3.StringUtils; |
|
23 |
import org.apache.pdfbox.pdmodel.PDDocument; |
|
24 |
import org.apache.pdfbox.rendering.ImageType; |
|
25 |
import org.apache.pdfbox.rendering.PDFRenderer; |
|
26 |
import org.gvsig.tools.swing.api.SimpleImage; |
|
27 |
import org.gvsig.tools.swing.api.ToolsSwingLocator; |
|
28 |
import org.jsoup.Jsoup; |
|
29 |
import org.jsoup.helper.W3CDom; |
|
30 |
import org.jsoup.nodes.Document; |
|
31 |
|
|
32 |
/** |
|
33 |
* |
|
34 |
* @author gvSIG Team |
|
35 |
*/ |
|
36 |
@SuppressWarnings("UseSpecificCatch") |
|
37 |
public class DefaultPDFDocument implements PDFDocument { |
|
38 |
|
|
39 |
private static final org.slf4j.Logger LOGGER = LoggerFactory.getLogger(DefaultPDFDocument.class); |
|
40 |
private Object source; |
|
41 |
private int nummberOfPages; |
|
42 |
private PDDocument document; |
|
43 |
|
|
44 |
public DefaultPDFDocument() { |
|
45 |
this.nummberOfPages = -1; |
|
46 |
this.document = null; |
|
47 |
} |
|
48 |
|
|
49 |
@Override |
|
50 |
public void setSource(Object source) { |
|
51 |
this.source = source; |
|
52 |
this.nummberOfPages = -1; |
|
53 |
this.document = null; |
|
54 |
} |
|
55 |
|
|
56 |
@Override |
|
57 |
public InputStream getInputStream() throws IOException { |
|
58 |
InputStream is = null; |
|
59 |
if (source == null) { |
|
60 |
return null; |
|
61 |
} else if (source instanceof InputStream) { |
|
62 |
return (InputStream) source; |
|
63 |
} else if (source instanceof File) { |
|
64 |
File fileSource = (File) source; |
|
65 |
try { |
|
66 |
is = new FileInputStream(fileSource); |
|
67 |
} catch (IOException ex) { |
|
68 |
LOGGER.warn("Not been able to convert file to input stream", ex); |
|
69 |
throw new IOException(ex); |
|
70 |
} |
|
71 |
} else if (source instanceof URL) { |
|
72 |
URL urlSource = (URL) source; |
|
73 |
try { |
|
74 |
is = urlSource.openStream(); |
|
75 |
} catch (IOException ex) { |
|
76 |
LOGGER.warn("Not been able to open URL stream", ex); |
|
77 |
throw new IOException(ex); |
|
78 |
} |
|
79 |
} else if (source instanceof String) { |
|
80 |
String strSource = (String) source; |
|
81 |
if( StringUtils.startsWithIgnoreCase(strSource, "<html>") ) { |
|
82 |
byte[] pdfbytes = html2pdf(strSource); |
|
83 |
if( pdfbytes==null ) { |
|
84 |
throw new IOException(); |
|
85 |
} |
|
86 |
is = new ByteArrayInputStream(pdfbytes); |
|
87 |
} else { |
|
88 |
File f = new File(strSource); |
|
89 |
if (f.exists()) { |
|
90 |
try { |
|
91 |
is = new FileInputStream(f); |
|
92 |
} catch (FileNotFoundException ex) { |
|
93 |
LOGGER.warn("Not been able to load existing file", ex); |
|
94 |
throw new IOException(ex); |
|
95 |
} |
|
96 |
} else { |
|
97 |
try { |
|
98 |
URL url = new URL(strSource); |
|
99 |
is = url.openStream(); |
|
100 |
is.available(); // Force exception if is null |
|
101 |
} catch (Exception ex) { |
|
102 |
try { |
|
103 |
byte[] data = Hex.decodeHex(strSource.toCharArray()); |
|
104 |
is = new ByteArrayInputStream(data); |
|
105 |
} catch (DecoderException ex2) { |
|
106 |
try { |
|
107 |
byte[] data = Base64.decodeBase64(strSource); |
|
108 |
is = new ByteArrayInputStream(data); |
|
109 |
} catch (Exception ex3) { |
|
110 |
throw new IOException(ex3); |
|
111 |
} |
|
112 |
} |
|
113 |
} |
|
114 |
} |
|
115 |
} |
|
116 |
} else if (source instanceof byte[]) { |
|
117 |
byte[] byteSource = (byte[]) source; |
|
118 |
is = new ByteArrayInputStream(byteSource); |
|
119 |
} |
|
120 |
|
|
121 |
return is; |
|
122 |
} |
|
123 |
|
|
124 |
@Override |
|
125 |
public byte[] toByteArray() { |
|
126 |
if (this.source != null) { |
|
127 |
try { |
|
128 |
InputStream is = this.getInputStream(); |
|
129 |
byte[] bytes = new byte[is.available()]; |
|
130 |
is.read(bytes); |
|
131 |
return bytes; |
|
132 |
} catch (IOException ex) { |
|
133 |
LOGGER.warn("Not been able to convert pdf to byte array", ex); |
|
134 |
} |
|
135 |
} |
|
136 |
return null; |
|
137 |
|
|
138 |
} |
|
139 |
|
|
140 |
private String bytearray_hex(byte[] data) { |
|
141 |
StringBuilder builder = new StringBuilder(); |
|
142 |
for (byte abyte : data) { |
|
143 |
int v = abyte & 0xff; |
|
144 |
builder.append(String.format("%02x", v)); |
|
145 |
} |
|
146 |
return builder.toString(); |
|
147 |
} |
|
148 |
|
|
149 |
@Override |
|
150 |
public String toHexString() { |
|
151 |
byte[] data = this.toByteArray(); |
|
152 |
return bytearray_hex(data); |
|
153 |
} |
|
154 |
|
|
155 |
@Override |
|
156 |
public int getNumberOfPages() { |
|
157 |
if( this.source == null ) { |
|
158 |
return -1; |
|
159 |
} |
|
160 |
if( this.nummberOfPages>=0 ) { |
|
161 |
return this.nummberOfPages; |
|
162 |
} |
|
163 |
try { |
|
164 |
InputStream is = this.getInputStream(); |
|
165 |
this.document = PDDocument.load(is); |
|
166 |
this.nummberOfPages = document.getNumberOfPages(); |
|
167 |
return this.nummberOfPages; |
|
168 |
} catch (IOException ex) { |
|
169 |
return -1; |
|
170 |
} |
|
171 |
} |
|
172 |
|
|
173 |
@Override |
|
174 |
public SimpleImage toImage() { |
|
175 |
return this.toImage(0, 300); |
|
176 |
} |
|
177 |
|
|
178 |
@Override |
|
179 |
public SimpleImage toImage(int page) { |
|
180 |
return this.toImage(page, 300); |
|
181 |
} |
|
182 |
|
|
183 |
@Override |
|
184 |
public SimpleImage toImage(int page, int dpis) { |
|
185 |
if( this.source == null ) { |
|
186 |
return null; |
|
187 |
} |
|
188 |
if( page<0 ) { |
|
189 |
return null; |
|
190 |
} |
|
191 |
try { |
|
192 |
if (this.document == null) { |
|
193 |
InputStream is = this.getInputStream(); |
|
194 |
this.document = PDDocument.load(is); |
|
195 |
this.nummberOfPages = document.getNumberOfPages(); |
|
196 |
} |
|
197 |
if( page>=this.nummberOfPages ) { |
|
198 |
return null; |
|
199 |
} |
|
200 |
PDFRenderer pdfRenderer = new PDFRenderer(document); |
|
201 |
BufferedImage img = pdfRenderer.renderImageWithDPI(page, dpis, ImageType.RGB); |
|
202 |
return ToolsSwingLocator.getToolsSwingManager().createSimpleImage(img); |
|
203 |
} catch (Throwable ex) { |
|
204 |
return null; |
|
205 |
} |
|
206 |
} |
|
207 |
|
|
208 |
@Override |
|
209 |
public void dispose() { |
|
210 |
IOUtils.closeQuietly(document); |
|
211 |
this.source = null; |
|
212 |
this.nummberOfPages = -1; |
|
213 |
this.document = null; |
|
214 |
} |
|
215 |
|
|
216 |
private byte[] html2pdf(String html) { |
|
217 |
// |
|
218 |
// https://github.com/danfickle/openhtmltopdf/issues/661 header/footer |
|
219 |
// |
|
220 |
ByteArrayOutputStream pdfstream = null; |
|
221 |
try { |
|
222 |
if( StringUtils.contains(html, "<br>") ) { |
|
223 |
html = StringUtils.replace(html, "<br>", "<br/>"); |
|
224 |
} |
|
225 |
if( StringUtils.contains(html, " ") ) { |
|
226 |
html = StringUtils.replace(html, " ", " "); |
|
227 |
} |
|
228 |
pdfstream = new ByteArrayOutputStream(); |
|
229 |
|
|
230 |
// |
|
231 |
// https://stackoverflow.com/questions/60524835/html-to-pdf-with-german-alphabet |
|
232 |
// Habria que ver esto ya que falla con otros casos como con los acentros ocute. |
|
233 |
// |
|
234 |
// Parece ser que con algo como lo siguiente se podria evitar. |
|
235 |
// |
|
236 |
//Document jsoupDoc = Jsoup.parse(html); // org.jsoup.nodes.Document |
|
237 |
//W3CDom w3cDom = new W3CDom(); // org.jsoup.helper.W3CDom |
|
238 |
//org.w3c.dom.Document w3cDoc = w3cDom.fromJsoup(jsoupDoc); |
|
239 |
// |
|
240 |
//PdfRendererBuilder builder = new PdfRendererBuilder(); |
|
241 |
//builder.withW3cDocument(w3cDoc, "file://localhost/"); |
|
242 |
|
|
243 |
Document jsoupDoc = Jsoup.parse(html); // org.jsoup.nodes.Document |
|
244 |
W3CDom w3cDom = new W3CDom(); // org.jsoup.helper.W3CDom |
|
245 |
org.w3c.dom.Document w3cDoc = w3cDom.fromJsoup(jsoupDoc); |
|
246 |
|
|
247 |
PdfRendererBuilder builder = new PdfRendererBuilder(); |
|
248 |
builder.useFastMode(); |
|
249 |
builder.toStream(pdfstream); |
|
250 |
// builder.withHtmlContent(html,null); |
|
251 |
builder.withW3cDocument(w3cDoc, "file://localhost/"); |
|
252 |
|
|
253 |
Class cls = this.getClass(); |
|
254 |
builder.useFont(() -> cls.getResourceAsStream("dejavu/DejaVuSans.ttf"), "Sans", 400, FontStyle.NORMAL, true); |
|
255 |
builder.useFont(() -> cls.getResourceAsStream("dejavu/DejaVuSans-Bold.ttf"), "Sans", 700, FontStyle.NORMAL, true); |
|
256 |
builder.useFont(() -> cls.getResourceAsStream("dejavu/DejaVuSans-Oblique.ttf"), "Sans", 400, FontStyle.OBLIQUE, true); |
|
257 |
builder.useFont(() -> cls.getResourceAsStream("dejavu/DejaVuSans-BoldOblique.ttf"), "Sans", 700, FontStyle.OBLIQUE, true); |
|
258 |
|
|
259 |
builder.useFont(() -> cls.getResourceAsStream("dejavu/DejaVuSerif.ttf"), "Serif", 400, FontStyle.NORMAL, true); |
|
260 |
builder.useFont(() -> cls.getResourceAsStream("dejavu/DejaVuSerif-Bold.ttf"), "Serif", 700, FontStyle.NORMAL, true); |
|
261 |
builder.useFont(() -> cls.getResourceAsStream("dejavu/DejaVuSerif-Italic.ttf"), "Serif", 400, FontStyle.ITALIC, true); |
|
262 |
builder.useFont(() -> cls.getResourceAsStream("dejavu/DejaVuSerif-BoldItalic.ttf"), "Serif", 700, FontStyle.ITALIC, true); |
|
263 |
|
|
264 |
builder.useFont(() -> cls.getResourceAsStream("dejavu/DejaVuMono.ttf"), "Mono", 400, FontStyle.NORMAL, true); |
|
265 |
builder.useFont(() -> cls.getResourceAsStream("dejavu/DejaVuMono-Bold.ttf"), "Mono", 700, FontStyle.NORMAL, true); |
|
266 |
builder.useFont(() -> cls.getResourceAsStream("dejavu/DejaVuMono-Oblique.ttf"), "Mono", 400, FontStyle.OBLIQUE, true); |
|
267 |
builder.useFont(() -> cls.getResourceAsStream("dejavu/DejaVuMono-BoldOblique.ttf"), "Mono", 700, FontStyle.OBLIQUE, true); |
|
268 |
|
|
269 |
builder.run(); |
|
270 |
return pdfstream.toByteArray(); |
|
271 |
} catch(Throwable t) { |
|
272 |
LOGGER.warn("Can't convert HTML to PDF.",t); |
|
273 |
return null; |
|
274 |
} finally { |
|
275 |
IOUtils.closeQuietly(pdfstream); |
|
276 |
} |
|
277 |
} |
|
278 |
} |
org.gvsig.pdf/tags/org.gvsig.pdf-1.0.146/org.gvsig.pdf.lib/org.gvsig.pdf.lib.impl/src/main/java/org/gvsig/pdf/lib/impl/PDFImplLibrary.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 3 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
package org.gvsig.pdf.lib.impl; |
|
25 |
|
Also available in: Unified diff