mirror of
https://github.com/maxkratz/lectureStudio.git
synced 2024-05-18 20:00:16 +00:00
Updated to the latest version of MuPDF (#882)
* Updated mupdf to version 1.23.10 * Updated platform dependent code * Updated macos x86_64 mupdf version * Updated mac aarch64 mupdf library * Set stylus version to 0.3.0 * Updated mac aarch64 library config
This commit is contained in:
parent
8ac10c8ea5
commit
5a7779958f
|
@ -65,7 +65,7 @@ public class AppDataLocator {
|
|||
if (OsInfo.isLinux()) {
|
||||
appPath = Paths.get(userHome, ".config");
|
||||
}
|
||||
else if (OsInfo.isMac()) {
|
||||
else if (OsInfo.isMacOs()) {
|
||||
appPath = Paths.get(userHome, "Library", "Application Support");
|
||||
}
|
||||
else if (OsInfo.isWindows()) {
|
||||
|
|
|
@ -100,6 +100,7 @@ public class Document {
|
|||
/** Position of Notes in new Documents for export. Setting the splitSlideNotesPosition variable ends in broken PDF. */
|
||||
private NotesPosition actualSplitSlideNotesPosition = NotesPosition.UNKNOWN;
|
||||
|
||||
|
||||
/**
|
||||
* Create a new {@link Document}.
|
||||
* (Calls {@link #Document(PdfDocument)} with a new {@link PdfDocument})
|
||||
|
|
|
@ -45,6 +45,9 @@ public class DocumentOutline extends DocumentOutlineItem {
|
|||
DocumentOutlineItem item1 = iterator.next();
|
||||
Integer pageNum1 = item1.getPageNumber();
|
||||
|
||||
if (isNull(pageNum1)) {
|
||||
return null;
|
||||
}
|
||||
if (pageNum1.equals(pageNumber)) {
|
||||
return item1;
|
||||
}
|
||||
|
|
|
@ -358,6 +358,15 @@ public class PdfDocument {
|
|||
pdfBoxDocument.toOutputStream(stream);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the PDFBox Document.
|
||||
*
|
||||
* @return The PDFBox Document
|
||||
*/
|
||||
public PDFBoxDocument getPdfBoxDocument() {
|
||||
return pdfBoxDocument;
|
||||
}
|
||||
|
||||
private void init() {
|
||||
try {
|
||||
shapes = pdfBoxDocument.removeEditableAnnotations();
|
||||
|
@ -368,13 +377,4 @@ public class PdfDocument {
|
|||
shapes = new HashMap<>();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Get the PDFBox Document.
|
||||
*
|
||||
* @return The PDFBox Document
|
||||
*/
|
||||
|
||||
public PDFBoxDocument getPdfBoxDocument() {
|
||||
return pdfBoxDocument;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -239,8 +239,8 @@ public class MuPDFDocument implements DocumentAdapter {
|
|||
|
||||
if (nonNull(links)) {
|
||||
for (Link link : links) {
|
||||
if (nonNull(link.uri)) {
|
||||
uris.add(URI.create(link.uri));
|
||||
if (nonNull(link.getURI())) {
|
||||
uris.add(URI.create(link.getURI()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -259,8 +259,8 @@ public class MuPDFDocument implements DocumentAdapter {
|
|||
|
||||
if (nonNull(links)) {
|
||||
for (Link link : links) {
|
||||
if (nonNull(link.uri)) {
|
||||
launchActions.add(new File(link.uri));
|
||||
if (nonNull(link.getURI())) {
|
||||
launchActions.add(new File(link.getURI()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -361,17 +361,17 @@ public class MuPDFDocument implements DocumentAdapter {
|
|||
doc.save(new SeekableInputOutputStream() {
|
||||
|
||||
@Override
|
||||
public int read(byte[] b) throws IOException {
|
||||
public int read(byte[] b) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long seek(long offset, int whence) throws IOException {
|
||||
public long seek(long offset, int whence) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long position() throws IOException {
|
||||
public long position() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -379,6 +379,11 @@ public class MuPDFDocument implements DocumentAdapter {
|
|||
public void write(byte[] b, int off, int len) throws IOException {
|
||||
stream.write(b, off, len);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void truncate() {
|
||||
|
||||
}
|
||||
}, "compress");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ public class SimpleTextWalker implements StructuredTextWalker {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void beginLine(Rect bbox, int wMode) {
|
||||
public void beginLine(Rect bbox, int wmode, Point dir) {
|
||||
if (inBounds && nonNull(lastLineBBox)) {
|
||||
if (lastLineBBox.y0 == bbox.y0) {
|
||||
buffer.append(" ");
|
||||
|
|
|
@ -68,7 +68,7 @@ public class WordWalker implements StructuredTextWalker {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void beginLine(Rect bbox, int wMode) {
|
||||
public void beginLine(Rect bbox, int wmode, Point dir) {
|
||||
if (inBounds) {
|
||||
wordBounds = new Rect();
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ public class DesktopUtils {
|
|||
if (OsInfo.isLinux()) {
|
||||
Command.execute(new String[] { "xdg-open", path });
|
||||
}
|
||||
else if (OsInfo.isMac()) {
|
||||
else if (OsInfo.isMacOs()) {
|
||||
Command.execute(new String[] { "open", path });
|
||||
}
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ public class DesktopUtils {
|
|||
else if (OsInfo.isLinux()) {
|
||||
Command.execute(new String[] { "xdg-open", filePath });
|
||||
}
|
||||
else if (OsInfo.isMac()) {
|
||||
else if (OsInfo.isMacOs()) {
|
||||
Command.execute(new String[] { "open", filePath });
|
||||
}
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ public class FontFileLocator {
|
|||
"/usr/share/X11/fonts/TTF"
|
||||
};
|
||||
}
|
||||
else if (OsInfo.isMac()) {
|
||||
else if (OsInfo.isMacOs()) {
|
||||
return new String[] {
|
||||
System.getProperty("user.home") + "/Library/Fonts/",
|
||||
"/Library/Fonts/",
|
||||
|
|
|
@ -35,8 +35,8 @@ public class OsInfo {
|
|||
if (jvmName.startsWith("dalvik") && osName.startsWith("linux")) {
|
||||
osName = "android";
|
||||
}
|
||||
else if (osName.startsWith("mac os x")) {
|
||||
osName = "macosx";
|
||||
else if (osName.startsWith("mac os")) {
|
||||
osName = "macos";
|
||||
}
|
||||
else {
|
||||
osName = osName.split(" ")[0];
|
||||
|
@ -65,7 +65,7 @@ public class OsInfo {
|
|||
return osName.startsWith("linux");
|
||||
}
|
||||
|
||||
public static boolean isMac() {
|
||||
public static boolean isMacOs() {
|
||||
return osName.startsWith("mac");
|
||||
}
|
||||
|
||||
|
|
|
@ -29,6 +29,9 @@
|
|||
<classpathLayoutType>custom</classpathLayoutType>
|
||||
<customClasspathLayout>${artifact.artifactId}.${artifact.extension}</customClasspathLayout>
|
||||
</manifest>
|
||||
<manifestEntries>
|
||||
<Class-Path>lib/stylus-macos-aarch64.jar lib/webrtc-java-macos-aarch64.jar lib/stylus-linux-x86_64.jar lib/webrtc-java-linux-x86_64.jar lib/javafx-controls-mac-aarch64.jar lib/javafx-graphics-mac-aarch64.jar lib/javafx-base-mac-aarch64.jar lib/javafx-fxml-mac-aarch64.jar lib/javafx-swing-mac-aarch64.jar lib/javafx-web-mac-aarch64.jar lib/javafx-media-mac-aarch64.jar</Class-Path>
|
||||
</manifestEntries>
|
||||
</archive>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<javafx.version>17</javafx.version>
|
||||
<javafx.version>21</javafx.version>
|
||||
</properties>
|
||||
|
||||
<build>
|
||||
|
|
|
@ -57,7 +57,7 @@ public abstract class JavaFxApplication extends ApplicationBase implements Graph
|
|||
|
||||
public static void launch(final String[] args, Class<? extends Preloader> preloaderClass) {
|
||||
Platform.startup(() -> {
|
||||
if (!OsInfo.isMac()) {
|
||||
if (!OsInfo.isMacOs()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -44,11 +44,6 @@
|
|||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.lecturestudio.avdev</groupId>
|
||||
<artifactId>avdev</artifactId>
|
||||
<version>0.1.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>dev.onvoid.webrtc</groupId>
|
||||
|
|
|
@ -81,6 +81,19 @@
|
|||
<build.exec.arg>package.sh</build.exec.arg>
|
||||
</properties>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>mac-aarch64</id>
|
||||
<activation>
|
||||
<os>
|
||||
<family>mac</family>
|
||||
<arch>aarch64</arch>
|
||||
</os>
|
||||
</activation>
|
||||
<properties>
|
||||
<build.exec>/bin/bash</build.exec>
|
||||
<build.exec.arg>package.sh</build.exec.arg>
|
||||
</properties>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>mac-x86_64</id>
|
||||
<activation>
|
||||
|
|
|
@ -339,6 +339,10 @@ public class SoundSettingsPresenter extends Presenter<SoundSettingsView> {
|
|||
}
|
||||
|
||||
private void setDefaultRecordingDevice() {
|
||||
if (audioSystemProvider.getRecordingDevices().length < 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
AudioDevice captureDevice = null;
|
||||
|
||||
try {
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
<customClasspathLayout>${artifact.artifactId}.${artifact.extension}</customClasspathLayout>
|
||||
</manifest>
|
||||
<manifestEntries>
|
||||
<Class-Path>lib/stylus-linux-x86_64.jar lib/webrtc-java-linux-x86_64.jar lib/javafx-controls-win.jar lib/javafx-graphics-win.jar lib/javafx-base-win.jar lib/javafx-fxml-win.jar lib/javafx-swing-win.jar lib/javafx-web-win.jar lib/javafx-media-win.jar</Class-Path>
|
||||
<Class-Path>lib/stylus-macos-aarch64.jar lib/webrtc-java-macos-aarch64.jar lib/stylus-linux-x86_64.jar lib/webrtc-java-linux-x86_64.jar lib/javafx-controls-win.jar lib/javafx-graphics-win.jar lib/javafx-base-win.jar lib/javafx-fxml-win.jar lib/javafx-swing-win.jar lib/javafx-web-win.jar lib/javafx-media-win.jar</Class-Path>
|
||||
</manifestEntries>
|
||||
</archive>
|
||||
</configuration>
|
||||
|
|
|
@ -109,7 +109,7 @@ public class KeyUtils {
|
|||
break;
|
||||
}
|
||||
|
||||
if (OsInfo.isMac()) {
|
||||
if (OsInfo.isMacOs()) {
|
||||
switch (code) {
|
||||
case KeyEvent.VK_BACK_SPACE: return '\u232B';
|
||||
case KeyEvent.VK_ESCAPE: return '\u238B';
|
||||
|
|
59
lect-third-party/mupdf/src/main/java/com/artifex/mupdf/fitz/Archive.java
vendored
Normal file
59
lect-third-party/mupdf/src/main/java/com/artifex/mupdf/fitz/Archive.java
vendored
Normal file
|
@ -0,0 +1,59 @@
|
|||
// Copyright (C) 2004-2022 Artifex Software, Inc.
|
||||
//
|
||||
// This file is part of MuPDF.
|
||||
//
|
||||
// MuPDF is free software: you can redistribute it and/or modify it under the
|
||||
// terms of the GNU Affero General Public License as published by the Free
|
||||
// Software Foundation, either version 3 of the License, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// MuPDF is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
// details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with MuPDF. If not, see <https://www.gnu.org/licenses/agpl-3.0.en.html>
|
||||
//
|
||||
// Alternative licensing terms are available from the licensor.
|
||||
// For commercial licensing, see <https://www.artifex.com/> or contact
|
||||
// Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco,
|
||||
// CA 94129, USA, for further information.
|
||||
|
||||
package com.artifex.mupdf.fitz;
|
||||
|
||||
public class Archive
|
||||
{
|
||||
static {
|
||||
Context.init();
|
||||
}
|
||||
|
||||
private long pointer;
|
||||
|
||||
protected native void finalize();
|
||||
|
||||
public void destroy() {
|
||||
finalize();
|
||||
}
|
||||
|
||||
private native long newNativeArchive(String path);
|
||||
private native long newNativeMultiArchive();
|
||||
|
||||
public Archive(String path) {
|
||||
pointer = newNativeArchive(path);
|
||||
}
|
||||
|
||||
public Archive() {
|
||||
pointer = newNativeMultiArchive();
|
||||
}
|
||||
|
||||
protected Archive(long p) {
|
||||
pointer = p;
|
||||
}
|
||||
|
||||
public native String getFormat();
|
||||
public native int countEntries();
|
||||
public native String listEntries();
|
||||
public native boolean hasEntry(String name);
|
||||
public native Buffer readEntry(String name);
|
||||
}
|
|
@ -1,5 +1,31 @@
|
|||
// Copyright (C) 2004-2023 Artifex Software, Inc.
|
||||
//
|
||||
// This file is part of MuPDF.
|
||||
//
|
||||
// MuPDF is free software: you can redistribute it and/or modify it under the
|
||||
// terms of the GNU Affero General Public License as published by the Free
|
||||
// Software Foundation, either version 3 of the License, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// MuPDF is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
// details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with MuPDF. If not, see <https://www.gnu.org/licenses/agpl-3.0.en.html>
|
||||
//
|
||||
// Alternative licensing terms are available from the licensor.
|
||||
// For commercial licensing, see <https://www.artifex.com/> or contact
|
||||
// Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco,
|
||||
// CA 94129, USA, for further information.
|
||||
|
||||
package com.artifex.mupdf.fitz;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
||||
public class Buffer
|
||||
{
|
||||
static {
|
||||
|
@ -24,6 +50,10 @@ public class Buffer
|
|||
pointer = newNativeBuffer(0);
|
||||
}
|
||||
|
||||
protected Buffer(long p) {
|
||||
pointer = p;
|
||||
}
|
||||
|
||||
public native int getLength();
|
||||
public native int readByte(int at);
|
||||
public native int readBytes(int at, byte[] bs);
|
||||
|
@ -37,5 +67,50 @@ public class Buffer
|
|||
public native void writeLine(String line);
|
||||
public native void writeLines(String... lines);
|
||||
|
||||
public native Buffer slice(int start, int end);
|
||||
|
||||
public Buffer slice(int start)
|
||||
{
|
||||
return slice(start, getLength());
|
||||
}
|
||||
|
||||
public Buffer slice()
|
||||
{
|
||||
return slice(0, getLength());
|
||||
}
|
||||
|
||||
public native void save(String filename);
|
||||
|
||||
public void readIntoStream(OutputStream stream)
|
||||
{
|
||||
try {
|
||||
byte[] data = new byte[getLength()];
|
||||
readBytes(0, data);
|
||||
stream.write(data);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException("unable to write all bytes from buffer into stream");
|
||||
}
|
||||
}
|
||||
|
||||
public void writeFromStream(InputStream stream)
|
||||
{
|
||||
try {
|
||||
boolean readAllBytes = false;
|
||||
byte[] data = null;
|
||||
while (!readAllBytes)
|
||||
{
|
||||
int availableBytes = stream.available();
|
||||
if (data == null || availableBytes > data.length)
|
||||
data = new byte[availableBytes];
|
||||
int bytesRead = stream.read(data);
|
||||
if (bytesRead >= 0)
|
||||
writeBytesFrom(data, 0, bytesRead);
|
||||
else
|
||||
readAllBytes = true;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException("unable to read all bytes from stream into buffer");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,3 +1,25 @@
|
|||
// Copyright (C) 2004-2021 Artifex Software, Inc.
|
||||
//
|
||||
// This file is part of MuPDF.
|
||||
//
|
||||
// MuPDF is free software: you can redistribute it and/or modify it under the
|
||||
// terms of the GNU Affero General Public License as published by the Free
|
||||
// Software Foundation, either version 3 of the License, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// MuPDF is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
// details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with MuPDF. If not, see <https://www.gnu.org/licenses/agpl-3.0.en.html>
|
||||
//
|
||||
// Alternative licensing terms are available from the licensor.
|
||||
// For commercial licensing, see <https://www.artifex.com/> or contact
|
||||
// Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco,
|
||||
// CA 94129, USA, for further information.
|
||||
|
||||
package com.artifex.mupdf.fitz;
|
||||
|
||||
import java.io.IOException;
|
||||
|
|
|
@ -1,3 +1,25 @@
|
|||
// Copyright (C) 2004-2021 Artifex Software, Inc.
|
||||
//
|
||||
// This file is part of MuPDF.
|
||||
//
|
||||
// MuPDF is free software: you can redistribute it and/or modify it under the
|
||||
// terms of the GNU Affero General Public License as published by the Free
|
||||
// Software Foundation, either version 3 of the License, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// MuPDF is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
// details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with MuPDF. If not, see <https://www.gnu.org/licenses/agpl-3.0.en.html>
|
||||
//
|
||||
// Alternative licensing terms are available from the licensor.
|
||||
// For commercial licensing, see <https://www.artifex.com/> or contact
|
||||
// Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco,
|
||||
// CA 94129, USA, for further information.
|
||||
|
||||
package com.artifex.mupdf.fitz;
|
||||
|
||||
import java.io.IOException;
|
||||
|
|
|
@ -1,3 +1,25 @@
|
|||
// Copyright (C) 2004-2021 Artifex Software, Inc.
|
||||
//
|
||||
// This file is part of MuPDF.
|
||||
//
|
||||
// MuPDF is free software: you can redistribute it and/or modify it under the
|
||||
// terms of the GNU Affero General Public License as published by the Free
|
||||
// Software Foundation, either version 3 of the License, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// MuPDF is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
// details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with MuPDF. If not, see <https://www.gnu.org/licenses/agpl-3.0.en.html>
|
||||
//
|
||||
// Alternative licensing terms are available from the licensor.
|
||||
// For commercial licensing, see <https://www.artifex.com/> or contact
|
||||
// Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco,
|
||||
// CA 94129, USA, for further information.
|
||||
|
||||
package com.artifex.mupdf.fitz;
|
||||
|
||||
public final class ColorParams
|
||||
|
|
|
@ -1,3 +1,25 @@
|
|||
// Copyright (C) 2004-2023 Artifex Software, Inc.
|
||||
//
|
||||
// This file is part of MuPDF.
|
||||
//
|
||||
// MuPDF is free software: you can redistribute it and/or modify it under the
|
||||
// terms of the GNU Affero General Public License as published by the Free
|
||||
// Software Foundation, either version 3 of the License, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// MuPDF is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
// details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with MuPDF. If not, see <https://www.gnu.org/licenses/agpl-3.0.en.html>
|
||||
//
|
||||
// Alternative licensing terms are available from the licensor.
|
||||
// For commercial licensing, see <https://www.artifex.com/> or contact
|
||||
// Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco,
|
||||
// CA 94129, USA, for further information.
|
||||
|
||||
package com.artifex.mupdf.fitz;
|
||||
|
||||
public class ColorSpace
|
||||
|
@ -45,4 +67,12 @@ public class ColorSpace
|
|||
if (this == DeviceCMYK) return "DeviceCMYK";
|
||||
return "ColorSpace(" + getNumberOfComponents() + ")";
|
||||
}
|
||||
|
||||
public native boolean isGray();
|
||||
public native boolean isRGB();
|
||||
public native boolean isCMYK();
|
||||
public native boolean isIndexed();
|
||||
public native boolean isLab();
|
||||
public native boolean isDeviceN();
|
||||
public native boolean isSubtractive();
|
||||
}
|
||||
|
|
|
@ -1,3 +1,25 @@
|
|||
// Copyright (C) 2004-2021 Artifex Software, Inc.
|
||||
//
|
||||
// This file is part of MuPDF.
|
||||
//
|
||||
// MuPDF is free software: you can redistribute it and/or modify it under the
|
||||
// terms of the GNU Affero General Public License as published by the Free
|
||||
// Software Foundation, either version 3 of the License, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// MuPDF is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
// details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with MuPDF. If not, see <https://www.gnu.org/licenses/agpl-3.0.en.html>
|
||||
//
|
||||
// Alternative licensing terms are available from the licensor.
|
||||
// For commercial licensing, see <https://www.artifex.com/> or contact
|
||||
// Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco,
|
||||
// CA 94129, USA, for further information.
|
||||
|
||||
package com.artifex.mupdf.fitz;
|
||||
|
||||
// This class handles the loading of the MuPDF shared library, together
|
||||
|
@ -21,7 +43,6 @@ public class Context
|
|||
public static void init() {
|
||||
if (!inited) {
|
||||
inited = true;
|
||||
|
||||
try {
|
||||
System.loadLibrary("mupdf");
|
||||
}
|
||||
|
@ -31,26 +52,44 @@ public class Context
|
|||
if (initNative() < 0) {
|
||||
throw new RuntimeException("Cannot initialize mupdf library");
|
||||
}
|
||||
if (initNative() < 0)
|
||||
throw new RuntimeException("cannot initialize mupdf library");
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME: We should support the store size being changed dynamically.
|
||||
// This requires changes within the MuPDF core.
|
||||
//public native static void setStoreSize(long newSize);
|
||||
|
||||
// empty the store
|
||||
// empty and shrink the store
|
||||
public native static void emptyStore();
|
||||
public native static boolean shrinkStore(int percent);
|
||||
|
||||
public native static void enableICC();
|
||||
public native static void disableICC();
|
||||
public native static void setAntiAliasLevel(int level);
|
||||
|
||||
// The way CSS is controlled may have breaking changes in the future.
|
||||
public native static void setUserCSS(String css);
|
||||
public native static void useDocumentCSS(boolean state);
|
||||
|
||||
public native static Version getVersion();
|
||||
|
||||
public class Version {
|
||||
public static class Version {
|
||||
public String version;
|
||||
public int major;
|
||||
public int minor;
|
||||
public int patch;
|
||||
}
|
||||
|
||||
public static void setLog(Log log_) {
|
||||
synchronized(lock) {
|
||||
log = log_;
|
||||
}
|
||||
}
|
||||
|
||||
public interface Log
|
||||
{
|
||||
void error(String message);
|
||||
void warning(String message);
|
||||
}
|
||||
|
||||
private static Log log;
|
||||
private final static Object lock = new Object();
|
||||
}
|
||||
|
|
|
@ -1,3 +1,25 @@
|
|||
// Copyright (C) 2004-2021 Artifex Software, Inc.
|
||||
//
|
||||
// This file is part of MuPDF.
|
||||
//
|
||||
// MuPDF is free software: you can redistribute it and/or modify it under the
|
||||
// terms of the GNU Affero General Public License as published by the Free
|
||||
// Software Foundation, either version 3 of the License, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// MuPDF is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
// details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with MuPDF. If not, see <https://www.gnu.org/licenses/agpl-3.0.en.html>
|
||||
//
|
||||
// Alternative licensing terms are available from the licensor.
|
||||
// For commercial licensing, see <https://www.artifex.com/> or contact
|
||||
// Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco,
|
||||
// CA 94129, USA, for further information.
|
||||
|
||||
package com.artifex.mupdf.fitz;
|
||||
|
||||
public class Cookie
|
||||
|
|
67
lect-third-party/mupdf/src/main/java/com/artifex/mupdf/fitz/DOM.java
vendored
Normal file
67
lect-third-party/mupdf/src/main/java/com/artifex/mupdf/fitz/DOM.java
vendored
Normal file
|
@ -0,0 +1,67 @@
|
|||
// Copyright (C) 2022 Artifex Software, Inc.
|
||||
//
|
||||
// This file is part of MuPDF.
|
||||
//
|
||||
// MuPDF is free software: you can redistribute it and/or modify it under the
|
||||
// terms of the GNU Affero General Public License as published by the Free
|
||||
// Software Foundation, either version 3 of the License, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// MuPDF is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
// details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with MuPDF. If not, see <https://www.gnu.org/licenses/agpl-3.0.en.html>
|
||||
//
|
||||
// Alternative licensing terms are available from the licensor.
|
||||
// For commercial licensing, see <https://www.artifex.com/> or contact
|
||||
// Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco,
|
||||
// CA 94129, USA, for further information.
|
||||
|
||||
package com.artifex.mupdf.fitz;
|
||||
|
||||
public class DOM
|
||||
{
|
||||
static {
|
||||
Context.init();
|
||||
}
|
||||
|
||||
protected long pointer;
|
||||
|
||||
protected native void finalize();
|
||||
|
||||
public void destroy() {
|
||||
finalize();
|
||||
}
|
||||
|
||||
protected DOM(long p) {
|
||||
pointer = p;
|
||||
}
|
||||
|
||||
public native DOM body();
|
||||
public native DOM document();
|
||||
public native DOM createTextNode(String text);
|
||||
public native DOM createElement(String tag);
|
||||
|
||||
public native void insertBefore(DOM toinsert);
|
||||
public native void insertAfter(DOM toinsert);
|
||||
public native void appendChild(DOM toinsert);
|
||||
public native void remove();
|
||||
public native DOM clone();
|
||||
public native DOM parent();
|
||||
public native DOM firstChild();
|
||||
public native DOM next();
|
||||
public native DOM previous();
|
||||
public native DOM addAttribute(String att, String val);
|
||||
public native DOM removeAttribute(String att);
|
||||
public native String attribute(String att);
|
||||
public static class DOMAttribute {
|
||||
String attribute;
|
||||
String value;
|
||||
};
|
||||
public native DOMAttribute[] attributes();
|
||||
public native DOM find(String tag, String att, String val);
|
||||
public native DOM findNext(String tag, String att, String val);
|
||||
}
|
29
lect-third-party/mupdf/src/main/java/com/artifex/mupdf/fitz/DefaultAppearance.java
vendored
Normal file
29
lect-third-party/mupdf/src/main/java/com/artifex/mupdf/fitz/DefaultAppearance.java
vendored
Normal file
|
@ -0,0 +1,29 @@
|
|||
// Copyright (C) 2004-2021 Artifex Software, Inc.
|
||||
//
|
||||
// This file is part of MuPDF.
|
||||
//
|
||||
// MuPDF is free software: you can redistribute it and/or modify it under the
|
||||
// terms of the GNU Affero General Public License as published by the Free
|
||||
// Software Foundation, either version 3 of the License, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// MuPDF is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
// details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with MuPDF. If not, see <https://www.gnu.org/licenses/agpl-3.0.en.html>
|
||||
//
|
||||
// Alternative licensing terms are available from the licensor.
|
||||
// For commercial licensing, see <https://www.artifex.com/> or contact
|
||||
// Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco,
|
||||
// CA 94129, USA, for further information.
|
||||
|
||||
package com.artifex.mupdf.fitz;
|
||||
|
||||
public class DefaultAppearance {
|
||||
public String font;
|
||||
public float size;
|
||||
public float[] color;
|
||||
}
|
52
lect-third-party/mupdf/src/main/java/com/artifex/mupdf/fitz/DefaultColorSpaces.java
vendored
Normal file
52
lect-third-party/mupdf/src/main/java/com/artifex/mupdf/fitz/DefaultColorSpaces.java
vendored
Normal file
|
@ -0,0 +1,52 @@
|
|||
// Copyright (C) 2004-2023 Artifex Software, Inc.
|
||||
//
|
||||
// This file is part of MuPDF.
|
||||
//
|
||||
// MuPDF is free software: you can redistribute it and/or modify it under the
|
||||
// terms of the GNU Affero General Public License as published by the Free
|
||||
// Software Foundation, either version 3 of the License, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// MuPDF is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
// details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with MuPDF. If not, see <https://www.gnu.org/licenses/agpl-3.0.en.html>
|
||||
//
|
||||
// Alternative licensing terms are available from the licensor.
|
||||
// For commercial licensing, see <https://www.artifex.com/> or contact
|
||||
// Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco,
|
||||
// CA 94129, USA, for further information.
|
||||
|
||||
package com.artifex.mupdf.fitz;
|
||||
|
||||
public class DefaultColorSpaces
|
||||
{
|
||||
static {
|
||||
Context.init();
|
||||
}
|
||||
|
||||
private long pointer;
|
||||
|
||||
protected native void finalize();
|
||||
|
||||
public void destroy() {
|
||||
finalize();
|
||||
}
|
||||
|
||||
private DefaultColorSpaces(long p) {
|
||||
pointer = p;
|
||||
}
|
||||
|
||||
public native void setDefaultGray(ColorSpace cs);
|
||||
public native void setDefaultRGB(ColorSpace cs);
|
||||
public native void setDefaultCMYK(ColorSpace cs);
|
||||
public native void setOutputIntent(ColorSpace cs);
|
||||
|
||||
public native ColorSpace getDefaultGray();
|
||||
public native ColorSpace getDefaultRGB();
|
||||
public native ColorSpace getDefaultCMYK();
|
||||
public native ColorSpace getOutputIntent();
|
||||
}
|
|
@ -1,3 +1,25 @@
|
|||
// Copyright (C) 2004-2023 Artifex Software, Inc.
|
||||
//
|
||||
// This file is part of MuPDF.
|
||||
//
|
||||
// MuPDF is free software: you can redistribute it and/or modify it under the
|
||||
// terms of the GNU Affero General Public License as published by the Free
|
||||
// Software Foundation, either version 3 of the License, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// MuPDF is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
// details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with MuPDF. If not, see <https://www.gnu.org/licenses/agpl-3.0.en.html>
|
||||
//
|
||||
// Alternative licensing terms are available from the licensor.
|
||||
// For commercial licensing, see <https://www.artifex.com/> or contact
|
||||
// Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco,
|
||||
// CA 94129, USA, for further information.
|
||||
|
||||
package com.artifex.mupdf.fitz;
|
||||
|
||||
abstract public class Device
|
||||
|
@ -57,8 +79,14 @@ abstract public class Device
|
|||
abstract public void endGroup();
|
||||
abstract public int beginTile(Rect area, Rect view, float xstep, float ystep, Matrix ctm, int id);
|
||||
abstract public void endTile();
|
||||
abstract public void renderFlags(int set, int clear);
|
||||
abstract public void setDefaultColorSpaces(DefaultColorSpaces dcs);
|
||||
abstract public void beginLayer(String name);
|
||||
abstract public void endLayer();
|
||||
abstract public void beginStructure(int standard, String raw, int uid);
|
||||
abstract public void endStructure();
|
||||
abstract public void beginMetatext(int meta, String text);
|
||||
abstract public void endMetatext();
|
||||
|
||||
/* PDF 1.4 -- standard separable */
|
||||
public static final int BLEND_NORMAL = 0;
|
||||
|
@ -79,4 +107,82 @@ abstract public class Device
|
|||
public static final int BLEND_SATURATION = 13;
|
||||
public static final int BLEND_COLOR = 14;
|
||||
public static final int BLEND_LUMINOSITY = 15;
|
||||
|
||||
public static final int DEVICE_FLAG_MASK = 1;
|
||||
public static final int DEVICE_FLAG_COLOR = 2;
|
||||
public static final int DEVICE_FLAG_UNCACHEABLE = 4;
|
||||
public static final int DEVICE_FLAG_FILLCOLOR_UNDEFINED = 8;
|
||||
public static final int DEVICE_FLAG_STROKECOLOR_UNDEFINED = 16;
|
||||
public static final int DEVICE_FLAG_STARTCAP_UNDEFINED = 32;
|
||||
public static final int DEVICE_FLAG_DASHCAP_UNDEFINED = 64;
|
||||
public static final int DEVICE_FLAG_ENDCAP_UNDEFINED = 128;
|
||||
public static final int DEVICE_FLAG_LINEJOIN_UNDEFINED = 256;
|
||||
public static final int DEVICE_FLAG_MITERLIMIT_UNDEFINED = 512;
|
||||
public static final int DEVICE_FLAG_LINEWIDTH_UNDEFINED = 1024;
|
||||
public static final int DEVICE_FLAG_BBOX_DEFINED = 2048;
|
||||
public static final int DEVICE_FLAG_GRIDFIT_AS_TILED = 4096;
|
||||
|
||||
public static final int STRUCTURE_INVALID = -1;
|
||||
public static final int STRUCTURE_DOCUMENT = 0;
|
||||
public static final int STRUCTURE_PART = 1;
|
||||
public static final int STRUCTURE_ART = 2;
|
||||
public static final int STRUCTURE_SECT = 3;
|
||||
public static final int STRUCTURE_DIV = 4;
|
||||
public static final int STRUCTURE_BLOCKQUOTE = 5;
|
||||
public static final int STRUCTURE_CAPTION = 6;
|
||||
public static final int STRUCTURE_TOC = 7;
|
||||
public static final int STRUCTURE_TOCI = 8;
|
||||
public static final int STRUCTURE_INDEX = 9;
|
||||
public static final int STRUCTURE_NONSTRUCT = 10;
|
||||
public static final int STRUCTURE_PRIVATE = 11;
|
||||
public static final int STRUCTURE_DOCUMENTFRAGMENT = 12;
|
||||
public static final int STRUCTURE_ASIDE = 13;
|
||||
public static final int STRUCTURE_TITLE = 14;
|
||||
public static final int STRUCTURE_FENOTE = 15;
|
||||
public static final int STRUCTURE_SUB = 16;
|
||||
public static final int STRUCTURE_P = 17;
|
||||
public static final int STRUCTURE_H = 18;
|
||||
public static final int STRUCTURE_H1 = 19;
|
||||
public static final int STRUCTURE_H2 = 20;
|
||||
public static final int STRUCTURE_H3 = 21;
|
||||
public static final int STRUCTURE_H4 = 22;
|
||||
public static final int STRUCTURE_H5 = 23;
|
||||
public static final int STRUCTURE_H6 = 24;
|
||||
public static final int STRUCTURE_LIST = 25;
|
||||
public static final int STRUCTURE_LISTITEM = 26;
|
||||
public static final int STRUCTURE_LABEL = 27;
|
||||
public static final int STRUCTURE_LISTBODY = 28;
|
||||
public static final int STRUCTURE_TABLE = 29;
|
||||
public static final int STRUCTURE_TR = 30;
|
||||
public static final int STRUCTURE_TH = 31;
|
||||
public static final int STRUCTURE_TD = 32;
|
||||
public static final int STRUCTURE_THEAD = 33;
|
||||
public static final int STRUCTURE_TBODY = 34;
|
||||
public static final int STRUCTURE_TFOOT = 35;
|
||||
public static final int STRUCTURE_SPAN = 36;
|
||||
public static final int STRUCTURE_QUOTE = 37;
|
||||
public static final int STRUCTURE_NOTE = 38;
|
||||
public static final int STRUCTURE_REFERENCE = 39;
|
||||
public static final int STRUCTURE_BIBENTRY = 40;
|
||||
public static final int STRUCTURE_CODE = 41;
|
||||
public static final int STRUCTURE_LINK = 42;
|
||||
public static final int STRUCTURE_ANNOT = 43;
|
||||
public static final int STRUCTURE_EM = 44;
|
||||
public static final int STRUCTURE_STRONG = 45;
|
||||
public static final int STRUCTURE_RUBY = 46;
|
||||
public static final int STRUCTURE_RB = 47;
|
||||
public static final int STRUCTURE_RT = 48;
|
||||
public static final int STRUCTURE_RP = 49;
|
||||
public static final int STRUCTURE_WARICHU = 50;
|
||||
public static final int STRUCTURE_WT = 51;
|
||||
public static final int STRUCTURE_WP = 52;
|
||||
public static final int STRUCTURE_FIGURE = 53;
|
||||
public static final int STRUCTURE_FORMULA = 54;
|
||||
public static final int STRUCTURE_FORM = 55;
|
||||
public static final int STRUCTURE_ARTIFACT = 56;
|
||||
|
||||
public static final int METATEXT_ACTUALTEXT = 0;
|
||||
public static final int METATEXT_ALT = 1;
|
||||
public static final int METATEXT_ABBREVIATION = 2;
|
||||
public static final int METATEXT_TITLE = 3;
|
||||
}
|
||||
|
|
|
@ -1,3 +1,25 @@
|
|||
// Copyright (C) 2004-2021 Artifex Software, Inc.
|
||||
//
|
||||
// This file is part of MuPDF.
|
||||
//
|
||||
// MuPDF is free software: you can redistribute it and/or modify it under the
|
||||
// terms of the GNU Affero General Public License as published by the Free
|
||||
// Software Foundation, either version 3 of the License, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// MuPDF is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
// details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with MuPDF. If not, see <https://www.gnu.org/licenses/agpl-3.0.en.html>
|
||||
//
|
||||
// Alternative licensing terms are available from the licensor.
|
||||
// For commercial licensing, see <https://www.artifex.com/> or contact
|
||||
// Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco,
|
||||
// CA 94129, USA, for further information.
|
||||
|
||||
package com.artifex.mupdf.fitz;
|
||||
|
||||
public class DisplayList
|
||||
|
@ -24,6 +46,8 @@ public class DisplayList
|
|||
pointer = p;
|
||||
}
|
||||
|
||||
public native Rect getBounds();
|
||||
|
||||
public native Pixmap toPixmap(Matrix ctm, ColorSpace colorspace, boolean alpha);
|
||||
public native StructuredText toStructuredText(String options);
|
||||
|
||||
|
@ -31,7 +55,7 @@ public class DisplayList
|
|||
return toStructuredText(null);
|
||||
}
|
||||
|
||||
public native Quad[] search(String needle);
|
||||
public native Quad[][] search(String needle);
|
||||
|
||||
public native void run(Device dev, Matrix ctm, Rect scissor, Cookie cookie);
|
||||
|
||||
|
|
|
@ -1,3 +1,25 @@
|
|||
// Copyright (C) 2004-2021 Artifex Software, Inc.
|
||||
//
|
||||
// This file is part of MuPDF.
|
||||
//
|
||||
// MuPDF is free software: you can redistribute it and/or modify it under the
|
||||
// terms of the GNU Affero General Public License as published by the Free
|
||||
// Software Foundation, either version 3 of the License, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// MuPDF is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
// details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with MuPDF. If not, see <https://www.gnu.org/licenses/agpl-3.0.en.html>
|
||||
//
|
||||
// Alternative licensing terms are available from the licensor.
|
||||
// For commercial licensing, see <https://www.artifex.com/> or contact
|
||||
// Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco,
|
||||
// CA 94129, USA, for further information.
|
||||
|
||||
package com.artifex.mupdf.fitz;
|
||||
|
||||
public final class DisplayListDevice extends NativeDevice
|
||||
|
|
|
@ -1,3 +1,25 @@
|
|||
// Copyright (C) 2004-2022 Artifex Software, Inc.
|
||||
//
|
||||
// This file is part of MuPDF.
|
||||
//
|
||||
// MuPDF is free software: you can redistribute it and/or modify it under the
|
||||
// terms of the GNU Affero General Public License as published by the Free
|
||||
// Software Foundation, either version 3 of the License, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// MuPDF is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
// details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with MuPDF. If not, see <https://www.gnu.org/licenses/agpl-3.0.en.html>
|
||||
//
|
||||
// Alternative licensing terms are available from the licensor.
|
||||
// For commercial licensing, see <https://www.artifex.com/> or contact
|
||||
// Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco,
|
||||
// CA 94129, USA, for further information.
|
||||
|
||||
package com.artifex.mupdf.fitz;
|
||||
|
||||
public class Document
|
||||
|
@ -10,6 +32,12 @@ public class Document
|
|||
public static final String META_ENCRYPTION = "encryption";
|
||||
public static final String META_INFO_AUTHOR = "info:Author";
|
||||
public static final String META_INFO_TITLE = "info:Title";
|
||||
public static final String META_INFO_SUBJECT = "info:Subject";
|
||||
public static final String META_INFO_KEYWORDS = "info:Keywords";
|
||||
public static final String META_INFO_CREATOR = "info:Creator";
|
||||
public static final String META_INFO_PRODUCER = "info:Producer";
|
||||
public static final String META_INFO_CREATIONDATE = "info:CreationDate";
|
||||
public static final String META_INFO_MODIFICATIONDATE = "info:ModDate";
|
||||
|
||||
protected long pointer;
|
||||
|
||||
|
@ -58,6 +86,7 @@ public class Document
|
|||
|
||||
public static native boolean recognize(String magic);
|
||||
|
||||
public native boolean supportsAccelerator();
|
||||
public native void saveAccelerator(String filename);
|
||||
public native void outputAccelerator(SeekableOutputStream stream);
|
||||
|
||||
|
@ -163,18 +192,31 @@ public class Document
|
|||
return -1;
|
||||
}
|
||||
|
||||
public native Quad[] search(int chapter, int page, String needle);
|
||||
public native Quad[][] search(int chapter, int page, String needle);
|
||||
|
||||
public native Location resolveLink(String uri);
|
||||
public Location resolveLink(Outline link) {
|
||||
return resolveLink(link.uri);
|
||||
}
|
||||
public Location resolveLink(Link link) {
|
||||
return resolveLink(link.uri);
|
||||
return resolveLink(link.getURI());
|
||||
}
|
||||
|
||||
public native LinkDestination resolveLinkDestination(String uri);
|
||||
public LinkDestination resolveLinkDestination(OutlineIterator.OutlineItem item) {
|
||||
return resolveLinkDestination(item.uri);
|
||||
}
|
||||
public LinkDestination resolveLinkDestination(Outline link) {
|
||||
return resolveLinkDestination(link.uri);
|
||||
}
|
||||
public LinkDestination resolveLinkDestination(Link link) {
|
||||
return resolveLinkDestination(link.getURI());
|
||||
}
|
||||
|
||||
public native Outline[] loadOutline();
|
||||
public native OutlineIterator outlineIterator();
|
||||
public native String getMetaData(String key);
|
||||
public native void setMetaData(String key, String value);
|
||||
public native boolean isReflowable();
|
||||
public native void layout(float width, float height, float em);
|
||||
|
||||
|
@ -188,11 +230,17 @@ public class Document
|
|||
public static final int PERMISSION_COPY = (int) 'c';
|
||||
public static final int PERMISSION_EDIT = (int) 'e';
|
||||
public static final int PERMISSION_ANNOTATE = (int) 'n';
|
||||
public static final int PERMISSION_FORM = (int) 'f';
|
||||
public static final int PERMISSION_ACCESSBILITY = (int) 'y';
|
||||
public static final int PERMISSION_ASSEMBLE = (int) 'a';
|
||||
public static final int PERMISSION_PRINT_HQ = (int) 'h';
|
||||
|
||||
public native boolean hasPermission(int permission);
|
||||
|
||||
public native boolean isUnencryptedPDF();
|
||||
|
||||
public native String formatLinkURI(LinkDestination dest);
|
||||
|
||||
public boolean isPDF() {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -1,3 +1,25 @@
|
|||
// Copyright (C) 2004-2021 Artifex Software, Inc.
|
||||
//
|
||||
// This file is part of MuPDF.
|
||||
//
|
||||
// MuPDF is free software: you can redistribute it and/or modify it under the
|
||||
// terms of the GNU Affero General Public License as published by the Free
|
||||
// Software Foundation, either version 3 of the License, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// MuPDF is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
// details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with MuPDF. If not, see <https://www.gnu.org/licenses/agpl-3.0.en.html>
|
||||
//
|
||||
// Alternative licensing terms are available from the licensor.
|
||||
// For commercial licensing, see <https://www.artifex.com/> or contact
|
||||
// Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco,
|
||||
// CA 94129, USA, for further information.
|
||||
|
||||
package com.artifex.mupdf.fitz;
|
||||
|
||||
public class DocumentWriter
|
||||
|
@ -14,13 +36,27 @@ public class DocumentWriter
|
|||
finalize();
|
||||
}
|
||||
|
||||
private native long newNativeDocumentWriter(String filename, String format, String options);
|
||||
private native static long newNativeDocumentWriter(String filename, String format, String options);
|
||||
private native static long newNativeDocumentWriterWithSeekableOutputStream(SeekableOutputStream stream, String format, String options);
|
||||
|
||||
public DocumentWriter(String filename, String format, String options) {
|
||||
pointer = newNativeDocumentWriter(filename, format, options);
|
||||
}
|
||||
|
||||
public DocumentWriter(SeekableOutputStream stream, String format, String options) {
|
||||
pointer = newNativeDocumentWriterWithSeekableOutputStream(stream, format, options);
|
||||
}
|
||||
|
||||
public native Device beginPage(Rect mediabox);
|
||||
public native void endPage();
|
||||
public native void close();
|
||||
|
||||
private long ocrlistener;
|
||||
|
||||
public interface OCRListener
|
||||
{
|
||||
boolean progress(int page, int percent);
|
||||
}
|
||||
|
||||
public native void addOCRListener(OCRListener listener);
|
||||
}
|
||||
|
|
|
@ -1,3 +1,25 @@
|
|||
// Copyright (C) 2004-2021 Artifex Software, Inc.
|
||||
//
|
||||
// This file is part of MuPDF.
|
||||
//
|
||||
// MuPDF is free software: you can redistribute it and/or modify it under the
|
||||
// terms of the GNU Affero General Public License as published by the Free
|
||||
// Software Foundation, either version 3 of the License, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// MuPDF is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
// details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with MuPDF. If not, see <https://www.gnu.org/licenses/agpl-3.0.en.html>
|
||||
//
|
||||
// Alternative licensing terms are available from the licensor.
|
||||
// For commercial licensing, see <https://www.artifex.com/> or contact
|
||||
// Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco,
|
||||
// CA 94129, USA, for further information.
|
||||
|
||||
package com.artifex.mupdf.fitz;
|
||||
|
||||
public final class DrawDevice extends NativeDevice
|
||||
|
|
|
@ -1,3 +1,25 @@
|
|||
// Copyright (C) 2004-2021 Artifex Software, Inc.
|
||||
//
|
||||
// This file is part of MuPDF.
|
||||
//
|
||||
// MuPDF is free software: you can redistribute it and/or modify it under the
|
||||
// terms of the GNU Affero General Public License as published by the Free
|
||||
// Software Foundation, either version 3 of the License, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// MuPDF is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
// details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with MuPDF. If not, see <https://www.gnu.org/licenses/agpl-3.0.en.html>
|
||||
//
|
||||
// Alternative licensing terms are available from the licensor.
|
||||
// For commercial licensing, see <https://www.artifex.com/> or contact
|
||||
// Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco,
|
||||
// CA 94129, USA, for further information.
|
||||
|
||||
package com.artifex.mupdf.fitz;
|
||||
|
||||
import java.io.File;
|
||||
|
@ -40,4 +62,8 @@ public class FileStream implements SeekableInputStream, SeekableOutputStream
|
|||
public void close() throws IOException {
|
||||
file.close();
|
||||
}
|
||||
|
||||
public void truncate() throws IOException {
|
||||
file.setLength(file.getFilePointer());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,3 +1,25 @@
|
|||
// Copyright (C) 2004-2021 Artifex Software, Inc.
|
||||
//
|
||||
// This file is part of MuPDF.
|
||||
//
|
||||
// MuPDF is free software: you can redistribute it and/or modify it under the
|
||||
// terms of the GNU Affero General Public License as published by the Free
|
||||
// Software Foundation, either version 3 of the License, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// MuPDF is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
// details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with MuPDF. If not, see <https://www.gnu.org/licenses/agpl-3.0.en.html>
|
||||
//
|
||||
// Alternative licensing terms are available from the licensor.
|
||||
// For commercial licensing, see <https://www.artifex.com/> or contact
|
||||
// Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco,
|
||||
// CA 94129, USA, for further information.
|
||||
|
||||
package com.artifex.mupdf.fitz;
|
||||
|
||||
import java.io.IOException;
|
||||
|
|
|
@ -1,3 +1,25 @@
|
|||
// Copyright (C) 2004-2022 Artifex Software, Inc.
|
||||
//
|
||||
// This file is part of MuPDF.
|
||||
//
|
||||
// MuPDF is free software: you can redistribute it and/or modify it under the
|
||||
// terms of the GNU Affero General Public License as published by the Free
|
||||
// Software Foundation, either version 3 of the License, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// MuPDF is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
// details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with MuPDF. If not, see <https://www.gnu.org/licenses/agpl-3.0.en.html>
|
||||
//
|
||||
// Alternative licensing terms are available from the licensor.
|
||||
// For commercial licensing, see <https://www.artifex.com/> or contact
|
||||
// Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco,
|
||||
// CA 94129, USA, for further information.
|
||||
|
||||
package com.artifex.mupdf.fitz;
|
||||
|
||||
public class Font
|
||||
|
@ -6,9 +28,9 @@ public class Font
|
|||
Context.init();
|
||||
}
|
||||
|
||||
public static final int LATIN = 0;
|
||||
public static final int GREEK = 1;
|
||||
public static final int CYRILLIC = 2;
|
||||
public static final int SIMPLE_ENCODING_LATIN = 0;
|
||||
public static final int SIMPLE_ENCODING_GREEK = 1;
|
||||
public static final int SIMPLE_ENCODING_CYRILLIC = 2;
|
||||
|
||||
public static final int ADOBE_CNS = 0;
|
||||
public static final int ADOBE_GB = 1;
|
||||
|
|
|
@ -1,3 +1,25 @@
|
|||
// Copyright (C) 2004-2023 Artifex Software, Inc.
|
||||
//
|
||||
// This file is part of MuPDF.
|
||||
//
|
||||
// MuPDF is free software: you can redistribute it and/or modify it under the
|
||||
// terms of the GNU Affero General Public License as published by the Free
|
||||
// Software Foundation, either version 3 of the License, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// MuPDF is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
// details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with MuPDF. If not, see <https://www.gnu.org/licenses/agpl-3.0.en.html>
|
||||
//
|
||||
// Alternative licensing terms are available from the licensor.
|
||||
// For commercial licensing, see <https://www.artifex.com/> or contact
|
||||
// Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco,
|
||||
// CA 94129, USA, for further information.
|
||||
|
||||
package com.artifex.mupdf.fitz;
|
||||
|
||||
public class Image
|
||||
|
@ -16,6 +38,8 @@ public class Image
|
|||
|
||||
private native long newNativeFromPixmap(Pixmap pixmap);
|
||||
private native long newNativeFromFile(String filename);
|
||||
private native long newNativeFromBytes(byte[] bytes);
|
||||
private native long newNativeFromBuffer(Buffer buffer);
|
||||
|
||||
protected Image(long p) {
|
||||
pointer = p;
|
||||
|
@ -29,6 +53,14 @@ public class Image
|
|||
pointer = newNativeFromFile(filename);
|
||||
}
|
||||
|
||||
public Image(byte[] bytes) {
|
||||
pointer = newNativeFromBytes(bytes);
|
||||
}
|
||||
|
||||
public Image(Buffer buffer) {
|
||||
pointer = newNativeFromBuffer(buffer);
|
||||
}
|
||||
|
||||
public native int getWidth();
|
||||
public native int getHeight();
|
||||
public native int getXResolution();
|
||||
|
@ -39,7 +71,11 @@ public class Image
|
|||
public native int getBitsPerComponent();
|
||||
public native boolean getImageMask();
|
||||
public native boolean getInterpolate();
|
||||
public native int[] getColorKey();
|
||||
public native float[] getDecode();
|
||||
public native int getOrientation();
|
||||
public native Image getMask();
|
||||
public native void setOrientation(int orientation);
|
||||
|
||||
public native Pixmap toPixmap();
|
||||
}
|
||||
|
|
|
@ -1,20 +1,63 @@
|
|||
// Copyright (C) 2004-2022 Artifex Software, Inc.
|
||||
//
|
||||
// This file is part of MuPDF.
|
||||
//
|
||||
// MuPDF is free software: you can redistribute it and/or modify it under the
|
||||
// terms of the GNU Affero General Public License as published by the Free
|
||||
// Software Foundation, either version 3 of the License, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// MuPDF is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
// details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with MuPDF. If not, see <https://www.gnu.org/licenses/agpl-3.0.en.html>
|
||||
//
|
||||
// Alternative licensing terms are available from the licensor.
|
||||
// For commercial licensing, see <https://www.artifex.com/> or contact
|
||||
// Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco,
|
||||
// CA 94129, USA, for further information.
|
||||
|
||||
package com.artifex.mupdf.fitz;
|
||||
|
||||
public class Link
|
||||
{
|
||||
public Rect bounds;
|
||||
public String uri;
|
||||
|
||||
public Link(Rect bounds, String uri) {
|
||||
this.bounds = bounds;
|
||||
this.uri = uri;
|
||||
static {
|
||||
Context.init();
|
||||
}
|
||||
|
||||
private long pointer;
|
||||
|
||||
protected native void finalize();
|
||||
|
||||
public void destroy() {
|
||||
finalize();
|
||||
}
|
||||
|
||||
protected Link(long p) {
|
||||
pointer = p;
|
||||
}
|
||||
|
||||
public native Rect getBounds();
|
||||
public native void setBounds(Rect bbox);
|
||||
|
||||
public native String getURI();
|
||||
public native void setURI(String uri);
|
||||
|
||||
public boolean isExternal() {
|
||||
for (int i = 0; i < uri.length(); i++)
|
||||
String uri = getURI();
|
||||
char c = uri.charAt(0);
|
||||
if (!(c >= 'a' && c <= 'z') && !(c >= 'A' && c <= 'Z'))
|
||||
return false;
|
||||
|
||||
for (int i = 1; i < uri.length(); i++)
|
||||
{
|
||||
char c = uri.charAt(i);
|
||||
if (c >= 'a' && c <= 'z')
|
||||
c = uri.charAt(i);
|
||||
if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') ||
|
||||
(c >= '0' && c <= '9') ||
|
||||
c == '+' || c == '-' || c == '.')
|
||||
continue;
|
||||
else
|
||||
return c == ':';
|
||||
|
@ -23,6 +66,6 @@ public class Link
|
|||
}
|
||||
|
||||
public String toString() {
|
||||
return "Link(bounds="+bounds+",uri="+uri+")";
|
||||
return "Link(bounds="+getBounds()+",uri="+getURI()+")";
|
||||
}
|
||||
}
|
||||
|
|
132
lect-third-party/mupdf/src/main/java/com/artifex/mupdf/fitz/LinkDestination.java
vendored
Normal file
132
lect-third-party/mupdf/src/main/java/com/artifex/mupdf/fitz/LinkDestination.java
vendored
Normal file
|
@ -0,0 +1,132 @@
|
|||
// Copyright (C) 2004-2023 Artifex Software, Inc.
|
||||
//
|
||||
// This file is part of MuPDF.
|
||||
//
|
||||
// MuPDF is free software: you can redistribute it and/or modify it under the
|
||||
// terms of the GNU Affero General Public License as published by the Free
|
||||
// Software Foundation, either version 3 of the License, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// MuPDF is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
// details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with MuPDF. If not, see <https://www.gnu.org/licenses/agpl-3.0.en.html>
|
||||
//
|
||||
// Alternative licensing terms are available from the licensor.
|
||||
// For commercial licensing, see <https://www.artifex.com/> or contact
|
||||
// Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco,
|
||||
// CA 94129, USA, for further information.
|
||||
|
||||
package com.artifex.mupdf.fitz;
|
||||
|
||||
import java.lang.annotation.Native;
|
||||
|
||||
import java.lang.Float;
|
||||
|
||||
public class LinkDestination extends Location
|
||||
{
|
||||
/* Destinations, keep in sync with FZ_LINK_DEST_* */
|
||||
@Native public static final int LINK_DEST_FIT = 0;
|
||||
@Native public static final int LINK_DEST_FIT_B = 1;
|
||||
@Native public static final int LINK_DEST_FIT_H = 2;
|
||||
@Native public static final int LINK_DEST_FIT_BH = 3;
|
||||
@Native public static final int LINK_DEST_FIT_V = 4;
|
||||
@Native public static final int LINK_DEST_FIT_BV = 5;
|
||||
@Native public static final int LINK_DEST_FIT_R = 6;
|
||||
@Native public static final int LINK_DEST_XYZ = 7;
|
||||
|
||||
public int type;
|
||||
public float x;
|
||||
public float y;
|
||||
public float width;
|
||||
public float height;
|
||||
public float zoom;
|
||||
|
||||
public LinkDestination(int chapter, int page, int type, float x, float y, float w, float h, float zoom)
|
||||
{
|
||||
super(chapter, page);
|
||||
this.type = type;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
this.zoom = zoom;
|
||||
}
|
||||
|
||||
public static LinkDestination Fit(int chapter, int page)
|
||||
{
|
||||
return new LinkDestination(chapter, page, LINK_DEST_FIT, Float.NaN, Float.NaN, Float.NaN, Float.NaN, Float.NaN);
|
||||
}
|
||||
|
||||
public static LinkDestination FitB(int chapter, int page)
|
||||
{
|
||||
return new LinkDestination(chapter, page, LINK_DEST_FIT_B, Float.NaN, Float.NaN, Float.NaN, Float.NaN, Float.NaN);
|
||||
}
|
||||
|
||||
public static LinkDestination XYZ(int chapter, int page)
|
||||
{
|
||||
return XYZ(chapter, page, Float.NaN, Float.NaN, Float.NaN);
|
||||
}
|
||||
public static LinkDestination XYZ(int chapter, int page, float zoom)
|
||||
{
|
||||
return XYZ(chapter, page, Float.NaN, Float.NaN, zoom);
|
||||
}
|
||||
public static LinkDestination XYZ(int chapter, int page, float x, float y)
|
||||
{
|
||||
return XYZ(chapter, page, x, y, Float.NaN);
|
||||
}
|
||||
public static LinkDestination XYZ(int chapter, int page, float x, float y, float zoom)
|
||||
{
|
||||
return new LinkDestination(chapter, page, LINK_DEST_XYZ, x, y, Float.NaN, Float.NaN, zoom);
|
||||
}
|
||||
|
||||
public static LinkDestination FitH(int chapter, int page)
|
||||
{
|
||||
return FitH(chapter, page, Float.NaN);
|
||||
}
|
||||
public static LinkDestination FitH(int chapter, int page, float y)
|
||||
{
|
||||
return new LinkDestination(chapter, page, LINK_DEST_FIT_H, Float.NaN, y, Float.NaN, Float.NaN, Float.NaN);
|
||||
}
|
||||
|
||||
public static LinkDestination FitBH(int chapter, int page)
|
||||
{
|
||||
return FitBH(chapter, page, Float.NaN);
|
||||
}
|
||||
public static LinkDestination FitBH(int chapter, int page, float y)
|
||||
{
|
||||
return new LinkDestination(chapter, page, LINK_DEST_FIT_BH, Float.NaN, y, Float.NaN, Float.NaN, Float.NaN);
|
||||
}
|
||||
|
||||
public static LinkDestination FitV(int chapter, int page)
|
||||
{
|
||||
return FitV(chapter, page, Float.NaN);
|
||||
}
|
||||
public static LinkDestination FitV(int chapter, int page, float x)
|
||||
{
|
||||
return new LinkDestination(chapter, page, LINK_DEST_FIT_V, x, Float.NaN, Float.NaN, Float.NaN, Float.NaN);
|
||||
}
|
||||
|
||||
public static LinkDestination FitBV(int chapter, int page)
|
||||
{
|
||||
return FitBV(chapter, page, Float.NaN);
|
||||
}
|
||||
public static LinkDestination FitBV(int chapter, int page, float x)
|
||||
{
|
||||
return new LinkDestination(chapter, page, LINK_DEST_FIT_BV, x, Float.NaN, Float.NaN, Float.NaN, Float.NaN);
|
||||
}
|
||||
|
||||
public static LinkDestination FitR(int chapter, int page, float x, float y, float width, float height)
|
||||
{
|
||||
return new LinkDestination(chapter, page, LINK_DEST_FIT_R, x, y, width, height, Float.NaN);
|
||||
}
|
||||
|
||||
public boolean hasX() { return !Float.isNaN(x); }
|
||||
public boolean hasY() { return !Float.isNaN(y); }
|
||||
public boolean hasZoom() { return !Float.isNaN(zoom) && zoom != 0; }
|
||||
public boolean hasWidth() { return !Float.isNaN(width); }
|
||||
public boolean hasHeight() { return !Float.isNaN(height); }
|
||||
}
|
|
@ -1,40 +1,59 @@
|
|||
// Copyright (C) 2004-2022 Artifex Software, Inc.
|
||||
//
|
||||
// This file is part of MuPDF.
|
||||
//
|
||||
// MuPDF is free software: you can redistribute it and/or modify it under the
|
||||
// terms of the GNU Affero General Public License as published by the Free
|
||||
// Software Foundation, either version 3 of the License, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// MuPDF is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
// details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with MuPDF. If not, see <https://www.gnu.org/licenses/agpl-3.0.en.html>
|
||||
//
|
||||
// Alternative licensing terms are available from the licensor.
|
||||
// For commercial licensing, see <https://www.artifex.com/> or contact
|
||||
// Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco,
|
||||
// CA 94129, USA, for further information.
|
||||
|
||||
package com.artifex.mupdf.fitz;
|
||||
|
||||
public final class Location
|
||||
import java.util.Objects;
|
||||
|
||||
public class Location
|
||||
{
|
||||
public final int chapter;
|
||||
public final int page;
|
||||
public final float x, y;
|
||||
|
||||
public Location(int chapter, int page) {
|
||||
this.chapter = chapter;
|
||||
this.page = page;
|
||||
this.x = this.y = 0;
|
||||
}
|
||||
|
||||
public Location(int chapter, int page, float x, float y) {
|
||||
this.chapter = chapter;
|
||||
this.page = page;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
public Location(Location location, float x, float y) {
|
||||
this.chapter = location.chapter;
|
||||
this.page = location.page;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (!(obj instanceof Location))
|
||||
return false;
|
||||
|
||||
Location other = (Location) obj;
|
||||
return this.chapter == other.chapter && this.page == other.page;
|
||||
}
|
||||
|
||||
return this.chapter == other.chapter &&
|
||||
this.page == other.page &&
|
||||
this.x == other.x &&
|
||||
this.y == other.y;
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(this.chapter, this.page);
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Location(chapter=");
|
||||
sb.append(chapter);
|
||||
sb.append(", page=");
|
||||
sb.append(page);
|
||||
sb.append(")");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,3 +1,25 @@
|
|||
// Copyright (C) 2004-2021 Artifex Software, Inc.
|
||||
//
|
||||
// This file is part of MuPDF.
|
||||
//
|
||||
// MuPDF is free software: you can redistribute it and/or modify it under the
|
||||
// terms of the GNU Affero General Public License as published by the Free
|
||||
// Software Foundation, either version 3 of the License, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// MuPDF is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
// details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with MuPDF. If not, see <https://www.gnu.org/licenses/agpl-3.0.en.html>
|
||||
//
|
||||
// Alternative licensing terms are available from the licensor.
|
||||
// For commercial licensing, see <https://www.artifex.com/> or contact
|
||||
// Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco,
|
||||
// CA 94129, USA, for further information.
|
||||
|
||||
package com.artifex.mupdf.fitz;
|
||||
|
||||
public class Matrix
|
||||
|
@ -77,6 +99,27 @@ public class Matrix
|
|||
return this;
|
||||
}
|
||||
|
||||
public Matrix invert() {
|
||||
float det = a * d - b * c;
|
||||
if (det > -Math.ulp(0) && det < Math.ulp(0))
|
||||
return this;
|
||||
|
||||
float srca = a;
|
||||
float srcb = b;
|
||||
float srcc = c;
|
||||
float srcd = d;
|
||||
float srce = e;
|
||||
float srcf = f;
|
||||
float rdet = 1 / det;
|
||||
this.a = srcd * rdet;
|
||||
this.b = -srcb * rdet;
|
||||
this.c = -srcc * rdet;
|
||||
this.d = srca * rdet;
|
||||
this.e = -srce * this.a - srcf * this.c;
|
||||
this.f = -srce * this.b - srcf * this.d;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Matrix rotate(float degrees) {
|
||||
while (degrees < 0)
|
||||
degrees += 360;
|
||||
|
@ -164,4 +207,20 @@ public class Matrix
|
|||
|
||||
return new Matrix(cos, sin, -sin, cos, 0, 0);
|
||||
}
|
||||
|
||||
public static Matrix Inverted(Matrix m) {
|
||||
float det = m.a * m.d - m.b * m.c;
|
||||
if (det > -Math.ulp(0) && det < Math.ulp(0))
|
||||
return m;
|
||||
|
||||
float rdet = 1 / det;
|
||||
float inva = m.d * rdet;
|
||||
float invb = -m.b * rdet;
|
||||
float invc = -m.c * rdet;
|
||||
float invd = m.a * rdet;
|
||||
float inve = -m.e * inva - m.f * invc;
|
||||
float invf = -m.e * invb - m.f * invd;
|
||||
|
||||
return new Matrix(inva, invb, invc, invd, inve, invf);
|
||||
}
|
||||
}
|
||||
|
|
34
lect-third-party/mupdf/src/main/java/com/artifex/mupdf/fitz/MultiArchive.java
vendored
Normal file
34
lect-third-party/mupdf/src/main/java/com/artifex/mupdf/fitz/MultiArchive.java
vendored
Normal file
|
@ -0,0 +1,34 @@
|
|||
// Copyright (C) 2004-2022 Artifex Software, Inc.
|
||||
//
|
||||
// This file is part of MuPDF.
|
||||
//
|
||||
// MuPDF is free software: you can redistribute it and/or modify it under the
|
||||
// terms of the GNU Affero General Public License as published by the Free
|
||||
// Software Foundation, either version 3 of the License, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// MuPDF is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
// details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with MuPDF. If not, see <https://www.gnu.org/licenses/agpl-3.0.en.html>
|
||||
//
|
||||
// Alternative licensing terms are available from the licensor.
|
||||
// For commercial licensing, see <https://www.artifex.com/> or contact
|
||||
// Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco,
|
||||
// CA 94129, USA, for further information.
|
||||
|
||||
package com.artifex.mupdf.fitz;
|
||||
|
||||
public class MultiArchive extends Archive
|
||||
{
|
||||
static {
|
||||
Context.init();
|
||||
}
|
||||
|
||||
private MultiArchive(long p) { super(p); }
|
||||
|
||||
public native void mountArchive(Archive sub, String path);
|
||||
}
|
|
@ -1,3 +1,25 @@
|
|||
// Copyright (C) 2004-2023 Artifex Software, Inc.
|
||||
//
|
||||
// This file is part of MuPDF.
|
||||
//
|
||||
// MuPDF is free software: you can redistribute it and/or modify it under the
|
||||
// terms of the GNU Affero General Public License as published by the Free
|
||||
// Software Foundation, either version 3 of the License, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// MuPDF is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
// details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with MuPDF. If not, see <https://www.gnu.org/licenses/agpl-3.0.en.html>
|
||||
//
|
||||
// Alternative licensing terms are available from the licensor.
|
||||
// For commercial licensing, see <https://www.artifex.com/> or contact
|
||||
// Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco,
|
||||
// CA 94129, USA, for further information.
|
||||
|
||||
package com.artifex.mupdf.fitz;
|
||||
|
||||
public class NativeDevice extends Device
|
||||
|
@ -35,7 +57,6 @@ public class NativeDevice extends Device
|
|||
public native final void fillShade(Shade shd, Matrix ctm, float alpha, int cp);
|
||||
public native final void fillImage(Image img, Matrix ctm, float alpha, int cp);
|
||||
public native final void fillImageMask(Image img, Matrix ctm, ColorSpace cs, float[] color, float alpha, int cp);
|
||||
/* FIXME: Why no scissor? */
|
||||
public native final void clipImageMask(Image img, Matrix ctm);
|
||||
|
||||
public native final void popClip();
|
||||
|
@ -48,6 +69,15 @@ public class NativeDevice extends Device
|
|||
public native final int beginTile(Rect area, Rect view, float xstep, float ystep, Matrix ctm, int id);
|
||||
public native final void endTile();
|
||||
|
||||
public native final void renderFlags(int set, int clear);
|
||||
public native final void setDefaultColorSpaces(DefaultColorSpaces dcs);
|
||||
|
||||
public native final void beginLayer(String name);
|
||||
public native final void endLayer();
|
||||
|
||||
public native final void beginStructure(int standard, String raw, int uid);
|
||||
public native final void endStructure();
|
||||
|
||||
public native final void beginMetatext(int meta, String text);
|
||||
public native final void endMetatext();
|
||||
}
|
||||
|
|
|
@ -1,3 +1,25 @@
|
|||
// Copyright (C) 2004-2021 Artifex Software, Inc.
|
||||
//
|
||||
// This file is part of MuPDF.
|
||||
//
|
||||
// MuPDF is free software: you can redistribute it and/or modify it under the
|
||||
// terms of the GNU Affero General Public License as published by the Free
|
||||
// Software Foundation, either version 3 of the License, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// MuPDF is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
// details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with MuPDF. If not, see <https://www.gnu.org/licenses/agpl-3.0.en.html>
|
||||
//
|
||||
// Alternative licensing terms are available from the licensor.
|
||||
// For commercial licensing, see <https://www.artifex.com/> or contact
|
||||
// Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco,
|
||||
// CA 94129, USA, for further information.
|
||||
|
||||
package com.artifex.mupdf.fitz;
|
||||
|
||||
public class Outline
|
||||
|
|
69
lect-third-party/mupdf/src/main/java/com/artifex/mupdf/fitz/OutlineIterator.java
vendored
Normal file
69
lect-third-party/mupdf/src/main/java/com/artifex/mupdf/fitz/OutlineIterator.java
vendored
Normal file
|
@ -0,0 +1,69 @@
|
|||
// Copyright (C) 2004-2021 Artifex Software, Inc.
|
||||
//
|
||||
// This file is part of MuPDF.
|
||||
//
|
||||
// MuPDF is free software: you can redistribute it and/or modify it under the
|
||||
// terms of the GNU Affero General Public License as published by the Free
|
||||
// Software Foundation, either version 3 of the License, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// MuPDF is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
// details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with MuPDF. If not, see <https://www.gnu.org/licenses/agpl-3.0.en.html>
|
||||
//
|
||||
// Alternative licensing terms are available from the licensor.
|
||||
// For commercial licensing, see <https://www.artifex.com/> or contact
|
||||
// Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco,
|
||||
// CA 94129, USA, for further information.
|
||||
|
||||
package com.artifex.mupdf.fitz;
|
||||
|
||||
public class OutlineIterator
|
||||
{
|
||||
protected long pointer;
|
||||
|
||||
protected native void finalize();
|
||||
|
||||
public void destroy() {
|
||||
finalize();
|
||||
}
|
||||
|
||||
protected OutlineIterator(long p) {
|
||||
pointer = p;
|
||||
}
|
||||
|
||||
public native int next();
|
||||
public native int prev();
|
||||
public native int up();
|
||||
public native int down();
|
||||
|
||||
public int insert(OutlineItem item)
|
||||
{
|
||||
return insert(item.title, item.uri, item.is_open);
|
||||
}
|
||||
public native int insert(String title, String uri, boolean is_open);
|
||||
public void update(OutlineItem item)
|
||||
{
|
||||
update(item.title, item.uri, item.is_open);
|
||||
}
|
||||
public native void update(String title, String uri, boolean is_open);
|
||||
public native OutlineItem item();
|
||||
public native int delete();
|
||||
|
||||
public static class OutlineItem {
|
||||
public String title;
|
||||
public String uri;
|
||||
public boolean is_open;
|
||||
|
||||
public OutlineItem(String title, String uri, boolean is_open)
|
||||
{
|
||||
this.title = title;
|
||||
this.uri = uri;
|
||||
this.is_open = is_open;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,6 +1,29 @@
|
|||
// Copyright (C) 2004-2023 Artifex Software, Inc.
|
||||
//
|
||||
// This file is part of MuPDF.
|
||||
//
|
||||
// MuPDF is free software: you can redistribute it and/or modify it under the
|
||||
// terms of the GNU Affero General Public License as published by the Free
|
||||
// Software Foundation, either version 3 of the License, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// MuPDF is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
// details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with MuPDF. If not, see <https://www.gnu.org/licenses/agpl-3.0.en.html>
|
||||
//
|
||||
// Alternative licensing terms are available from the licensor.
|
||||
// For commercial licensing, see <https://www.artifex.com/> or contact
|
||||
// Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco,
|
||||
// CA 94129, USA, for further information.
|
||||
|
||||
package com.artifex.mupdf.fitz;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Objects;
|
||||
|
||||
public class PDFAnnotation
|
||||
{
|
||||
|
@ -20,12 +43,17 @@ public class PDFAnnotation
|
|||
pointer = p;
|
||||
}
|
||||
|
||||
public boolean equals(PDFAnnotation other) {
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (!(obj instanceof PDFAnnotation))
|
||||
return false;
|
||||
PDFAnnotation other = (PDFAnnotation) obj;
|
||||
return (this.pointer == other.pointer);
|
||||
}
|
||||
|
||||
public boolean equals(long other) {
|
||||
return (this.pointer == other);
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(pointer);
|
||||
}
|
||||
|
||||
public native void run(Device dev, Matrix ctm, Cookie cookie);
|
||||
|
@ -75,6 +103,15 @@ public class PDFAnnotation
|
|||
public static final int LINE_ENDING_R_CLOSED_ARROW = 8;
|
||||
public static final int LINE_ENDING_SLASH = 9;
|
||||
|
||||
public static final int BORDER_STYLE_SOLID = 0;
|
||||
public static final int BORDER_STYLE_DASHED = 1;
|
||||
public static final int BORDER_STYLE_BEVELED = 2;
|
||||
public static final int BORDER_STYLE_INSET = 3;
|
||||
public static final int BORDER_STYLE_UNDERLINE = 4;
|
||||
|
||||
public static final int BORDER_EFFECT_NONE = 0;
|
||||
public static final int BORDER_EFFECT_CLOUDY = 1;
|
||||
|
||||
public static final int IS_INVISIBLE = 1 << (1-1);
|
||||
public static final int IS_HIDDEN = 1 << (2-1);
|
||||
public static final int IS_PRINT = 1 << (3-1);
|
||||
|
@ -91,14 +128,19 @@ public class PDFAnnotation
|
|||
public native void setFlags(int flags);
|
||||
public native String getContents();
|
||||
public native void setContents(String contents);
|
||||
public native boolean hasRect();
|
||||
public native Rect getRect();
|
||||
public native void setRect(Rect rect);
|
||||
public native float getBorder();
|
||||
public native void setBorder(float width);
|
||||
public native float[] getColor();
|
||||
public native void setColor(float[] color);
|
||||
public native boolean hasInteriorColor();
|
||||
public native float[] getInteriorColor();
|
||||
public native void setInteriorColor(float[] color);
|
||||
public native float getOpacity();
|
||||
public native void setOpacity(float opacity);
|
||||
public native boolean hasAuthor();
|
||||
public native String getAuthor();
|
||||
public native void setAuthor(String author);
|
||||
protected native long getCreationDateNative();
|
||||
|
@ -118,12 +160,36 @@ public class PDFAnnotation
|
|||
setModificationDate(date.getTime());
|
||||
}
|
||||
|
||||
public native boolean hasLineEndingStyles();
|
||||
public native int[] getLineEndingStyles();
|
||||
public native void setLineEndingStyles(int startStyle, int endStyle);
|
||||
public void setLineEndingStyles(int[] styles) {
|
||||
setLineEndingStyles(styles[0], styles[1]);
|
||||
}
|
||||
|
||||
public native boolean hasBorder();
|
||||
public native int getBorderStyle();
|
||||
public native void setBorderStyle(int style);
|
||||
public native float getBorderWidth();
|
||||
public native void setBorderWidth(float width);
|
||||
public native int getBorderDashCount();
|
||||
public native float getBorderDashItem(int i);
|
||||
public native void clearBorderDash();
|
||||
public native void addBorderDashItem(float length);
|
||||
public void setBorderDashPattern(float[] dash_pattern)
|
||||
{
|
||||
clearBorderDash();
|
||||
for (float length : dash_pattern)
|
||||
addBorderDashItem(length);
|
||||
}
|
||||
|
||||
public native boolean hasBorderEffect();
|
||||
public native int getBorderEffect();
|
||||
public native void setBorderEffect(int effect);
|
||||
public native float getBorderEffectIntensity();
|
||||
public native void setBorderEffectIntensity(float intensity);
|
||||
|
||||
public native boolean hasQuadPoints();
|
||||
public native int getQuadPointCount();
|
||||
public native Quad getQuadPoint(int i);
|
||||
public native void clearQuadPoints();
|
||||
|
@ -141,6 +207,7 @@ public class PDFAnnotation
|
|||
addQuadPoint(q);
|
||||
}
|
||||
|
||||
public native boolean hasVertices();
|
||||
public native int getVertexCount();
|
||||
public native Point getVertex(int i);
|
||||
public native void clearVertices();
|
||||
|
@ -161,6 +228,7 @@ public class PDFAnnotation
|
|||
addVertex(p);
|
||||
}
|
||||
|
||||
public native boolean hasInkList();
|
||||
public native int getInkListCount();
|
||||
public native int getInkListStrokeCount(int i);
|
||||
public native Point getInkListStrokeVertex(int i, int k);
|
||||
|
@ -195,8 +263,10 @@ public class PDFAnnotation
|
|||
return list;
|
||||
}
|
||||
|
||||
public native boolean hasIcon();
|
||||
public native String getIcon();
|
||||
public native void setIcon(String icon);
|
||||
public native boolean hasOpen();
|
||||
public native boolean isOpen();
|
||||
public native void setIsOpen(boolean open);
|
||||
|
||||
|
@ -208,4 +278,67 @@ public class PDFAnnotation
|
|||
public native void eventBlur();
|
||||
|
||||
public native boolean update();
|
||||
|
||||
public native PDFObject getObject();
|
||||
|
||||
/* See PDFDocument.LANGUAGE_* */
|
||||
public native int getLanguage();
|
||||
public native void setLanguage(int lang);
|
||||
|
||||
public native int getQuadding();
|
||||
public native void setQuadding(int quadding);
|
||||
|
||||
public native boolean hasLine();
|
||||
public native Point[] getLine();
|
||||
public native void setLine(Point a, Point b);
|
||||
|
||||
public native DefaultAppearance getDefaultAppearance();
|
||||
public native void setDefaultAppearance(String font, float size, float[] color);
|
||||
|
||||
protected native void setNativeAppearance(String appearance, String state, Matrix ctm, Rect bbox, PDFObject res, Buffer contents);
|
||||
protected native void setNativeAppearanceDisplayList(String appearance, String state, Matrix ctm, DisplayList list);
|
||||
protected native void setNativeAppearanceImage(Image image);
|
||||
|
||||
public void setAppearance(String appearance, String state, Matrix ctm, Rect bbox, PDFObject res, Buffer contents) {
|
||||
setNativeAppearance(appearance, state, ctm, bbox, res, contents);
|
||||
}
|
||||
public void setAppearance(String appearance, Matrix ctm, Rect bbox, PDFObject res, Buffer contents) {
|
||||
setNativeAppearance(appearance, null, ctm, bbox, res, contents);
|
||||
}
|
||||
public void setAppearance(String appearance, Rect bbox, PDFObject res, Buffer contents) {
|
||||
setNativeAppearance(appearance, null, null, bbox, res, contents);
|
||||
}
|
||||
public void setAppearance(Matrix ctm, Rect bbox, PDFObject res, Buffer contents) {
|
||||
setNativeAppearance(null, null, ctm, bbox, res, contents);
|
||||
}
|
||||
public void setAppearance(Rect bbox, PDFObject res, Buffer contents) {
|
||||
setNativeAppearance(null, null, null, bbox, res, contents);
|
||||
}
|
||||
public void setAppearance(String appearance, String state, Matrix ctm, DisplayList list) {
|
||||
setNativeAppearanceDisplayList(appearance, state, ctm, list);
|
||||
}
|
||||
public void setAppearance(String appearance, Matrix ctm, DisplayList list) {
|
||||
setNativeAppearanceDisplayList(appearance, null, ctm, list);
|
||||
}
|
||||
public void setAppearance(String appearance, DisplayList list) {
|
||||
setNativeAppearanceDisplayList(appearance, null, null, list);
|
||||
}
|
||||
public void setAppearance(Matrix ctm, DisplayList list) {
|
||||
setNativeAppearanceDisplayList(null, null, ctm, list);
|
||||
}
|
||||
public void setAppearance(DisplayList list) {
|
||||
setNativeAppearanceDisplayList(null, null, null, list);
|
||||
}
|
||||
public void setAppearance(Image image) {
|
||||
setNativeAppearanceImage(image);
|
||||
}
|
||||
|
||||
public native boolean hasFileSpecification();
|
||||
public native void setFileSpecification(PDFObject fs);
|
||||
public native PDFObject getFileSpecification();
|
||||
|
||||
public native boolean getHiddenForEditing();
|
||||
public native void setHiddenForEditing(boolean hidden);
|
||||
|
||||
public native boolean applyRedaction(boolean blackBoxes, int imageMethod);
|
||||
}
|
||||
|
|
|
@ -1,7 +1,50 @@
|
|||
// Copyright (C) 2004-2023 Artifex Software, Inc.
|
||||
//
|
||||
// This file is part of MuPDF.
|
||||
//
|
||||
// MuPDF is free software: you can redistribute it and/or modify it under the
|
||||
// terms of the GNU Affero General Public License as published by the Free
|
||||
// Software Foundation, either version 3 of the License, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// MuPDF is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
// details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with MuPDF. If not, see <https://www.gnu.org/licenses/agpl-3.0.en.html>
|
||||
//
|
||||
// Alternative licensing terms are available from the licensor.
|
||||
// For commercial licensing, see <https://www.artifex.com/> or contact
|
||||
// Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco,
|
||||
// CA 94129, USA, for further information.
|
||||
|
||||
package com.artifex.mupdf.fitz;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.Date;
|
||||
|
||||
public class PDFDocument extends Document
|
||||
{
|
||||
/* Languages, keep in sync with FZ_LANG_* */
|
||||
public static final int LANGUAGE_UNSET = 0;
|
||||
public static final int LANGUAGE_ur = 507;
|
||||
public static final int LANGUAGE_urd = 3423;
|
||||
public static final int LANGUAGE_ko = 416;
|
||||
public static final int LANGUAGE_ja = 37;
|
||||
public static final int LANGUAGE_zh = 242;
|
||||
public static final int LANGUAGE_zh_Hans = 14093;
|
||||
public static final int LANGUAGE_zh_Hant = 14822;
|
||||
|
||||
/* Page Label styles */
|
||||
public static final int PAGE_LABEL_NONE = 0;
|
||||
public static final int PAGE_LABEL_DECIMAL = 'D';
|
||||
public static final int PAGE_LABEL_ROMAN_UC = 'R';
|
||||
public static final int PAGE_LABEL_ROMAN_LC = 'r';
|
||||
public static final int PAGE_LABEL_ALPHA_UC = 'A';
|
||||
public static final int PAGE_LABEL_ALPHA_LC = 'a';
|
||||
|
||||
static {
|
||||
Context.init();
|
||||
}
|
||||
|
@ -104,6 +147,9 @@ public class PDFDocument extends Document
|
|||
public native boolean hasUnsavedChanges();
|
||||
public native boolean wasRepaired();
|
||||
public native boolean canBeSavedIncrementally();
|
||||
public native boolean isRedacted();
|
||||
|
||||
public native void rearrangePages(int[] pages);
|
||||
|
||||
public native void save(String filename, String options);
|
||||
|
||||
|
@ -113,13 +159,30 @@ public class PDFDocument extends Document
|
|||
}
|
||||
|
||||
public interface JsEventListener {
|
||||
void onAlert(String message);
|
||||
public static final int BUTTON_GROUP_OK = 0;
|
||||
public static final int BUTTON_GROUP_OK_CANCEL = 1;
|
||||
public static final int BUTTON_GROUP_YES_NO = 2;
|
||||
public static final int BUTTON_GROUP_YES_NO_CANCEL = 3;
|
||||
|
||||
public static final int BUTTON_NONE = 0;
|
||||
public static final int BUTTON_OK = 1;
|
||||
public static final int BUTTON_CANCEL = 2;
|
||||
public static final int BUTTON_NO = 3;
|
||||
public static final int BUTTON_YES = 4;
|
||||
|
||||
public static class AlertResult {
|
||||
public int buttonPressed;
|
||||
public boolean checkboxChecked;
|
||||
}
|
||||
|
||||
public AlertResult onAlert(PDFDocument doc, String title, String message, int iconType, int buttonGroupType, boolean hasCheckbox, String checkboxMessage, boolean checkboxState);
|
||||
}
|
||||
public native void enableJs();
|
||||
public native void disableJs();
|
||||
public native boolean isJsSupported();
|
||||
public native void setJsEventListener(JsEventListener listener);
|
||||
public native void calculate(); /* Recalculate form fields. Not needed if using page.update(). */
|
||||
public native int getVersion();
|
||||
|
||||
public boolean hasAcroForm() {
|
||||
return this.getTrailer().get("Root").get("AcroForm").get("Fields").size() > 0;
|
||||
|
@ -134,4 +197,80 @@ public class PDFDocument extends Document
|
|||
public native int validateChangeHistory();
|
||||
public native boolean wasPureXFA();
|
||||
public native boolean wasLinearized();
|
||||
|
||||
public native void enableJournal();
|
||||
public native void saveJournal(String filename);
|
||||
public native void saveJournalWithStream(SeekableOutputStream stream);
|
||||
public native void loadJournal(String filename);
|
||||
public native void loadJournalWithStream(SeekableInputStream stream);
|
||||
|
||||
public native int undoRedoPosition();
|
||||
public native int undoRedoSteps();
|
||||
public native String undoRedoStep(int step);
|
||||
|
||||
public native boolean canUndo();
|
||||
public native boolean canRedo();
|
||||
public native void undo();
|
||||
public native void redo();
|
||||
|
||||
public native void beginOperation(String operation);
|
||||
public native void beginImplicitOperation();
|
||||
public native void endOperation();
|
||||
public native void abandonOperation();
|
||||
|
||||
public native int getLanguage();
|
||||
public native void setLanguage(int lang);
|
||||
|
||||
public native void setPageLabels(int index, int style, String prefix, int start);
|
||||
public native void deletePageLabels(int index);
|
||||
protected static native String formatURIFromPathAndNamedDest(String path, String name);
|
||||
protected static native String formatURIFromPathAndExplicitDest(String path, LinkDestination dest);
|
||||
protected static native String appendNamedDestToURI(String uri, String name);
|
||||
protected static native String appendExplicitDestToURI(String uri, LinkDestination dest);
|
||||
|
||||
public static String formatURIFromPathAndDest(String path, String name) {
|
||||
return formatURIFromPathAndNamedDest(path, name);
|
||||
}
|
||||
public static String formatURIFromPathAndDest(String path, LinkDestination dest) {
|
||||
return formatURIFromPathAndExplicitDest(path, dest);
|
||||
}
|
||||
|
||||
public static String appendDestToURI(String uri, String name) {
|
||||
return appendNamedDestToURI(uri, name);
|
||||
}
|
||||
public static String appendDestToURI(String uri, LinkDestination dest) {
|
||||
return appendExplicitDestToURI(uri, dest);
|
||||
}
|
||||
|
||||
public native int countSignatures();
|
||||
|
||||
public native PDFObject addEmbeddedFile(String filename, String mimetype, Buffer contents, long created, long modified, boolean addChecksum);
|
||||
public native PDFEmbeddedFileParams getEmbeddedFileParams(PDFObject fs);
|
||||
public native Buffer loadEmbeddedFileContents(PDFObject fs);
|
||||
public native boolean verifyEmbeddedFileChecksum(PDFObject fs);
|
||||
|
||||
public PDFObject addEmbeddedFile(String filename, String mimetype, InputStream stream, Date created, Date modified, boolean addChecksum) {
|
||||
Buffer contents = new Buffer();
|
||||
contents.writeFromStream(stream);
|
||||
long createdTime = created != null ? created.getTime() : -1;
|
||||
long modifiedTime = modified != null ? modified.getTime() : -1;
|
||||
return addEmbeddedFile(filename, mimetype, contents, createdTime, modifiedTime, addChecksum);
|
||||
}
|
||||
|
||||
public static class PDFEmbeddedFileParams {
|
||||
public final String filename;
|
||||
public final String mimetype;
|
||||
public final int size;
|
||||
public final Date creationDate;
|
||||
public final Date modificationDate;
|
||||
|
||||
protected PDFEmbeddedFileParams(String filename, String mimetype, int size, long created, long modified) {
|
||||
this.filename = filename;
|
||||
this.mimetype = mimetype;
|
||||
this.size = size;
|
||||
this.creationDate = new Date(created);
|
||||
this.modificationDate = new Date(modified);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,3 +1,25 @@
|
|||
// Copyright (C) 2004-2021 Artifex Software, Inc.
|
||||
//
|
||||
// This file is part of MuPDF.
|
||||
//
|
||||
// MuPDF is free software: you can redistribute it and/or modify it under the
|
||||
// terms of the GNU Affero General Public License as published by the Free
|
||||
// Software Foundation, either version 3 of the License, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// MuPDF is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
// details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with MuPDF. If not, see <https://www.gnu.org/licenses/agpl-3.0.en.html>
|
||||
//
|
||||
// Alternative licensing terms are available from the licensor.
|
||||
// For commercial licensing, see <https://www.artifex.com/> or contact
|
||||
// Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco,
|
||||
// CA 94129, USA, for further information.
|
||||
|
||||
package com.artifex.mupdf.fitz;
|
||||
|
||||
public class PDFGraftMap
|
||||
|
|
|
@ -1,3 +1,25 @@
|
|||
// Copyright (C) 2004-2023 Artifex Software, Inc.
|
||||
//
|
||||
// This file is part of MuPDF.
|
||||
//
|
||||
// MuPDF is free software: you can redistribute it and/or modify it under the
|
||||
// terms of the GNU Affero General Public License as published by the Free
|
||||
// Software Foundation, either version 3 of the License, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// MuPDF is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
// details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with MuPDF. If not, see <https://www.gnu.org/licenses/agpl-3.0.en.html>
|
||||
//
|
||||
// Alternative licensing terms are available from the licensor.
|
||||
// For commercial licensing, see <https://www.artifex.com/> or contact
|
||||
// Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco,
|
||||
// CA 94129, USA, for further information.
|
||||
|
||||
package com.artifex.mupdf.fitz;
|
||||
|
||||
import java.util.Date;
|
||||
|
@ -23,7 +45,9 @@ public class PDFObject implements Iterable<PDFObject>
|
|||
}
|
||||
|
||||
public native boolean isIndirect();
|
||||
public native boolean isNull();
|
||||
public boolean isNull() {
|
||||
return this == PDFObject.Null;
|
||||
}
|
||||
public native boolean isBoolean();
|
||||
public native boolean isInteger();
|
||||
public native boolean isReal();
|
||||
|
@ -53,6 +77,7 @@ public class PDFObject implements Iterable<PDFObject>
|
|||
}
|
||||
|
||||
public native PDFObject resolve();
|
||||
public native boolean equals(PDFObject other);
|
||||
|
||||
public native byte[] readStream();
|
||||
public native byte[] readRawStream();
|
||||
|
@ -80,7 +105,7 @@ public class PDFObject implements Iterable<PDFObject>
|
|||
}
|
||||
|
||||
private native PDFObject getArray(int index);
|
||||
private native PDFObject getDictionary(String name);
|
||||
private native PDFObject getDictionary(String name, boolean inheritable);
|
||||
private native PDFObject getDictionaryKey(int index);
|
||||
|
||||
public PDFObject get(int index) {
|
||||
|
@ -88,11 +113,19 @@ public class PDFObject implements Iterable<PDFObject>
|
|||
}
|
||||
|
||||
public PDFObject get(String name) {
|
||||
return getDictionary(name);
|
||||
return getDictionary(name, false);
|
||||
}
|
||||
|
||||
public PDFObject get(PDFObject name) {
|
||||
return getDictionary(name != null ? name.asName() : null);
|
||||
return getDictionary(name != null ? name.asName() : null, false);
|
||||
}
|
||||
|
||||
public PDFObject getInheritable(String name) {
|
||||
return getDictionary(name, true);
|
||||
}
|
||||
|
||||
public PDFObject getInheritable(PDFObject name) {
|
||||
return getDictionary(name != null ? name.asName() : null, true);
|
||||
}
|
||||
|
||||
private native void putArrayBoolean(int index, boolean b);
|
||||
|
|
|
@ -1,3 +1,25 @@
|
|||
// Copyright (C) 2004-2021 Artifex Software, Inc.
|
||||
//
|
||||
// This file is part of MuPDF.
|
||||
//
|
||||
// MuPDF is free software: you can redistribute it and/or modify it under the
|
||||
// terms of the GNU Affero General Public License as published by the Free
|
||||
// Software Foundation, either version 3 of the License, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// MuPDF is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
// details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with MuPDF. If not, see <https://www.gnu.org/licenses/agpl-3.0.en.html>
|
||||
//
|
||||
// Alternative licensing terms are available from the licensor.
|
||||
// For commercial licensing, see <https://www.artifex.com/> or contact
|
||||
// Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco,
|
||||
// CA 94129, USA, for further information.
|
||||
|
||||
package com.artifex.mupdf.fitz;
|
||||
|
||||
public class PDFPage extends Page
|
||||
|
@ -8,8 +30,9 @@ public class PDFPage extends Page
|
|||
|
||||
private PDFPage(long p) { super(p); }
|
||||
|
||||
public native PDFObject getObject();
|
||||
public native PDFAnnotation[] getAnnotations();
|
||||
public native PDFAnnotation createAnnotation(int subtype);
|
||||
public native PDFAnnotation createAnnotation(int type);
|
||||
public native void deleteAnnotation(PDFAnnotation annot);
|
||||
|
||||
public static final int REDACT_IMAGE_NONE = 0;
|
||||
|
@ -24,14 +47,7 @@ public class PDFPage extends Page
|
|||
|
||||
public native boolean update();
|
||||
|
||||
private PDFWidget[] widgets;
|
||||
private native PDFWidget[] getWidgetsNative();
|
||||
|
||||
public PDFWidget[] getWidgets() {
|
||||
if (widgets == null)
|
||||
widgets = getWidgetsNative();
|
||||
return widgets;
|
||||
}
|
||||
public native PDFWidget[] getWidgets();
|
||||
|
||||
public PDFWidget activateWidgetAt(float pageX, float pageY) {
|
||||
for (PDFWidget widget : getWidgets()) {
|
||||
|
@ -47,4 +63,35 @@ public class PDFPage extends Page
|
|||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public native PDFWidget createSignature();
|
||||
|
||||
public native Matrix getTransform();
|
||||
|
||||
public Link createLinkFit(Rect bbox, int page) {
|
||||
return createLink(bbox, LinkDestination.Fit(0, page));
|
||||
}
|
||||
public Link createLinkFitB(Rect bbox, int page) {
|
||||
return createLink(bbox, LinkDestination.FitB(0, page));
|
||||
}
|
||||
public Link createLinkXYZ(Rect bbox, int page, float x, float y, float zoom) {
|
||||
return createLink(bbox, LinkDestination.XYZ(0, page, x, y, zoom));
|
||||
}
|
||||
public Link createLinkFitR(Rect bbox, int page, float x, float y, float w, float h) {
|
||||
return createLink(bbox, LinkDestination.FitR(0, page, x, y, w, h));
|
||||
}
|
||||
public Link createLinkFitV(Rect bbox, int page, float x) {
|
||||
return createLink(bbox, LinkDestination.FitV(0, page, x));
|
||||
}
|
||||
public Link createLinkFitBV(Rect bbox, int page, float x) {
|
||||
return createLink(bbox, LinkDestination.FitBV(0, page, x));
|
||||
}
|
||||
public Link createLinkFitH(Rect bbox, int page, float y) {
|
||||
return createLink(bbox, LinkDestination.FitH(0, page, y));
|
||||
}
|
||||
public Link createLinkFitBH(Rect bbox, int page, float y) {
|
||||
return createLink(bbox, LinkDestination.FitBH(0, page, y));
|
||||
}
|
||||
|
||||
// TODO: toPixmap with usage and page box
|
||||
}
|
||||
|
|
|
@ -1,3 +1,25 @@
|
|||
// Copyright (C) 2004-2021 Artifex Software, Inc.
|
||||
//
|
||||
// This file is part of MuPDF.
|
||||
//
|
||||
// MuPDF is free software: you can redistribute it and/or modify it under the
|
||||
// terms of the GNU Affero General Public License as published by the Free
|
||||
// Software Foundation, either version 3 of the License, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// MuPDF is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
// details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with MuPDF. If not, see <https://www.gnu.org/licenses/agpl-3.0.en.html>
|
||||
//
|
||||
// Alternative licensing terms are available from the licensor.
|
||||
// For commercial licensing, see <https://www.artifex.com/> or contact
|
||||
// Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco,
|
||||
// CA 94129, USA, for further information.
|
||||
|
||||
package com.artifex.mupdf.fitz;
|
||||
|
||||
public class PDFWidget extends PDFAnnotation
|
||||
|
@ -47,6 +69,15 @@ public class PDFWidget extends PDFAnnotation
|
|||
public static final int PDF_CH_FIELD_IS_SORT = 1 << 19;
|
||||
public static final int PDF_CH_FIELD_IS_MULTI_SELECT = 1 << 21;
|
||||
|
||||
/* Signature appearance */
|
||||
public static final int PDF_SIGNATURE_SHOW_LABELS = 1;
|
||||
public static final int PDF_SIGNATURE_SHOW_DN = 2;
|
||||
public static final int PDF_SIGNATURE_SHOW_DATE = 4;
|
||||
public static final int PDF_SIGNATURE_SHOW_TEXT_NAME = 8;
|
||||
public static final int PDF_SIGNATURE_SHOW_GRAPHIC_NAME = 16;
|
||||
public static final int PDF_SIGNATURE_SHOW_LOGO = 32;
|
||||
public static final int PDF_SIGNATURE_DEFAULT_APPEARANCE = 63;
|
||||
|
||||
// These don't change after creation, so are cached in java fields.
|
||||
private int fieldType;
|
||||
private int fieldFlags;
|
||||
|
@ -67,6 +98,7 @@ public class PDFWidget extends PDFAnnotation
|
|||
}
|
||||
public native String getValue();
|
||||
public native boolean setValue(String val);
|
||||
public native String getLabel();
|
||||
|
||||
/* Button fields */
|
||||
|
||||
|
@ -150,7 +182,53 @@ public class PDFWidget extends PDFAnnotation
|
|||
public native boolean setChoiceValue(String val);
|
||||
|
||||
/* Signature fields */
|
||||
public native boolean sign(PKCS7Signer signer);
|
||||
private static native Pixmap previewSignatureNative(int width, int height, int lang, PKCS7Signer signer, int flags, Image image, String reason, String location);
|
||||
public static Pixmap previewSignature(int width, int height, int lang, PKCS7Signer signer, int flags, Image image, String reason, String location) {
|
||||
return previewSignatureNative(width, height, lang, signer, flags, image, reason, location);
|
||||
}
|
||||
public static Pixmap previewSignature(int width, int height, int lang, PKCS7Signer signer, Image image) {
|
||||
return previewSignatureNative(width, height, lang, signer, PDF_SIGNATURE_DEFAULT_APPEARANCE, image, null, null);
|
||||
}
|
||||
public static Pixmap previewSignature(int width, int height, int lang, PKCS7Signer signer) {
|
||||
return previewSignatureNative(width, height, lang, signer, PDF_SIGNATURE_DEFAULT_APPEARANCE, null, null, null);
|
||||
}
|
||||
public static Pixmap previewSignature(int width, int height, PKCS7Signer signer, Image image) {
|
||||
return previewSignatureNative(width, height, PDFDocument.LANGUAGE_UNSET, signer, PDF_SIGNATURE_DEFAULT_APPEARANCE, image, null, null);
|
||||
}
|
||||
public static Pixmap previewSignature(int width, int height, PKCS7Signer signer) {
|
||||
return previewSignatureNative(width, height, PDFDocument.LANGUAGE_UNSET, signer, PDF_SIGNATURE_DEFAULT_APPEARANCE, null, null, null);
|
||||
}
|
||||
public Pixmap previewSignature(float dpi, PKCS7Signer signer, int flags, Image image, String reason, String location) {
|
||||
Rect r = getBounds();
|
||||
float scale = dpi / 72.0f;
|
||||
int w = Math.round((r.x1 - r.x0) * scale);
|
||||
int h = Math.round((r.x1 - r.x0) * scale);
|
||||
return previewSignature(w, h, getLanguage(), signer, flags, image, reason, location);
|
||||
}
|
||||
public Pixmap previewSignature(float dpi, PKCS7Signer signer, Image image) {
|
||||
Rect r = getBounds();
|
||||
float scale = dpi / 72.0f;
|
||||
int w = Math.round((r.x1 - r.x0) * scale);
|
||||
int h = Math.round((r.x1 - r.x0) * scale);
|
||||
return previewSignature(w, h, getLanguage(), signer, image);
|
||||
}
|
||||
public Pixmap previewSignature(float dpi, PKCS7Signer signer) {
|
||||
Rect r = getBounds();
|
||||
float scale = dpi / 72.0f;
|
||||
int w = Math.round((r.x1 - r.x0) * scale);
|
||||
int h = Math.round((r.x1 - r.x0) * scale);
|
||||
return previewSignature(w, h, getLanguage(), signer);
|
||||
}
|
||||
private native boolean signNative(PKCS7Signer signer, int flags, Image image, String reason, String location);
|
||||
public boolean sign(PKCS7Signer signer, int flags, Image image, String reason, String location) {
|
||||
return signNative(signer, flags, image, reason, location);
|
||||
}
|
||||
public boolean sign(PKCS7Signer signer, Image image) {
|
||||
return signNative(signer, PDF_SIGNATURE_DEFAULT_APPEARANCE, image, null, null);
|
||||
}
|
||||
public boolean sign(PKCS7Signer signer) {
|
||||
return signNative(signer, PDF_SIGNATURE_DEFAULT_APPEARANCE, null, null, null);
|
||||
}
|
||||
public native int checkCertificate(PKCS7Verifier verifier);
|
||||
public native int checkDigest(PKCS7Verifier verifier);
|
||||
public native boolean incrementalChangeAfterSigning();
|
||||
|
@ -161,9 +239,33 @@ public class PDFWidget extends PDFAnnotation
|
|||
return false;
|
||||
return !incrementalChangeAfterSigning();
|
||||
}
|
||||
public native PKCS7DesignatedName getDesignatedName(PKCS7Verifier verifier);
|
||||
public native PKCS7DistinguishedName getDistinguishedName(PKCS7Verifier verifier);
|
||||
|
||||
public native int validateSignature();
|
||||
public native void clearSignature();
|
||||
public native boolean isSigned();
|
||||
|
||||
public native TextWidgetLayout layoutTextWidget();
|
||||
|
||||
public static class TextWidgetLayout {
|
||||
public Matrix matrix;
|
||||
public Matrix invMatrix;
|
||||
public TextWidgetLineLayout[] lines;
|
||||
}
|
||||
|
||||
public static class TextWidgetLineLayout {
|
||||
public float x;
|
||||
public float y;
|
||||
public float fontSize;
|
||||
public int index;
|
||||
public Rect rect;
|
||||
public TextWidgetCharLayout[] chars;
|
||||
}
|
||||
|
||||
public static class TextWidgetCharLayout {
|
||||
public float x;
|
||||
public float advance;
|
||||
public int index;
|
||||
public Rect rect;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
package com.artifex.mupdf.fitz;
|
||||
|
||||
// PKCS7DesignatedName provides a friendly representation of the
|
||||
// main descriptive fields of a PKCS7 encoded certificate used
|
||||
// to sign a document
|
||||
public class PKCS7DesignatedName
|
||||
{
|
||||
public String cn; // common name
|
||||
public String o; // organization
|
||||
public String ou; // organizational unit
|
||||
public String email; // email address of signer
|
||||
public String c; // country
|
||||
}
|
35
lect-third-party/mupdf/src/main/java/com/artifex/mupdf/fitz/PKCS7DistinguishedName.java
vendored
Normal file
35
lect-third-party/mupdf/src/main/java/com/artifex/mupdf/fitz/PKCS7DistinguishedName.java
vendored
Normal file
|
@ -0,0 +1,35 @@
|
|||
// Copyright (C) 2004-2021 Artifex Software, Inc.
|
||||
//
|
||||
// This file is part of MuPDF.
|
||||
//
|
||||
// MuPDF is free software: you can redistribute it and/or modify it under the
|
||||
// terms of the GNU Affero General Public License as published by the Free
|
||||
// Software Foundation, either version 3 of the License, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// MuPDF is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
// details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with MuPDF. If not, see <https://www.gnu.org/licenses/agpl-3.0.en.html>
|
||||
//
|
||||
// Alternative licensing terms are available from the licensor.
|
||||
// For commercial licensing, see <https://www.artifex.com/> or contact
|
||||
// Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco,
|
||||
// CA 94129, USA, for further information.
|
||||
|
||||
package com.artifex.mupdf.fitz;
|
||||
|
||||
// PKCS7DistinguishedName provides a friendly representation of the
|
||||
// main descriptive fields of a PKCS7 encoded certificate used
|
||||
// to sign a document
|
||||
public class PKCS7DistinguishedName
|
||||
{
|
||||
public String cn; // common name
|
||||
public String o; // organization
|
||||
public String ou; // organizational unit
|
||||
public String email; // email address of signer
|
||||
public String c; // country
|
||||
}
|
|
@ -1,3 +1,25 @@
|
|||
// Copyright (C) 2004-2021 Artifex Software, Inc.
|
||||
//
|
||||
// This file is part of MuPDF.
|
||||
//
|
||||
// MuPDF is free software: you can redistribute it and/or modify it under the
|
||||
// terms of the GNU Affero General Public License as published by the Free
|
||||
// Software Foundation, either version 3 of the License, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// MuPDF is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
// details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with MuPDF. If not, see <https://www.gnu.org/licenses/agpl-3.0.en.html>
|
||||
//
|
||||
// Alternative licensing terms are available from the licensor.
|
||||
// For commercial licensing, see <https://www.artifex.com/> or contact
|
||||
// Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco,
|
||||
// CA 94129, USA, for further information.
|
||||
|
||||
package com.artifex.mupdf.fitz;
|
||||
|
||||
public abstract class PKCS7Signer
|
||||
|
@ -20,7 +42,7 @@ public abstract class PKCS7Signer
|
|||
pointer = newNative(this);
|
||||
}
|
||||
|
||||
public abstract PKCS7DesignatedName name();
|
||||
public abstract PKCS7DistinguishedName name();
|
||||
public abstract byte[] sign(FitzInputStream stm);
|
||||
|
||||
// Returns a value equal to at least the number of bytes required to store the signing digest.
|
||||
|
|
|
@ -1,3 +1,25 @@
|
|||
// Copyright (C) 2004-2021 Artifex Software, Inc.
|
||||
//
|
||||
// This file is part of MuPDF.
|
||||
//
|
||||
// MuPDF is free software: you can redistribute it and/or modify it under the
|
||||
// terms of the GNU Affero General Public License as published by the Free
|
||||
// Software Foundation, either version 3 of the License, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// MuPDF is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
// details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with MuPDF. If not, see <https://www.gnu.org/licenses/agpl-3.0.en.html>
|
||||
//
|
||||
// Alternative licensing terms are available from the licensor.
|
||||
// For commercial licensing, see <https://www.artifex.com/> or contact
|
||||
// Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco,
|
||||
// CA 94129, USA, for further information.
|
||||
|
||||
package com.artifex.mupdf.fitz;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
|
|
@ -1,3 +1,25 @@
|
|||
// Copyright (C) 2004-2023 Artifex Software, Inc.
|
||||
//
|
||||
// This file is part of MuPDF.
|
||||
//
|
||||
// MuPDF is free software: you can redistribute it and/or modify it under the
|
||||
// terms of the GNU Affero General Public License as published by the Free
|
||||
// Software Foundation, either version 3 of the License, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// MuPDF is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
// details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with MuPDF. If not, see <https://www.gnu.org/licenses/agpl-3.0.en.html>
|
||||
//
|
||||
// Alternative licensing terms are available from the licensor.
|
||||
// For commercial licensing, see <https://www.artifex.com/> or contact
|
||||
// Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco,
|
||||
// CA 94129, USA, for further information.
|
||||
|
||||
package com.artifex.mupdf.fitz;
|
||||
|
||||
public class Page
|
||||
|
@ -6,6 +28,13 @@ public class Page
|
|||
Context.init();
|
||||
}
|
||||
|
||||
public static final int MEDIA_BOX = 0;
|
||||
public static final int CROP_BOX = 1;
|
||||
public static final int BLEED_BOX = 2;
|
||||
public static final int TRIM_BOX = 3;
|
||||
public static final int ART_BOX = 4;
|
||||
public static final int UNKNOWN_BOX = 5;
|
||||
|
||||
private long pointer;
|
||||
|
||||
protected native void finalize();
|
||||
|
@ -18,7 +47,15 @@ public class Page
|
|||
pointer = p;
|
||||
}
|
||||
|
||||
public native Rect getBounds();
|
||||
private native Rect getBoundsNative(int box);
|
||||
|
||||
public Rect getBounds(int box) {
|
||||
return getBoundsNative(box);
|
||||
}
|
||||
|
||||
public Rect getBounds() {
|
||||
return getBoundsNative(Page.CROP_BOX);
|
||||
}
|
||||
|
||||
public native void run(Device dev, Matrix ctm, Cookie cookie);
|
||||
public native void runPageContents(Device dev, Matrix ctm, Cookie cookie);
|
||||
|
@ -46,7 +83,17 @@ public class Page
|
|||
return toStructuredText(null);
|
||||
}
|
||||
|
||||
public native Quad[] search(String needle);
|
||||
public native Quad[][] search(String needle);
|
||||
|
||||
public native byte[] textAsHtml();
|
||||
|
||||
public native Document getDocument();
|
||||
|
||||
public native Link createLink(Rect bbox, String uri);
|
||||
public Link createLink(Rect bbox, LinkDestination dest) {
|
||||
return createLink(bbox, getDocument().formatLinkURI(dest));
|
||||
}
|
||||
public native void deleteLink(Link link);
|
||||
|
||||
public native String getLabel();
|
||||
}
|
||||
|
|
|
@ -1,3 +1,25 @@
|
|||
// Copyright (C) 2004-2021 Artifex Software, Inc.
|
||||
//
|
||||
// This file is part of MuPDF.
|
||||
//
|
||||
// MuPDF is free software: you can redistribute it and/or modify it under the
|
||||
// terms of the GNU Affero General Public License as published by the Free
|
||||
// Software Foundation, either version 3 of the License, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// MuPDF is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
// details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with MuPDF. If not, see <https://www.gnu.org/licenses/agpl-3.0.en.html>
|
||||
//
|
||||
// Alternative licensing terms are available from the licensor.
|
||||
// For commercial licensing, see <https://www.artifex.com/> or contact
|
||||
// Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco,
|
||||
// CA 94129, USA, for further information.
|
||||
|
||||
package com.artifex.mupdf.fitz;
|
||||
|
||||
public class Path implements PathWalker
|
||||
|
@ -64,4 +86,47 @@ public class Path implements PathWalker
|
|||
public native Rect getBounds(StrokeState stroke, Matrix ctm);
|
||||
|
||||
public native void walk(PathWalker walker);
|
||||
|
||||
public String toString(String separator) {
|
||||
StringBuffer s = new StringBuffer();
|
||||
this.walk(new ToStringWalker(s, separator));
|
||||
return s.toString();
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return toString(" ");
|
||||
}
|
||||
|
||||
class ToStringWalker implements PathWalker {
|
||||
StringBuffer out;
|
||||
String separator;
|
||||
|
||||
public ToStringWalker(StringBuffer out, String separator) {
|
||||
this.out = out;
|
||||
this.separator = separator;
|
||||
}
|
||||
|
||||
public void moveTo(float x, float y) {
|
||||
out.append(
|
||||
Float.toString(x) + " " + Float.toString(y) +
|
||||
" m" + separator);
|
||||
}
|
||||
|
||||
public void lineTo(float x, float y) {
|
||||
out.append(
|
||||
Float.toString(x) + " " + Float.toString(y) +
|
||||
" l" + separator);
|
||||
}
|
||||
|
||||
public void curveTo(float cx1, float cy1, float cx2, float cy2, float ex, float ey) {
|
||||
out.append(
|
||||
Float.toString(cx1) + " " + Float.toString(cy1) +
|
||||
Float.toString(cx2) + " " + Float.toString(cy2) +
|
||||
" c" + separator);
|
||||
}
|
||||
|
||||
public void closePath() {
|
||||
out.append("h" + separator);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,3 +1,25 @@
|
|||
// Copyright (C) 2004-2021 Artifex Software, Inc.
|
||||
//
|
||||
// This file is part of MuPDF.
|
||||
//
|
||||
// MuPDF is free software: you can redistribute it and/or modify it under the
|
||||
// terms of the GNU Affero General Public License as published by the Free
|
||||
// Software Foundation, either version 3 of the License, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// MuPDF is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
// details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with MuPDF. If not, see <https://www.gnu.org/licenses/agpl-3.0.en.html>
|
||||
//
|
||||
// Alternative licensing terms are available from the licensor.
|
||||
// For commercial licensing, see <https://www.artifex.com/> or contact
|
||||
// Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco,
|
||||
// CA 94129, USA, for further information.
|
||||
|
||||
package com.artifex.mupdf.fitz;
|
||||
|
||||
public interface PathWalker
|
||||
|
|
|
@ -1,3 +1,25 @@
|
|||
// Copyright (C) 2004-2023 Artifex Software, Inc.
|
||||
//
|
||||
// This file is part of MuPDF.
|
||||
//
|
||||
// MuPDF is free software: you can redistribute it and/or modify it under the
|
||||
// terms of the GNU Affero General Public License as published by the Free
|
||||
// Software Foundation, either version 3 of the License, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// MuPDF is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
// details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with MuPDF. If not, see <https://www.gnu.org/licenses/agpl-3.0.en.html>
|
||||
//
|
||||
// Alternative licensing terms are available from the licensor.
|
||||
// For commercial licensing, see <https://www.artifex.com/> or contact
|
||||
// Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco,
|
||||
// CA 94129, USA, for further information.
|
||||
|
||||
package com.artifex.mupdf.fitz;
|
||||
|
||||
public class Pixmap
|
||||
|
@ -15,6 +37,7 @@ public class Pixmap
|
|||
}
|
||||
|
||||
private native long newNative(ColorSpace cs, int x, int y, int w, int h, boolean alpha);
|
||||
private native long newNativeFromColorAndMask(Pixmap color, Pixmap mask);
|
||||
|
||||
private Pixmap(long p) {
|
||||
pointer = p;
|
||||
|
@ -44,6 +67,10 @@ public class Pixmap
|
|||
this(cs, rect, false);
|
||||
}
|
||||
|
||||
public Pixmap(Pixmap color, Pixmap mask) {
|
||||
pointer = newNativeFromColorAndMask(color, mask);
|
||||
}
|
||||
|
||||
public native void clear();
|
||||
private native void clearWithValue(int value);
|
||||
public void clear(int value) {
|
||||
|
@ -51,6 +78,11 @@ public class Pixmap
|
|||
}
|
||||
|
||||
public native void saveAsPNG(String filename);
|
||||
public native void saveAsJPEG(String filename, int quality);
|
||||
public native void saveAsPAM(String filename);
|
||||
public native void saveAsPNM(String filename);
|
||||
public native void saveAsPBM(String filename);
|
||||
public native void saveAsPKM(String filename);
|
||||
|
||||
public native int getX();
|
||||
public native int getY();
|
||||
|
@ -65,10 +97,14 @@ public class Pixmap
|
|||
public native int[] getPixels(); /* only valid for RGBA or BGRA pixmaps */
|
||||
public native int getXResolution();
|
||||
public native int getYResolution();
|
||||
|
||||
public native void setResolution(int xres, int yres);
|
||||
|
||||
public native void invert();
|
||||
public native void invertLuminance();
|
||||
public native void gamma(float gamma);
|
||||
public native void tint(int black, int white);
|
||||
public native Pixmap convertToColorSpace(ColorSpace cs, ColorSpace proof, DefaultColorSpaces defaultCs, int colorParams, boolean keepAlpha);
|
||||
|
||||
public Rect getBounds() {
|
||||
int x = getX();
|
||||
|
|
|
@ -1,5 +1,29 @@
|
|||
// Copyright (C) 2004-2022 Artifex Software, Inc.
|
||||
//
|
||||
// This file is part of MuPDF.
|
||||
//
|
||||
// MuPDF is free software: you can redistribute it and/or modify it under the
|
||||
// terms of the GNU Affero General Public License as published by the Free
|
||||
// Software Foundation, either version 3 of the License, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// MuPDF is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
// details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with MuPDF. If not, see <https://www.gnu.org/licenses/agpl-3.0.en.html>
|
||||
//
|
||||
// Alternative licensing terms are available from the licensor.
|
||||
// For commercial licensing, see <https://www.artifex.com/> or contact
|
||||
// Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco,
|
||||
// CA 94129, USA, for further information.
|
||||
|
||||
package com.artifex.mupdf.fitz;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class Point
|
||||
{
|
||||
public float x;
|
||||
|
@ -27,4 +51,17 @@ public class Point
|
|||
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (!(obj instanceof Point))
|
||||
return false;
|
||||
Point other = (Point) obj;
|
||||
return x == other.x && y == other.y;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(x, y);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,29 @@
|
|||
// Copyright (C) 2004-2022 Artifex Software, Inc.
|
||||
//
|
||||
// This file is part of MuPDF.
|
||||
//
|
||||
// MuPDF is free software: you can redistribute it and/or modify it under the
|
||||
// terms of the GNU Affero General Public License as published by the Free
|
||||
// Software Foundation, either version 3 of the License, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// MuPDF is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
// details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with MuPDF. If not, see <https://www.gnu.org/licenses/agpl-3.0.en.html>
|
||||
//
|
||||
// Alternative licensing terms are available from the licensor.
|
||||
// For commercial licensing, see <https://www.artifex.com/> or contact
|
||||
// Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco,
|
||||
// CA 94129, USA, for further information.
|
||||
|
||||
package com.artifex.mupdf.fitz;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class Quad
|
||||
{
|
||||
public float ul_x, ul_y;
|
||||
|
@ -18,6 +42,17 @@ public class Quad
|
|||
this.lr_y = lr_y;
|
||||
}
|
||||
|
||||
public Quad(Rect r) {
|
||||
this.ul_x = r.x0;
|
||||
this.ul_y = r.y0;
|
||||
this.ur_x = r.x1;
|
||||
this.ur_y = r.y0;
|
||||
this.ll_x = r.x0;
|
||||
this.ll_y = r.y1;
|
||||
this.lr_x = r.x1;
|
||||
this.lr_y = r.y1;
|
||||
}
|
||||
|
||||
public Rect toRect() {
|
||||
float x0 = Math.min(Math.min(ul_x, ur_x), Math.min(ll_x, lr_x));
|
||||
float y0 = Math.min(Math.min(ul_y, ur_y), Math.min(ll_y, lr_y));
|
||||
|
@ -63,6 +98,31 @@ public class Quad
|
|||
return this;
|
||||
}
|
||||
|
||||
protected boolean triangleContainsPoint(float x, float y, float ax, float ay, float bx, float by, float cx, float cy) {
|
||||
float s, t, area;
|
||||
s = ay * cx - ax * cy + (cy - ay) * x + (ax - cx) * y;
|
||||
t = ax * by - ay * bx + (ay - by) * x + (bx - ax) * y;
|
||||
|
||||
if ((s < 0) != (t < 0))
|
||||
return false;
|
||||
|
||||
area = -by * cx + ay * (cx - bx) + ax * (by - cy) + bx * cy;
|
||||
|
||||
return area < 0 ?
|
||||
(s <= 0 && s + t >= area) :
|
||||
(s >= 0 && s + t <= area);
|
||||
}
|
||||
|
||||
public boolean contains(float x, float y) {
|
||||
return triangleContainsPoint(x, y, ul_x, ul_y, ur_x, ur_y, lr_x, lr_y) ||
|
||||
triangleContainsPoint(x, y, ul_x, ul_y, lr_x, lr_y, ll_x, ll_y);
|
||||
|
||||
}
|
||||
|
||||
public boolean contains(Point p) {
|
||||
return contains(p.x, p.y);
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "["
|
||||
+ ul_x + " " + ul_y + " "
|
||||
|
@ -71,4 +131,19 @@ public class Quad
|
|||
+ lr_x + " " + lr_y
|
||||
+ "]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (!(obj instanceof Quad))
|
||||
return false;
|
||||
Quad other = (Quad) obj;
|
||||
return ul_x == other.ul_x && ul_y == other.ul_y && ur_x == other.ur_x &&
|
||||
ur_y == other.ur_y && ll_x == other.ll_x && ll_y == other.ll_y &&
|
||||
lr_x == other.lr_x && lr_y == other.lr_y;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(ul_x, ul_y, ur_x, ur_y, ll_x, ll_y, lr_x, lr_y);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,3 +1,25 @@
|
|||
// Copyright (C) 2004-2021 Artifex Software, Inc.
|
||||
//
|
||||
// This file is part of MuPDF.
|
||||
//
|
||||
// MuPDF is free software: you can redistribute it and/or modify it under the
|
||||
// terms of the GNU Affero General Public License as published by the Free
|
||||
// Software Foundation, either version 3 of the License, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// MuPDF is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
// details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with MuPDF. If not, see <https://www.gnu.org/licenses/agpl-3.0.en.html>
|
||||
//
|
||||
// Alternative licensing terms are available from the licensor.
|
||||
// For commercial licensing, see <https://www.artifex.com/> or contact
|
||||
// Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco,
|
||||
// CA 94129, USA, for further information.
|
||||
|
||||
package com.artifex.mupdf.fitz;
|
||||
|
||||
public class Rect
|
||||
|
@ -11,9 +33,17 @@ public class Rect
|
|||
public float x1;
|
||||
public float y1;
|
||||
|
||||
// Minimum and Maximum values that can survive round trip
|
||||
// from int to float.
|
||||
private static final int FZ_MIN_INF_RECT = 0x80000000;
|
||||
private static final int FZ_MAX_INF_RECT = 0x7fffff80;
|
||||
|
||||
public Rect()
|
||||
{
|
||||
x0 = y0 = x1 = y1 = 0;
|
||||
// Invalid (hence zero area) rectangle. Unioning
|
||||
// this with any rectangle (or point) will 'cure' it
|
||||
x0 = y0 = FZ_MAX_INF_RECT;
|
||||
x1 = y1 = FZ_MIN_INF_RECT;
|
||||
}
|
||||
|
||||
public Rect(float x0, float y0, float x1, float y1)
|
||||
|
@ -49,8 +79,21 @@ public class Rect
|
|||
return "[" + x0 + " " + y0 + " " + x1 + " " + y1 + "]";
|
||||
}
|
||||
|
||||
public boolean isInfinite()
|
||||
{
|
||||
return this.x0 == FZ_MIN_INF_RECT &&
|
||||
this.y0 == FZ_MIN_INF_RECT &&
|
||||
this.x1 == FZ_MAX_INF_RECT &&
|
||||
this.y1 == FZ_MAX_INF_RECT;
|
||||
}
|
||||
|
||||
public Rect transform(Matrix tm)
|
||||
{
|
||||
if (this.isInfinite())
|
||||
return this;
|
||||
if (!this.isValid())
|
||||
return this;
|
||||
|
||||
float ax0 = x0 * tm.a;
|
||||
float ax1 = x1 * tm.a;
|
||||
|
||||
|
@ -111,6 +154,11 @@ public class Rect
|
|||
return (x >= x0 && x < x1 && y >= y0 && y < y1);
|
||||
}
|
||||
|
||||
public boolean contains(Point p)
|
||||
{
|
||||
return contains(p.x, p.y);
|
||||
}
|
||||
|
||||
public boolean contains(Rect r)
|
||||
{
|
||||
if (isEmpty() || r.isEmpty())
|
||||
|
@ -121,28 +169,71 @@ public class Rect
|
|||
|
||||
public boolean isEmpty()
|
||||
{
|
||||
return (x0 == x1 || y0 == y1);
|
||||
return (x0 >= x1 || y0 >= y1);
|
||||
}
|
||||
|
||||
public boolean isValid()
|
||||
{
|
||||
return (x0 <= x1 && y0 <= y1);
|
||||
}
|
||||
|
||||
public void union(Rect r)
|
||||
{
|
||||
if (isEmpty())
|
||||
if (!r.isValid() || this.isInfinite())
|
||||
return;
|
||||
if (!this.isValid() || r.isInfinite())
|
||||
{
|
||||
x0 = r.x0;
|
||||
y0 = r.y0;
|
||||
x1 = r.x1;
|
||||
y1 = r.y1;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (r.x0 < x0)
|
||||
x0 = r.x0;
|
||||
if (r.y0 < y0)
|
||||
y0 = r.y0;
|
||||
if (r.x1 > x1)
|
||||
x1 = r.x1;
|
||||
if (r.y1 > y1)
|
||||
y1 = r.y1;
|
||||
}
|
||||
|
||||
if (r.x0 < x0)
|
||||
x0 = r.x0;
|
||||
if (r.y0 < y0)
|
||||
y0 = r.y0;
|
||||
if (r.x1 > x1)
|
||||
x1 = r.x1;
|
||||
if (r.y1 > y1)
|
||||
y1 = r.y1;
|
||||
}
|
||||
|
||||
public void inset(float dx, float dy) {
|
||||
if (!isValid() || isInfinite() || isEmpty())
|
||||
return;
|
||||
x0 += dx;
|
||||
y0 += dy;
|
||||
x1 -= dx;
|
||||
y1 -= dy;
|
||||
}
|
||||
|
||||
public void inset(float left, float top, float right, float bottom) {
|
||||
if (!isValid() || isInfinite() || isEmpty())
|
||||
return;
|
||||
x0 += left;
|
||||
y0 += top;
|
||||
x1 -= right;
|
||||
y1 -= bottom;
|
||||
}
|
||||
|
||||
public void offset(float dx, float dy) {
|
||||
if (!isValid() || isInfinite() || isEmpty())
|
||||
return;
|
||||
x0 += dx;
|
||||
y0 += dy;
|
||||
x1 += dx;
|
||||
y1 += dy;
|
||||
}
|
||||
|
||||
public void offsetTo(float left, float top) {
|
||||
if (!isValid() || isInfinite() || isEmpty())
|
||||
return;
|
||||
x1 += left - x0;
|
||||
y1 += top - y0;
|
||||
x0 = left;
|
||||
y0 = top;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,3 +1,25 @@
|
|||
// Copyright (C) 2004-2021 Artifex Software, Inc.
|
||||
//
|
||||
// This file is part of MuPDF.
|
||||
//
|
||||
// MuPDF is free software: you can redistribute it and/or modify it under the
|
||||
// terms of the GNU Affero General Public License as published by the Free
|
||||
// Software Foundation, either version 3 of the License, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// MuPDF is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
// details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with MuPDF. If not, see <https://www.gnu.org/licenses/agpl-3.0.en.html>
|
||||
//
|
||||
// Alternative licensing terms are available from the licensor.
|
||||
// For commercial licensing, see <https://www.artifex.com/> or contact
|
||||
// Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco,
|
||||
// CA 94129, USA, for further information.
|
||||
|
||||
package com.artifex.mupdf.fitz;
|
||||
|
||||
public class RectI
|
||||
|
@ -7,9 +29,17 @@ public class RectI
|
|||
public int x1;
|
||||
public int y1;
|
||||
|
||||
// Minimum and Maximum values that can survive round trip
|
||||
// from int to float.
|
||||
private static final int FZ_MIN_INF_RECT = 0x80000000;
|
||||
private static final int FZ_MAX_INF_RECT = 0x7fffff80;
|
||||
|
||||
public RectI()
|
||||
{
|
||||
x0 = y0 = x1 = y1 = 0;
|
||||
// Invalid (hence zero area) rectangle. Unioning
|
||||
// this with any rectangle (or point) will 'cure' it
|
||||
x0 = y0 = FZ_MAX_INF_RECT;
|
||||
x1 = y1 = FZ_MIN_INF_RECT;
|
||||
}
|
||||
|
||||
public RectI(int x0, int y0, int x1, int y1) {
|
||||
|
@ -34,7 +64,21 @@ public class RectI
|
|||
return "[" + x0 + " " + y0 + " " + x1 + " " + y1 + "]";
|
||||
}
|
||||
|
||||
public RectI transform(Matrix tm) {
|
||||
public boolean isInfinite()
|
||||
{
|
||||
return this.x0 == FZ_MIN_INF_RECT &&
|
||||
this.y0 == FZ_MIN_INF_RECT &&
|
||||
this.x1 == FZ_MAX_INF_RECT &&
|
||||
this.y1 == FZ_MAX_INF_RECT;
|
||||
}
|
||||
|
||||
public RectI transform(Matrix tm)
|
||||
{
|
||||
if (this.isInfinite())
|
||||
return this;
|
||||
if (!this.isValid())
|
||||
return this;
|
||||
|
||||
float ax0 = x0 * tm.a;
|
||||
float ax1 = x1 * tm.a;
|
||||
|
||||
|
@ -101,28 +145,70 @@ public class RectI
|
|||
|
||||
public boolean isEmpty()
|
||||
{
|
||||
return (x0 == x1 || y0 == y1);
|
||||
return (x0 >= x1 || y0 >= y1);
|
||||
}
|
||||
|
||||
public boolean isValid()
|
||||
{
|
||||
return (x0 <= x1 || y0 <= y1);
|
||||
}
|
||||
|
||||
public void union(RectI r)
|
||||
{
|
||||
if (isEmpty())
|
||||
if (!r.isValid() || this.isInfinite())
|
||||
return;
|
||||
if (!this.isValid() || r.isInfinite())
|
||||
{
|
||||
x0 = r.x0;
|
||||
y0 = r.y0;
|
||||
x1 = r.x1;
|
||||
y1 = r.y1;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (r.x0 < x0)
|
||||
x0 = r.x0;
|
||||
if (r.y0 < y0)
|
||||
y0 = r.y0;
|
||||
if (r.x1 > x1)
|
||||
x1 = r.x1;
|
||||
if (r.y1 > y1)
|
||||
y1 = r.y1;
|
||||
}
|
||||
|
||||
if (r.x0 < x0)
|
||||
x0 = r.x0;
|
||||
if (r.y0 < y0)
|
||||
y0 = r.y0;
|
||||
if (r.x1 > x1)
|
||||
x1 = r.x1;
|
||||
if (r.y1 > y1)
|
||||
y1 = r.y1;
|
||||
}
|
||||
|
||||
public void inset(int dx, int dy) {
|
||||
if (!this.isValid() || this.isInfinite() || this.isEmpty())
|
||||
return;
|
||||
x0 += dx;
|
||||
y0 += dy;
|
||||
x1 -= dx;
|
||||
y1 -= dy;
|
||||
}
|
||||
|
||||
public void inset(int left, int top, int right, int bottom) {
|
||||
if (!this.isValid() || this.isInfinite() || this.isEmpty())
|
||||
return;
|
||||
x0 += left;
|
||||
y0 += top;
|
||||
x1 -= right;
|
||||
y1 -= bottom;
|
||||
}
|
||||
|
||||
public void offset(int dx, int dy) {
|
||||
if (!this.isValid() || this.isInfinite() || this.isEmpty())
|
||||
return;
|
||||
x0 += dx;
|
||||
y0 += dy;
|
||||
x1 += dx;
|
||||
y1 += dy;
|
||||
}
|
||||
|
||||
public void offsetTo(int left, int top) {
|
||||
if (!this.isValid() || this.isInfinite() || this.isEmpty())
|
||||
return;
|
||||
x1 += left - x0;
|
||||
y1 += top - y0;
|
||||
x0 = left;
|
||||
y0 = top;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,3 +1,25 @@
|
|||
// Copyright (C) 2004-2021 Artifex Software, Inc.
|
||||
//
|
||||
// This file is part of MuPDF.
|
||||
//
|
||||
// MuPDF is free software: you can redistribute it and/or modify it under the
|
||||
// terms of the GNU Affero General Public License as published by the Free
|
||||
// Software Foundation, either version 3 of the License, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// MuPDF is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
// details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with MuPDF. If not, see <https://www.gnu.org/licenses/agpl-3.0.en.html>
|
||||
//
|
||||
// Alternative licensing terms are available from the licensor.
|
||||
// For commercial licensing, see <https://www.artifex.com/> or contact
|
||||
// Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco,
|
||||
// CA 94129, USA, for further information.
|
||||
|
||||
package com.artifex.mupdf.fitz;
|
||||
|
||||
public interface SeekableInputOutputStream extends SeekableOutputStream, SeekableInputStream
|
||||
|
|
|
@ -1,3 +1,25 @@
|
|||
// Copyright (C) 2004-2021 Artifex Software, Inc.
|
||||
//
|
||||
// This file is part of MuPDF.
|
||||
//
|
||||
// MuPDF is free software: you can redistribute it and/or modify it under the
|
||||
// terms of the GNU Affero General Public License as published by the Free
|
||||
// Software Foundation, either version 3 of the License, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// MuPDF is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
// details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with MuPDF. If not, see <https://www.gnu.org/licenses/agpl-3.0.en.html>
|
||||
//
|
||||
// Alternative licensing terms are available from the licensor.
|
||||
// For commercial licensing, see <https://www.artifex.com/> or contact
|
||||
// Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco,
|
||||
// CA 94129, USA, for further information.
|
||||
|
||||
package com.artifex.mupdf.fitz;
|
||||
|
||||
import java.io.IOException;
|
||||
|
|
|
@ -1,3 +1,25 @@
|
|||
// Copyright (C) 2004-2021 Artifex Software, Inc.
|
||||
//
|
||||
// This file is part of MuPDF.
|
||||
//
|
||||
// MuPDF is free software: you can redistribute it and/or modify it under the
|
||||
// terms of the GNU Affero General Public License as published by the Free
|
||||
// Software Foundation, either version 3 of the License, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// MuPDF is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
// details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with MuPDF. If not, see <https://www.gnu.org/licenses/agpl-3.0.en.html>
|
||||
//
|
||||
// Alternative licensing terms are available from the licensor.
|
||||
// For commercial licensing, see <https://www.artifex.com/> or contact
|
||||
// Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco,
|
||||
// CA 94129, USA, for further information.
|
||||
|
||||
package com.artifex.mupdf.fitz;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -6,4 +28,7 @@ public interface SeekableOutputStream extends SeekableStream
|
|||
{
|
||||
/* Behaves like java.io.OutputStream.write */
|
||||
void write(byte[] b, int off, int len) throws IOException;
|
||||
|
||||
/* Truncate SeekableOutputStream at current position() */
|
||||
void truncate() throws IOException;
|
||||
}
|
||||
|
|
|
@ -1,3 +1,25 @@
|
|||
// Copyright (C) 2004-2021 Artifex Software, Inc.
|
||||
//
|
||||
// This file is part of MuPDF.
|
||||
//
|
||||
// MuPDF is free software: you can redistribute it and/or modify it under the
|
||||
// terms of the GNU Affero General Public License as published by the Free
|
||||
// Software Foundation, either version 3 of the License, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// MuPDF is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
// details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with MuPDF. If not, see <https://www.gnu.org/licenses/agpl-3.0.en.html>
|
||||
//
|
||||
// Alternative licensing terms are available from the licensor.
|
||||
// For commercial licensing, see <https://www.artifex.com/> or contact
|
||||
// Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco,
|
||||
// CA 94129, USA, for further information.
|
||||
|
||||
package com.artifex.mupdf.fitz;
|
||||
|
||||
import java.io.IOException;
|
||||
|
|
|
@ -1,3 +1,25 @@
|
|||
// Copyright (C) 2004-2021 Artifex Software, Inc.
|
||||
//
|
||||
// This file is part of MuPDF.
|
||||
//
|
||||
// MuPDF is free software: you can redistribute it and/or modify it under the
|
||||
// terms of the GNU Affero General Public License as published by the Free
|
||||
// Software Foundation, either version 3 of the License, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// MuPDF is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
// details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with MuPDF. If not, see <https://www.gnu.org/licenses/agpl-3.0.en.html>
|
||||
//
|
||||
// Alternative licensing terms are available from the licensor.
|
||||
// For commercial licensing, see <https://www.artifex.com/> or contact
|
||||
// Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco,
|
||||
// CA 94129, USA, for further information.
|
||||
|
||||
package com.artifex.mupdf.fitz;
|
||||
|
||||
public class Shade
|
||||
|
|
82
lect-third-party/mupdf/src/main/java/com/artifex/mupdf/fitz/Story.java
vendored
Normal file
82
lect-third-party/mupdf/src/main/java/com/artifex/mupdf/fitz/Story.java
vendored
Normal file
|
@ -0,0 +1,82 @@
|
|||
// Copyright (C) 2022 Artifex Software, Inc.
|
||||
//
|
||||
// This file is part of MuPDF.
|
||||
//
|
||||
// MuPDF is free software: you can redistribute it and/or modify it under the
|
||||
// terms of the GNU Affero General Public License as published by the Free
|
||||
// Software Foundation, either version 3 of the License, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// MuPDF is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
// details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with MuPDF. If not, see <https://www.gnu.org/licenses/agpl-3.0.en.html>
|
||||
//
|
||||
// Alternative licensing terms are available from the licensor.
|
||||
// For commercial licensing, see <https://www.artifex.com/> or contact
|
||||
// Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco,
|
||||
// CA 94129, USA, for further information.
|
||||
|
||||
package com.artifex.mupdf.fitz;
|
||||
|
||||
public class Story
|
||||
{
|
||||
static {
|
||||
Context.init();
|
||||
}
|
||||
|
||||
protected long pointer;
|
||||
|
||||
protected native void finalize();
|
||||
|
||||
public void destroy() {
|
||||
finalize();
|
||||
}
|
||||
|
||||
private static native long newStory(byte[] content, byte[] user_css, float em, Archive arch);
|
||||
|
||||
public Story(String content, String user_css, float em, Archive arch)
|
||||
{
|
||||
pointer = newStory(content.getBytes(), user_css.getBytes(), em, arch);
|
||||
}
|
||||
public Story(String content, String user_css, float em)
|
||||
{
|
||||
this(content, user_css, em, null);
|
||||
}
|
||||
|
||||
public Story(byte[] content, String user_css, float em, Archive arch)
|
||||
{
|
||||
pointer = newStory(content, user_css.getBytes(), em, arch);
|
||||
}
|
||||
public Story(byte[] content, String user_css, float em)
|
||||
{
|
||||
this(content, user_css, em, null);
|
||||
}
|
||||
|
||||
public Story(String content, byte[] user_css, float em, Archive arch)
|
||||
{
|
||||
pointer = newStory(content.getBytes(), user_css, em, arch);
|
||||
}
|
||||
public Story(String content, byte[] user_css, float em)
|
||||
{
|
||||
this(content, user_css, em, null);
|
||||
}
|
||||
|
||||
public Story(byte[] content, byte[] user_css, float em, Archive arch)
|
||||
{
|
||||
pointer = newStory(content, user_css, em, arch);
|
||||
}
|
||||
public Story(byte[] content, byte[] user_css, float em)
|
||||
{
|
||||
this(content, user_css, em, null);
|
||||
}
|
||||
|
||||
public native boolean place(Rect rect, Rect filled);
|
||||
|
||||
public native void draw(Device dev, Matrix ctm);
|
||||
|
||||
public native DOM document();
|
||||
}
|
|
@ -1,3 +1,25 @@
|
|||
// Copyright (C) 2004-2021 Artifex Software, Inc.
|
||||
//
|
||||
// This file is part of MuPDF.
|
||||
//
|
||||
// MuPDF is free software: you can redistribute it and/or modify it under the
|
||||
// terms of the GNU Affero General Public License as published by the Free
|
||||
// Software Foundation, either version 3 of the License, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// MuPDF is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
// details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with MuPDF. If not, see <https://www.gnu.org/licenses/agpl-3.0.en.html>
|
||||
//
|
||||
// Alternative licensing terms are available from the licensor.
|
||||
// For commercial licensing, see <https://www.artifex.com/> or contact
|
||||
// Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco,
|
||||
// CA 94129, USA, for further information.
|
||||
|
||||
package com.artifex.mupdf.fitz;
|
||||
|
||||
public class StrokeState
|
||||
|
@ -24,7 +46,7 @@ public class StrokeState
|
|||
finalize();
|
||||
}
|
||||
|
||||
private native long newNative(int startCap, int dashCap, int endCap, int lineJoin, float lineWidth, float miterLimit,
|
||||
private native long newNativeStrokeState(int startCap, int dashCap, int endCap, int lineJoin, float lineWidth, float miterLimit,
|
||||
float dashPhase, float[] dash);
|
||||
|
||||
// Private constructor for the C to use. Any objects created by the
|
||||
|
@ -37,12 +59,12 @@ public class StrokeState
|
|||
}
|
||||
|
||||
public StrokeState(int startCap, int endCap, int lineJoin, float lineWidth, float miterLimit) {
|
||||
pointer = newNative(startCap, 0, endCap, lineJoin, lineWidth, miterLimit, 0, null);
|
||||
pointer = newNativeStrokeState(startCap, 0, endCap, lineJoin, lineWidth, miterLimit, 0, null);
|
||||
}
|
||||
|
||||
public StrokeState(int startCap, int dashCap, int endCap, int lineJoin, float lineWidth, float miterLimit,
|
||||
float dashPhase, float[] dash) {
|
||||
pointer = newNative(startCap, dashCap, endCap, lineJoin, lineWidth, miterLimit, dashPhase, dash);
|
||||
pointer = newNativeStrokeState(startCap, dashCap, endCap, lineJoin, lineWidth, miterLimit, dashPhase, dash);
|
||||
}
|
||||
|
||||
public native int getStartCap();
|
||||
|
|
|
@ -1,3 +1,25 @@
|
|||
// Copyright (C) 2004-2021 Artifex Software, Inc.
|
||||
//
|
||||
// This file is part of MuPDF.
|
||||
//
|
||||
// MuPDF is free software: you can redistribute it and/or modify it under the
|
||||
// terms of the GNU Affero General Public License as published by the Free
|
||||
// Software Foundation, either version 3 of the License, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// MuPDF is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
// details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with MuPDF. If not, see <https://www.gnu.org/licenses/agpl-3.0.en.html>
|
||||
//
|
||||
// Alternative licensing terms are available from the licensor.
|
||||
// For commercial licensing, see <https://www.artifex.com/> or contact
|
||||
// Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco,
|
||||
// CA 94129, USA, for further information.
|
||||
|
||||
package com.artifex.mupdf.fitz;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -24,7 +46,7 @@ public class StructuredText
|
|||
pointer = p;
|
||||
}
|
||||
|
||||
public native Quad[] search(String needle);
|
||||
public native Quad[][] search(String needle);
|
||||
public native Quad[] highlight(Point a, Point b);
|
||||
public native Quad snapSelection(Point a, Point b, int mode);
|
||||
public native String copy(Point a, Point b);
|
||||
|
@ -42,6 +64,7 @@ public class StructuredText
|
|||
ArrayList<TextLine> lines;
|
||||
ArrayList<TextChar> chrs;
|
||||
Rect lineBbox;
|
||||
Point lineDir;
|
||||
Rect blockBbox;
|
||||
|
||||
BlockWalker() {
|
||||
|
@ -63,14 +86,16 @@ public class StructuredText
|
|||
blocks.add(block);
|
||||
}
|
||||
|
||||
public void beginLine(Rect bbox, int wmode) {
|
||||
public void beginLine(Rect bbox, int wmode, Point dir) {
|
||||
chrs = new ArrayList<TextChar>();
|
||||
lineBbox = bbox;
|
||||
lineDir = dir;
|
||||
}
|
||||
|
||||
public void endLine() {
|
||||
TextLine line = new TextLine();
|
||||
line.bbox = lineBbox;
|
||||
line.dir = lineDir;
|
||||
line.chars = chrs.toArray(new TextChar[0]);
|
||||
lines.add(line);
|
||||
}
|
||||
|
@ -79,6 +104,7 @@ public class StructuredText
|
|||
TextChar chr = new TextChar();
|
||||
chr.c = c;
|
||||
chr.quad = quad;
|
||||
chr.origin = origin;
|
||||
chrs.add(chr);
|
||||
}
|
||||
|
||||
|
@ -87,19 +113,21 @@ public class StructuredText
|
|||
}
|
||||
}
|
||||
|
||||
public class TextBlock {
|
||||
public static class TextBlock {
|
||||
public TextLine[] lines;
|
||||
public Rect bbox;
|
||||
}
|
||||
|
||||
public class TextLine {
|
||||
public static class TextLine {
|
||||
public TextChar[] chars;
|
||||
public Rect bbox;
|
||||
public Point dir;
|
||||
}
|
||||
|
||||
public class TextChar {
|
||||
public static class TextChar {
|
||||
public int c;
|
||||
public Quad quad;
|
||||
public Point origin;
|
||||
public boolean isWhitespace() {
|
||||
return Character.isWhitespace(c);
|
||||
}
|
||||
|
|
|
@ -1,3 +1,25 @@
|
|||
// Copyright (C) 2004-2021 Artifex Software, Inc.
|
||||
//
|
||||
// This file is part of MuPDF.
|
||||
//
|
||||
// MuPDF is free software: you can redistribute it and/or modify it under the
|
||||
// terms of the GNU Affero General Public License as published by the Free
|
||||
// Software Foundation, either version 3 of the License, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// MuPDF is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
// details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with MuPDF. If not, see <https://www.gnu.org/licenses/agpl-3.0.en.html>
|
||||
//
|
||||
// Alternative licensing terms are available from the licensor.
|
||||
// For commercial licensing, see <https://www.artifex.com/> or contact
|
||||
// Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco,
|
||||
// CA 94129, USA, for further information.
|
||||
|
||||
package com.artifex.mupdf.fitz;
|
||||
|
||||
public interface StructuredTextWalker
|
||||
|
@ -5,7 +27,7 @@ public interface StructuredTextWalker
|
|||
void onImageBlock(Rect bbox, Matrix transform, Image image);
|
||||
void beginTextBlock(Rect bbox);
|
||||
void endTextBlock();
|
||||
void beginLine(Rect bbox, int wmode);
|
||||
void beginLine(Rect bbox, int wmode, Point dir);
|
||||
void endLine();
|
||||
void onChar(int c, Point origin, Font font, float size, Quad q);
|
||||
}
|
||||
|
|
|
@ -1,3 +1,25 @@
|
|||
// Copyright (C) 2004-2021 Artifex Software, Inc.
|
||||
//
|
||||
// This file is part of MuPDF.
|
||||
//
|
||||
// MuPDF is free software: you can redistribute it and/or modify it under the
|
||||
// terms of the GNU Affero General Public License as published by the Free
|
||||
// Software Foundation, either version 3 of the License, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// MuPDF is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
// details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with MuPDF. If not, see <https://www.gnu.org/licenses/agpl-3.0.en.html>
|
||||
//
|
||||
// Alternative licensing terms are available from the licensor.
|
||||
// For commercial licensing, see <https://www.artifex.com/> or contact
|
||||
// Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco,
|
||||
// CA 94129, USA, for further information.
|
||||
|
||||
package com.artifex.mupdf.fitz;
|
||||
|
||||
public class Text implements TextWalker
|
||||
|
|
|
@ -1,3 +1,25 @@
|
|||
// Copyright (C) 2004-2021 Artifex Software, Inc.
|
||||
//
|
||||
// This file is part of MuPDF.
|
||||
//
|
||||
// MuPDF is free software: you can redistribute it and/or modify it under the
|
||||
// terms of the GNU Affero General Public License as published by the Free
|
||||
// Software Foundation, either version 3 of the License, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// MuPDF is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
// details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with MuPDF. If not, see <https://www.gnu.org/licenses/agpl-3.0.en.html>
|
||||
//
|
||||
// Alternative licensing terms are available from the licensor.
|
||||
// For commercial licensing, see <https://www.artifex.com/> or contact
|
||||
// Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco,
|
||||
// CA 94129, USA, for further information.
|
||||
|
||||
package com.artifex.mupdf.fitz;
|
||||
|
||||
public interface TextWalker
|
||||
|
|
34
lect-third-party/mupdf/src/main/java/com/artifex/mupdf/fitz/TreeArchive.java
vendored
Normal file
34
lect-third-party/mupdf/src/main/java/com/artifex/mupdf/fitz/TreeArchive.java
vendored
Normal file
|
@ -0,0 +1,34 @@
|
|||
// Copyright (C) 2004-2022 Artifex Software, Inc.
|
||||
//
|
||||
// This file is part of MuPDF.
|
||||
//
|
||||
// MuPDF is free software: you can redistribute it and/or modify it under the
|
||||
// terms of the GNU Affero General Public License as published by the Free
|
||||
// Software Foundation, either version 3 of the License, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// MuPDF is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
// details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with MuPDF. If not, see <https://www.gnu.org/licenses/agpl-3.0.en.html>
|
||||
//
|
||||
// Alternative licensing terms are available from the licensor.
|
||||
// For commercial licensing, see <https://www.artifex.com/> or contact
|
||||
// Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco,
|
||||
// CA 94129, USA, for further information.
|
||||
|
||||
package com.artifex.mupdf.fitz;
|
||||
|
||||
public class TreeArchive extends Archive
|
||||
{
|
||||
static {
|
||||
Context.init();
|
||||
}
|
||||
|
||||
private TreeArchive(long p) { super(p); }
|
||||
|
||||
public native void add(String name, Buffer buf);
|
||||
}
|
|
@ -1,3 +1,25 @@
|
|||
// Copyright (C) 2004-2021 Artifex Software, Inc.
|
||||
//
|
||||
// This file is part of MuPDF.
|
||||
//
|
||||
// MuPDF is free software: you can redistribute it and/or modify it under the
|
||||
// terms of the GNU Affero General Public License as published by the Free
|
||||
// Software Foundation, either version 3 of the License, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// MuPDF is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
// details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with MuPDF. If not, see <https://www.gnu.org/licenses/agpl-3.0.en.html>
|
||||
//
|
||||
// Alternative licensing terms are available from the licensor.
|
||||
// For commercial licensing, see <https://www.artifex.com/> or contact
|
||||
// Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco,
|
||||
// CA 94129, USA, for further information.
|
||||
|
||||
package com.artifex.mupdf.fitz;
|
||||
|
||||
public class TryLaterException extends RuntimeException
|
||||
|
|
Binary file not shown.
BIN
lib/native/macos-arm64/ffmpeg
Executable file
BIN
lib/native/macos-arm64/ffmpeg
Executable file
Binary file not shown.
BIN
lib/native/macos-arm64/libmupdf.dylib
Executable file
BIN
lib/native/macos-arm64/libmupdf.dylib
Executable file
Binary file not shown.
BIN
lib/native/macos-x86_64/libmupdf.dylib
Executable file
BIN
lib/native/macos-x86_64/libmupdf.dylib
Executable file
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue