itextpdf 上传下载
****************
相关类与接口
PdfTextExtractor:读取pdf文档内容
public final class PdfTextExtractor {
private PdfTextExtractor() {
}
public static String getTextFromPage(PdfPage page, ITextExtractionStrategy strategy, Map<String, IContentOperator> additionalContentOperators) {
PdfCanvasProcessor parser = new PdfCanvasProcessor(strategy, additionalContentOperators);
parser.processPageContent(page);
return strategy.getResultantText();
}
public static String getTextFromPage(PdfPage page, ITextExtractionStrategy strategy) {
return getTextFromPage(page, strategy, new HashMap());
}
public static String getTextFromPage(PdfPage page) {
return getTextFromPage(page, new LocationTextExtractionStrategy());
}
}
PdfReader:PdfDocument构造参数,通过PdfDocument执行很多pdf操作
public class PdfReader implements Closeable {
public static final PdfReader.StrictnessLevel DEFAULT_STRICTNESS_LEVEL;
private static final String endstream1 = "endstream";
private static final String endstream2 = "\nendstream";
private static final String endstream3 = "\r\nendstream";
private static final String endstream4 = "\rendstream";
private static final byte[] endstream;
private static final byte[] endobj;
protected static boolean correctStreamLength;
private boolean unethicalReading;
private boolean memorySavingMode;
private PdfReader.StrictnessLevel strictnessLevel;
private PdfIndirectReference currentIndirectReference;
protected PdfTokenizer tokens;
protected PdfEncryption decrypt;
protected PdfVersion headerPdfVersion;
protected long lastXref;
protected long eofPos;
protected PdfDictionary trailer;
protected PdfDocument pdfDocument;
protected PdfAConformanceLevel pdfAConformanceLevel;
protected ReaderProperties properties;
protected boolean encrypted;
protected boolean rebuiltXref;
protected boolean hybridXref;
protected boolean fixedXref;
protected boolean xrefStm;
********
构造方法
public PdfReader(IRandomAccessSource byteSource, ReaderProperties properties) throws IOException {
public PdfReader(InputStream is, ReaderProperties properties) throws IOException {
public PdfReader(File file) throws FileNotFoundException, IOException {
public PdfReader(InputStream is) throws IOException {
public PdfReader(String filename, ReaderProperties properties) throws IOException {
public PdfReader(String filename) throws IOException {
PdfReader(IRandomAccessSource byteSource, ReaderProperties properties, boolean closeStream) throws IOException {
********
普通方法
public voi