Skip to content
This repository has been archived by the owner on Nov 29, 2019. It is now read-only.

Commit

Permalink
DumperMain.java: Utility that dumps XMP data of a PDF to standard out.
Browse files Browse the repository at this point in the history
  • Loading branch information
kjw committed Sep 2, 2010
1 parent 9b02fcd commit bc87691
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions src/org/crossref/pdfmark/DumperMain.java
@@ -0,0 +1,45 @@
package org.crossref.pdfmark;

import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;

import com.lowagie.text.pdf.PdfReader;

/**
* Utility that dumps XMP data of a PDF to standard out.
*/
public class DumperMain {

public static void main(String[] args) {
for (String filename : args) {

File f = new File(filename);
FileInputStream fileIn;
PdfReader reader;

try {
fileIn = new FileInputStream(f);
reader = new PdfReader(fileIn);
byte[] merged = reader.getMetadata();
ByteArrayInputStream bIn = new ByteArrayInputStream(merged);
BufferedReader bR = new BufferedReader(new InputStreamReader(bIn));
String line;
while ((line = bR.readLine()) != null) {
System.out.println(line);
}

reader.close();
fileIn.close();
} catch (IOException e) {
System.err.println("Couldn't read file '" + filename + "'.");
System.err.println(e);
}
}
}

}

0 comments on commit bc87691

Please sign in to comment.