List list = visitor.getList();
Collections.sort(list, new IFileComparator());
- IFile file;
+ IFile file = null;
FileOutputStream os = null;
String pdffilename = fPath.toString();
file = (IFile) list.get(i);
if (file.exists()) {
monitor.subTask(WikiEditorPlugin.getResourceString("Export.exportFile") + file.getLocation());
- System.out.println(file.getLocation().toString());
+
StringBuffer htmlBuffer = new StringBuffer();
htmlBuffer.append("<html><head></head><body>");
boolean noContent = CreatePageAction.createFragmentPage(file, htmlBuffer);
htmlBuffer.append("</body></html>");
- System.out.println(htmlBuffer.toString());
if (!noContent) {
- // TODO add the real title from corresponding *.xml file here:
- Paragraph title = new Paragraph(file.getName(), FontFactory.getFont(FontFactory.HELVETICA, 18, Font.BOLDITALIC,
- new Color(0, 0, 255)));
+ System.out.println(file.getLocation().toString());
+ System.out.println(htmlBuffer.toString());
+ String fileName = file.getName();
+ fileName = fileName.replaceAll("_", " ");
+ int dotIndex = fileName.lastIndexOf('.');
+ if (dotIndex>0) {
+ fileName = fileName.substring(0,dotIndex);
+ }
+ Paragraph title = new Paragraph(fileName, FontFactory.getFont(FontFactory.HELVETICA, 18, Font.BOLDITALIC,
+ Color.BLACK));
Chapter chapter = new Chapter(title, chapterNumber++);
document.add(chapter);
appendArticle(document, htmlBuffer);
monitor.worked(1);
}
} catch (Exception e) {
- addError("PDF export exception", e);
+ String error = "PDF export exception: "+e.getMessage();
+ if (file!=null) {
+ error = file.getLocation().toString()+" - "+e.getMessage();
+ }
+ addError(error, e);
}
}
} catch (Exception e) {
- addError("PDF export exception", e);
+ String error = "PDF export exception: "+e.getMessage();
+ addError(error, e);
} finally {
document.close();
if (pdfWriter != null) {