PdfBoxMigration implements Migrate, Serializable { private MigrateResult htmlMigration( final DigitalObject digitalObject, final ServiceReport report) { try { final HtmlExtractor he = new HtmlExtractor(); final String htmlBlob = he.getText( digitalObject.getContent().getInputStream()); final DigitalObject.Builder factory = new DigitalObject.Builder( Content.byValue(htmlBlob.getBytes())); factory.title(digitalObject.getTitle() + ".html"); factory.format(outputformatHtml); DigitalObject htmlObject = factory.build(); return new MigrateResult(htmlObject, report); } catch (Exception e) { log.severe(e.getClass().getName()+": "+e.getMessage()); return this.fail(new ServiceReport(Type.ERROR, Status.TOOL_ERROR, e .toString())); } }  final MigrateResult migrate(final DigitalObject digitalObject,
                                       final URI inputFormat, final URI outputFormat,
                                       final List<Parameter> parameters); final ServiceDescription describe(); static final String NAME; }
@Test public final void testHtmlMigration() { try { System.out.println(htmltestpdf.getCanonicalPath()); final DigitalObject doInput = new DigitalObject.Builder( Content.byReference((htmltestpdf) .toURI().toURL())) .permanentUri(URI.create("http: .title("test.pdf") .build(); System.out.println("Input " + doInput); URI inputformatpdf = null; URI outputformatHtmlUnicode = null; inputformatpdf = new URI("info:pronom/fmt/18"); outputformatHtmlUnicode = new URI("info:pronom/fmt/99"); final MigrateResult mr = dom.migrate(doInput, inputformatpdf, outputformatHtmlUnicode, null); final DigitalObject doOutput = mr.getDigitalObject(); assertNotNull("Resulting digital object is null.", doOutput); System.out.println("Output" + doOutput); final File resultText = DigitalObjectUtils.toFile(doOutput); assertTrue("Result file was not created successfully!", resultText.exists()); System.out.println("Please find the result html file here: \n" + resultText.getAbsolutePath()); assertFalse("Resulting digital object equal to the original.", doInput.equals(doOutput)); } catch (Exception e) { e.printStackTrace(); } }