Details
Description
The following code should output html string with this header:
<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN
"http://www.w3.org/TR/html4/loose.dtd">
<html><head><title></title>
... but it does not !
Here is te test code:
package fr.def.iss.vd2.mod_instruction_gui.view;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.Writer;
import org.apache.pdfbox.exceptions.COSVisitorException;
import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.pdmodel.PDPage;
import org.apache.pdfbox.pdmodel.edit.PDPageContentStream;
import org.apache.pdfbox.pdmodel.font.PDFont;
import org.apache.pdfbox.pdmodel.font.PDType1Font;
import org.apache.pdfbox.util.PDFText2HTML;
public class Test {
public static void main(final String[] args)
{ byte[] buf = rawText2Pdf("Hell world"); String html = pdf2Html(buf); System.out.println("html:" + html); } public static byte[] rawText2Pdf(String text) {
ByteArrayOutputStream os = null;
try
catch (COSVisitorException ex)
{ ex.printStackTrace(); } catch (IOException ex) { ex.printStackTrace(); } byte[] result = null;
if (os != null)
return result;
}
public static String pdf2Html(byte[] pdf) {
String result = null;
ByteArrayOutputStream os = null;
PDFText2HTML stripper = null;
StringBuilder buf = new StringBuilder();
try
catch (IOException ex)
{ ex.printStackTrace(); } return result;
}
}