improved PDF export support (better Chapter titles)
authoraxelcl <axelcl>
Sat, 19 Feb 2005 00:18:47 +0000 (00:18 +0000)
committeraxelcl <axelcl>
Sat, 19 Feb 2005 00:18:47 +0000 (00:18 +0000)
archive/net.sourceforge.phpeclipse.wiki/lib/plog4u.jar
archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/export/pdf/WikiPDFExporter.java

index 8919cd7..8059aea 100644 (file)
Binary files a/archive/net.sourceforge.phpeclipse.wiki/lib/plog4u.jar and b/archive/net.sourceforge.phpeclipse.wiki/lib/plog4u.jar differ
index 0b387dd..e97dd4d 100644 (file)
@@ -218,18 +218,24 @@ public final class WikiPDFExporter implements IRunnableWithProgress {
           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);