此代码一直给我一个错误,指出urlForBase必须是有效的URI。 包含此错误的行以粗体和草书显示。谁知道问题是什么?我很肯定网址是一个实际正确的网址。
CYaHPConverter converter = new CYaHPConverter();
FileOutputStream out = new FileOutputStream("/Users/steveweyns/Desktop/summary.pdf");
Map properties = new HashMap();
List headerFooterList = new ArrayList();
properties.put(IHtmlToPdfTransformer.PDF_RENDERER_CLASS,
IHtmlToPdfTransformer.FLYINGSAUCER_PDF_RENDERER);
try {
//properties.put(IHtmlToPdfTransformer.FOP_TTF_FONT_PATH, fontPath);
***converter.convertToPdf("http://biz.yahoo.com/e/" + correctSummaryPass + "/" + ticker + "10-k.html",***
IHtmlToPdfTransformer.A4P,
headerFooterList,
"",
out,
properties);
} catch (IHtmlToPdfTransformer.CConvertException ex) {
Logger.getLogger(AnnualReportSummary.class.getName()).log(Level.SEVERE, null, ex);
}
try {
out.flush();
} catch (IOException ex) {
Logger.getLogger(AnnualReportSummary.class.getName()).log(Level.SEVERE, null, ex);
}
try {
out.close();
} catch (IOException ex) {
Logger.getLogger(AnnualReportSummary.class.getName()).log(Level.SEVERE, null, ex);
}
} catch (FileNotFoundException ex) {
Logger.getLogger(AnnualReportSummary.class.getName()).log(Level.SEVERE, null, ex);
}
答案 0 :(得分:0)
*converter.convertToPdf("http://biz.yahoo.com/e/" + correctSummaryPass + "/" + ticker + "10-k.html",***
IHtmlToPdfTransformer.A4P,
headerFooterList,
"",
out,
properties);
更改为:
*converter.convertToPdf("http://biz.yahoo.com/e/" + correctSummaryPass + "/" + ticker + "10-k.html",***
IHtmlToPdfTransformer.A4P,
headerFooterList,
null,
out,
properties);