我有一个html字符串。我想将字符串转换为pdf文件并尝试post.Function不返回File.How来解决此问题。
public static void pdf (String html) {
// step 4
try {
Document document = new Document();
// step 2
InputStream in = new ByteArrayInputStream(html.getBytes());
PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("test.pdf"));
// step 3
document.open();
XMLWorkerHelper.getInstance().parseXHtml(writer, document,
in);
document.close();
Log.e("test", "PDF Created!" );
} catch (Exception e) {
e.printStackTrace();
}
}