PdfUtils { public static byte[] generateMetadataXML(byte[] pdfBytes, String fileName, String url) throws IOException { return generateMetadataXML(pdfBytes, fileName, url, DEFAULT_GEOMETRY_SERVICE); }  static byte[] generateMetadataXML(byte[] pdfBytes, String fileName, String url); static byte[] generateMetadataXML(byte[] pdfBytes, String fileName, String url, String geometryServiceUrl); static Properties readMetadata(byte[] rawBytes, String defaultTitle, String geometryServiceUrl); static final String PROP_TITLE; static final String PROP_SUBJECT; static final String PROP_MODIFICATION_DATE; static final String PROP_BBOX; }
@Test public void testGenerateMetadataXML() throws Exception { byte[] bytes = getBytes("src/test/data/MANAmap1.pdf"); byte[] xmlBytes = PdfUtils.generateMetadataXML(bytes, "MANAmap1.pdf", "http: assertNotNull("Null bytes returned", xmlBytes); Document doc = XmlUtils.toDocument(new String(xmlBytes)); assertNotNull("Null title", doc.getElementsByTagNameNS("http: assertEquals("Wrong title", "MANAmap1", doc.getElementsByTagNameNS("http: assertNotNull("Null description", doc.getElementsByTagNameNS("http: assertEquals("Wrong description", "Author: null\nCreator: Adobe Illustrator CS5\nProducer: Adobe PDF library 9.90", doc.getElementsByTagNameNS("http: assertNotNull("Null abstract", doc.getElementsByTagNameNS("http: assertEquals("Wrong abstract", "Author: null\nCreator: Adobe Illustrator CS5\nProducer: Adobe PDF library 9.90", doc.getElementsByTagNameNS("http: assertNotNull("Null references", doc.getElementsByTagNameNS("http: assertEquals("Wrong references", "http: assertNotNull("Null LowerCorner", doc.getElementsByTagNameNS("http: assertEquals("Wrong LowerCorner", "-77.54026794433594 38.815128326416016", doc.getElementsByTagNameNS("http: assertNotNull("Null UpperCorner", doc.getElementsByTagNameNS("http: assertEquals("Wrong UpperCorner", "-77.5213394165039 38.82757568359375", doc.getElementsByTagNameNS("http: }