diff -r -u ipdf-trunk/inc/channels.h ipdf-trunk-rincewind/inc/channels.h
--- ipdf-trunk/inc/channels.h	2007-03-23 21:41:43.000000000 +0100
+++ ipdf-trunk-rincewind/inc/channels.h	2007-03-23 21:29:27.000000000 +0100
@@ -98,7 +98,7 @@
 
     //////////////////////////// for scribble ////////////////////////////
     void    updateScribbleIcons(ScbDocPtr pDoc);
-    void    initScribbleState(ScbDocPtr pDoc);
+    void    initScribbleState(ScbDocPtr pDoc, int penSize, int penColor, int penLineStyle, int penAttributes);
     void    onScribbleIconsClicked(const int iconID, const int state);
     void    setScribbleNone(ScbDocPtr pDoc);

diff -u -N -r ipdf-trunk/inc/CPU.h ipdf-trunk-rincewind/inc/CPU.h
--- ipdf-trunk/inc/CPU.h        1970-01-01 01:00:00.000000000 +0100
+++ ipdf-trunk-rincewind/inc/CPU.h      2007-03-23 21:34:25.000000000 +0100
@@ -0,0 +1,13 @@
+
+#ifndef CPU_H_
+#define CPU_H_
+
+enum CPUSpeed 
+{
+    CPU_UNKNOWN = 0,
+    CPU_HIGH,
+    CPU_MID,
+    CPU_LOW
+};
+
+#endif

diff -r -u ipdf-trunk/inc/PDFLandscapeView.h ipdf-trunk-rincewind/inc/PDFLandscapeView.h
--- ipdf-trunk/inc/PDFLandscapeView.h	2007-03-23 21:41:43.000000000 +0100
+++ ipdf-trunk-rincewind/inc/PDFLandscapeView.h	2007-03-23 21:31:19.000000000 +0100
@@ -24,6 +24,8 @@
 #include "DisplayList.h"
 #include "Settings.h"
 #include <gtk/gtk.h>
+#include "CPU.h"
+
 //////////////////////////////////////////////////////////////////////////
 // CPDFLandscapeView for landscape mode reading. 
 // In this mode, settings.screenX and settings.screenY serve as scrollX and 
@@ -42,6 +44,9 @@
     int             nOffset;        // in continous mode, pagebar_offset
     GBool           bReady;         // ready to receive user input?
 
+    GBool           showScribbles;  // Scribbles visible
+    CPUSpeed        lastSpeed;      // The last set speed
+
 public:
     CPDFLandscapeView(void);
     ~CPDFLandscapeView(void);
@@ -78,6 +83,12 @@
     void drawPages(const int start, const int end);
     void drawPageImage(CPageInfo *page);
 
+    // Rincewind stuff :-)
+    void toggleScribbles();
+
+    // Set the speed to CPU_HIGH, CPU_MID or CPU_LOW
+    void setCPUSpeed(const CPUSpeed, const char* reason);
+
 public:
     void setView(CPDFView *p) { view = p; }
     void init();
Only in ipdf-trunk-rincewind/inc: PDFLandscapeView.h~
diff -r -u ipdf-trunk/inc/PDFPortraitView.h ipdf-trunk-rincewind/inc/PDFPortraitView.h
--- ipdf-trunk/inc/PDFPortraitView.h	2007-03-23 21:41:43.000000000 +0100
+++ ipdf-trunk-rincewind/inc/PDFPortraitView.h	2007-03-23 21:31:09.000000000 +0100
@@ -24,6 +24,16 @@
 #include "DisplayList.h"
 #include "Settings.h"
 #include <gtk/gtk.h>
+
+#include "CPU.h"
+
+// For debug only
+#include <iostream>
+#include <fstream>
+
+
+
+
 //////////////////////////////////////////////////////////////////////////
 // CPDFPortraitView
 // In Portrait View mode, we display page with rotate angle = 0
@@ -36,10 +46,14 @@
     CPDFView *      view;
     CLayoutMgr      layout;
     CDisplayList    list;
+
     int             nStart, nEnd;   // display pages range [nStart,nEnd]
     int             nOffset;        // in continous mode, pagebar_offset
     GBool           bReady;         // ready to receive user input
 
+    GBool           showScribbles;  // Scribbles visible
+    CPUSpeed        lastSpeed;      // The last set speed
+
 public:
     CPDFPortraitView(void);
     ~CPDFPortraitView(void);
@@ -76,6 +90,12 @@
     void drawPages(const int start, const int end);
     void drawPageImage(CPageInfo *page);
 
+    // Rincewind stuff :-)
+    void toggleScribbles();
+
+    // Set the speed to CPU_HIGH, CPU_MID or CPU_LOW
+    void setCPUSpeed(const CPUSpeed, const char* reason);
+
 public:
     void setView(CPDFView *p) { view = p; }
     void init();
Only in ipdf-trunk-rincewind/inc: PDFPortraitView.h~
Only in ipdf-trunk-rincewind/inc: ScribbleMgr.h~
diff -r -u ipdf-trunk/inc/Settings.h ipdf-trunk-rincewind/inc/Settings.h
--- ipdf-trunk/inc/Settings.h	2007-03-23 21:41:43.000000000 +0100
+++ ipdf-trunk-rincewind/inc/Settings.h	2007-03-23 21:29:27.000000000 +0100
@@ -120,6 +120,12 @@
     HistoryItem record;         // change to list to provide multi level record
     int         zbState;        // zoom back state is defined by user clicks count
 
+    // Rincewind
+    int         penSize;
+    int         penColor;
+    int         penLineStyle;
+    int         penAttributes;
+
 public:
     CSettings(void);
     ~CSettings(void);
@@ -166,6 +172,18 @@
     // mode
     int getMode() const { return mode; }
     void setMode(const int m) { mode = m; }
+
+    // pen
+    int getPenSize() const { return penSize; }
+    int getPenColor() const { return penColor; }
+    int getPenLineStyle() const { return penLineStyle; }
+    int getPenAttributes() const { return penAttributes; }
+
+    void setPenSize(const int size) { penSize = size; }
+    void setPenColor(const int color) { penColor = color; }
+    void setPenLineStyle(const int style) { penLineStyle = style; }
+    void setPenAttributes(const int attributes) { penAttributes = attributes; }
+
 };
 
 #endif
diff -r -u ipdf-trunk/src/channels.cpp ipdf-trunk-rincewind/src/channels.cpp
--- ipdf-trunk/src/channels.cpp	2007-03-23 21:41:41.000000000 +0100
+++ ipdf-trunk-rincewind/src/channels.cpp	2007-03-23 21:29:27.000000000 +0100
@@ -143,14 +143,25 @@
     }
 }
 
-void CChannels::initScribbleState(ScbDocPtr pDoc)
+void CChannels::initScribbleState(ScbDocPtr pDoc, int penSize, int penColor, int penLineStyle, int penAttributes)
 {
     doc = pDoc;
-    doc->context.curState = SCB_TBS_NONE;
+    //doc->context.curState = SCB_TBS_NONE;
+    doc->context.curState = SCB_TBS_SCRIBBLE;  // Let pen be pen by default
+
+    if (penSize != -1)
+	doc->context.curStrokeStyle.penSize = penSize;
+    if (penColor != -1)
+	doc->context.curStrokeStyle.color = (ScbDevColor) penColor;
+    if (penLineStyle != -1)
+	doc->context.curStrokeStyle.lineStyle = (ScbLineStyle) penLineStyle;
+    if (penAttributes != -1)
+	doc->context.curStrokeStyle.attributes = penAttributes;
 
     tbDisableUpdate(ertoolbarChannel, ER_PDF_VIEWER_UA_ID);   
     updateScribbleIcons(doc);
     tbEnableUpdate(ertoolbarChannel, ER_PDF_VIEWER_UA_ID);   
+    
 }
 
 GBool CChannels::isScribbleIcon(const int id)
diff -r -u ipdf-trunk/src/PDFApp.cpp ipdf-trunk-rincewind/src/PDFApp.cpp
--- ipdf-trunk/src/PDFApp.cpp	2007-03-23 21:41:41.000000000 +0100
+++ ipdf-trunk-rincewind/src/PDFApp.cpp	2007-03-23 21:29:27.000000000 +0100
@@ -126,7 +126,12 @@
 #endif 
 
     controller.scbMgr.open(fileName->getCString());
-    controller.channels.initScribbleState(controller.scbMgr.getScbDoc());
+    
+    controller.channels.initScribbleState(controller.scbMgr.getScbDoc(), 
+					  controller.settings.getPenSize(),
+					  controller.settings.getPenColor(),
+					  controller.settings.getPenLineStyle(),
+					  controller.settings.getPenAttributes());
 
 #if (PV_PROFILE_ON)
     int t2 = controller.getHighTimeStamp();
diff -r -u ipdf-trunk/src/PDFLandscapeView.cpp ipdf-trunk-rincewind/src/PDFLandscapeView.cpp
--- ipdf-trunk/src/PDFLandscapeView.cpp	2007-03-23 21:41:41.000000000 +0100
+++ ipdf-trunk-rincewind/src/PDFLandscapeView.cpp	2007-03-23 21:30:38.000000000 +0100
@@ -23,6 +23,11 @@
 #include <liberipc/eripcviewer.h>
 #include "PDFViewerLog.h"
 
+// Used for CPU throtling
+#include <iostream>
+#include <fstream>
+
+
 //////////////////////////////////////////////////////////////////////////
 // It's better to use two classes, so that they can be changeg independently.
 // In this view:
@@ -36,6 +41,7 @@
 , nEnd(-1)
 , nOffset(100)
 , bReady(gFalse)
+, showScribbles(gFalse)
 {
 }
 
@@ -108,6 +114,9 @@
     }
     else if (view->isEraseEnable())
     {
+	// Give it some juice - don't want lagging scribbles!
+	setCPUSpeed(CPU_MID, "Erasing scribbles");
+
         int ox, oy; 
         int pn = hitTest(x, y, ox, oy);
         getPageScreenPosition(pn, x, y);
@@ -139,6 +148,10 @@
         getPageScreenPosition(pn, px, py);     
         view->ctrl->scbMgr.onScribbleRelease(pn, view->ctrl, px, py, 
             x, y, ox, oy);
+
+	// Turn CPU back down
+	setCPUSpeed(CPU_LOW, "Scribble released");
+
         return FALSE;                    
     }
     else if (view->isEraseEnable())
@@ -188,6 +201,9 @@
     }  
     else if (view->isZoomInEnable())
     {
+	// Full far ahead
+	setCPUSpeed(CPU_HIGH, "zoomIn");
+
         view->adjustZoomRect(x, y);
         zoomFromRect(view->zoomRect.left, 
             view->zoomRect.top,
@@ -197,6 +213,9 @@
     }	            
     else if (view->isZoomOutEnable())                    
     {
+	// Full far ahead
+	setCPUSpeed(CPU_HIGH, "zoomOut");
+
         view->adjustZoomRect(x, y);
         zoomToRect(view->zoomRect.left, 
             view->zoomRect.top,
@@ -227,6 +246,9 @@
     }   
     else if (view->isScribbleEnable())
     {
+	// Give it some juice - don't want lagging scribbles!
+	setCPUSpeed(CPU_MID, "Scribbling");
+
         int ox, oy; 
         int px, py;
         int pn = hitTest(x, y, ox, oy);
@@ -238,6 +260,9 @@
     }         
     else if (view->isEraseEnable())
     {
+	// Give it some juice - don't want lagging scribbles!
+	setCPUSpeed(CPU_MID, "Erasing scribbles");
+
         int ox, oy; 
         int pn = hitTest(x, y, ox, oy);
         getPageScreenPosition(pn, x, y);
@@ -255,12 +280,26 @@
         return FALSE;
     }
 
+    // Crank up that CPU - this is CPU intensive stuff!
+    setCPUSpeed(CPU_HIGH, "keyPressCbk");
+
     switch (event->keyval)
     {
     case GDK_Home:
         displayPage(1);
         break;
     case GDK_F5:
+	// Must update the settings with the pen state (as good a place as any?)
+	ScbDocPtr doc;
+	doc = view->ctrl->scbMgr.getScbDoc();
+	
+	if (doc) {
+	    view->ctrl->settings.setPenSize(doc->context.curStrokeStyle.penSize);
+	    view->ctrl->settings.setPenColor((int) doc->context.curStrokeStyle.color);
+	    view->ctrl->settings.setPenLineStyle((int) doc->context.curStrokeStyle.lineStyle);
+	    view->ctrl->settings.setPenAttributes(doc->context.curStrokeStyle.attributes);
+	}
+
         view->quit();
         break;  
     case GDK_Page_Up:
@@ -307,10 +346,39 @@
             displayPage(view->ctrl->settings.getCurrentPage() - JumpWidth, ScrollToPrevPages);
         }            
         break;
+    case GDK_Return: // Short 'dot' button  - toggle scribble visibility
+	toggleScribbles();
+	break;
+	
+    case GDK_Up: // Eraser
+	// Toggle eraser on/off
+	view->ctrl->channels.setToolbarDirty();
+
+	if (view->isEraseEnable())
+	{
+	    view->ctrl->channels.onScribbleIconsClicked(iconID_pen, 0);
+
+	    // Redraw the toolbar
+	    view->ctrl->channels.redrawToolbar();
+
+	    // Redraw whole screen - erasing completed
+	    displayPage(view->ctrl->settings.getCurrentPage());
+	    
+	} else 
+	{
+	    view->ctrl->channels.onScribbleIconsClicked(iconID_eraseline, 0);
+	    
+	    // Redraw the toolbar
+	    view->ctrl->channels.redrawToolbar();
+	}
+
+        view->ctrl->channels.busy_off();
+	break;
     default:
         view->ctrl->channels.busy_off();
         break; // no return: do not bypass keyPressCbk
     }
+    
     return FALSE;
 }
 
@@ -349,6 +417,9 @@
             drawPages(nStart, nEnd);
         }
     }
+
+    // Page is rendered, turn down CPU
+    setCPUSpeed(CPU_LOW, "onPageRendered");
 }
 
 void CPDFLandscapeView::ipcCbk( gint * fd,    GdkInputCondition id)
@@ -784,7 +855,9 @@
 
     // when drawing scribble, should use another y position
     y += page->bitmap->getHeight();
-    drawScribble(x, y, page);
+
+    if (showScribbles)
+	drawScribble(x, y, page);
 }
 
 void CPDFLandscapeView::updateToolbar(CPageInfo *page)
@@ -1373,3 +1446,57 @@
     view->ctrl->scbMgr.drawScribblePage(page->pageNumber, 
         view->ctrl, x, y);
 }
+
+// Toggle scribble visibility
+void CPDFLandscapeView::toggleScribbles()
+{
+    if (showScribbles)
+	showScribbles = gFalse;
+    else
+	showScribbles = gTrue;
+
+    // Redraw screen
+    displayPage(view->ctrl->settings.getCurrentPage());
+}
+
+// TODO: Configure the speeds, or just hardcode?
+void CPDFLandscapeView::setCPUSpeed(const CPUSpeed speed, const char* reason)
+{
+    
+    int newSpeed;
+    std::ofstream cpuspeed;
+
+    // Only do update if change of speed
+    if (speed == lastSpeed)
+	return;
+    lastSpeed = speed;
+
+    switch (speed) {
+    case CPU_HIGH:
+	// Set to 400 MhZ 
+	newSpeed = 400000;
+	break;
+    case CPU_MID:
+	newSpeed = 200000;
+	break;
+    case CPU_LOW:
+	newSpeed = 100000;
+	break;
+    default:
+	PV_LOGPRINTF("Error setting CPU speed, bad parameter\n");
+	newSpeed = 400000;
+    }
+
+    //PV_LOGPRINTF("Setting CPU speed to %d\n", newSpeed);
+    
+    try {
+	cpuspeed.open("/proc/sys/cpu/0/speed");
+	cpuspeed << newSpeed << "\n";
+	cpuspeed.close();
+
+    } catch (int e) {
+	PV_LOGPRINTF("CPU Speed set failed, code %d",e);
+    }
+}
+	    
+	    
Only in ipdf-trunk-rincewind/src: PDFLandscapeView.cpp~
Only in ipdf-trunk-rincewind/src: PDFLandscapeView.o
diff -r -u ipdf-trunk/src/PDFPortraitView.cpp ipdf-trunk-rincewind/src/PDFPortraitView.cpp
--- ipdf-trunk/src/PDFPortraitView.cpp	2007-03-23 21:41:41.000000000 +0100
+++ ipdf-trunk-rincewind/src/PDFPortraitView.cpp	2007-03-23 21:30:58.000000000 +0100
@@ -23,6 +23,10 @@
 #include <gdk/gdkkeysyms.h>
 #include <liberipc/eripcviewer.h>
 
+// Used for CPU throtling
+#include <iostream>
+#include <fstream>
+
 
 CPDFPortraitView::CPDFPortraitView(void)
 : view(NULL)
@@ -30,6 +34,7 @@
 , nEnd(-1)
 , nOffset(100)
 , bReady(gFalse)
+, showScribbles(gFalse)
 {
 }
 
@@ -55,6 +60,9 @@
         double z = layout.initPagesPosition(view->ctrl);
         view->ctrl->settings.setZoom(z);
     }
+
+    showScribbles = gTrue;
+
     setReady(gFalse);
 }
 
@@ -104,6 +112,9 @@
         int ox, oy; 
         int pn = hitTest(x, y, ox, oy);
 
+	// Give it some juice - don't want lagging scribbles!
+	setCPUSpeed(CPU_MID, "Erasing scribbles");
+
         if (view->isPageMode())
         {
             x = layout.getVirtualScreen().left;
@@ -147,6 +158,10 @@
         // get page x & y
         getPageScreenPosition(pn, px, py);
         view->ctrl->scbMgr.onScribbleRelease(pn, view->ctrl, px, py, x, y, ox, oy);
+
+	// Turn CPU back down
+	setCPUSpeed(CPU_LOW, "Scribble released");
+	    
         return  FALSE;
     }
     else if (view->isEraseEnable())
@@ -247,10 +262,16 @@
     else if (view->isZoomInEnable() || 
         view->isZoomOutEnable())
     {
+	// Full far ahead
+	setCPUSpeed(CPU_HIGH, "Zooming");
+
         view->adjustZoomRect(x, y);        
     }
     else if (view->isScribbleEnable())
     {
+	// Give it some juice - don't want lagging scribbles!
+	setCPUSpeed(CPU_MID, "Scribbling");
+
         // PV_LOGPRINTF("scribble!");
         int ox, oy; 
         int px, py;
@@ -263,6 +284,9 @@
     }
     else if (view->isEraseEnable())
     {        
+	// Give it some juice - don't want lagging scribbles!
+	setCPUSpeed(CPU_MID, "Erase enabled?");
+
         int ox, oy; 
         int pn = hitTest(x, y, ox, oy);
         getPageScreenPosition(pn, x, y);
@@ -280,12 +304,28 @@
         return FALSE;
     }
 
+    // Crank up that CPU - this is CPU intensive stuff!
+    setCPUSpeed(CPU_HIGH, "keyPressCbk");
+
+
     switch (event->keyval)
     {
     case GDK_Home:
         displayPage(1);
         break;
     case GDK_F5:
+	
+	// Must update the settings with the pen state (as good a place as any?)
+	ScbDocPtr doc;
+	doc = view->ctrl->scbMgr.getScbDoc();
+	
+	if (doc) {
+	    view->ctrl->settings.setPenSize(doc->context.curStrokeStyle.penSize);
+	    view->ctrl->settings.setPenColor((int) doc->context.curStrokeStyle.color);
+	    view->ctrl->settings.setPenLineStyle((int) doc->context.curStrokeStyle.lineStyle);
+	    view->ctrl->settings.setPenAttributes(doc->context.curStrokeStyle.attributes);
+	}
+
         view->quit();
         break;  
     case GDK_Page_Up:
@@ -332,10 +372,39 @@
             displayPage(view->ctrl->settings.getCurrentPage() - JumpWidth, ScrollToPrevPages);
         }            
         break;
+    case GDK_Return: // Short 'dot' button  - toggle scribble visibility
+	toggleScribbles();
+	break;
+	
+    case GDK_Up: // Eraser
+	// Toggle eraser on/off
+	view->ctrl->channels.setToolbarDirty();
+
+	if (view->isEraseEnable())
+	{
+	    view->ctrl->channels.onScribbleIconsClicked(iconID_pen, 0);
+
+	    // Redraw the toolbar
+	    view->ctrl->channels.redrawToolbar();
+
+	    // Redraw whole screen - erasing completed
+	    displayPage(view->ctrl->settings.getCurrentPage());
+	    
+	} else 
+	{
+	    view->ctrl->channels.onScribbleIconsClicked(iconID_eraseline, 0);
+	    
+	    // Redraw the toolbar
+	    view->ctrl->channels.redrawToolbar();
+	}
+
+        view->ctrl->channels.busy_off();
+	break;
     default:
         view->ctrl->channels.busy_off();
         break; // no return: do not bypass keyPressCbk
     }
+    
     return FALSE;
 
 }
@@ -371,6 +440,9 @@
             drawPages(nStart, nEnd);
         }
     }
+
+    // Page is rendered, turn down CPU
+    setCPUSpeed(CPU_LOW, "onPageRendered");
 }
 
 void CPDFPortraitView::ipcCbk(gint * fd,    GdkInputCondition id)
@@ -686,9 +758,11 @@
 
     // set ready. Now enable handle mouse event
     setReady();
-
+    
     // issue new requests now
     view->issueNewRequests();
+
+    setCPUSpeed(CPU_LOW, "drawPages completed");
 }
 
 //////////////////////////////////////////////////////////////////////////
@@ -804,7 +878,8 @@
         view->isContinousMode());
 
     // draw scribble, x & y refers page start position in screen
-    drawScribble(x, y, page->pageNumber);
+    if (showScribbles)
+	drawScribble(x, y, page->pageNumber);
 }
 
 void CPDFPortraitView::updateToolbar(CPageInfo *page)
@@ -1390,3 +1465,58 @@
     view->ctrl->scbMgr.drawScribblePage(pn, 
         view->ctrl, x, y);
 }
+
+
+// Toggle scribble visibility
+void CPDFPortraitView::toggleScribbles()
+{
+    if (showScribbles)
+	showScribbles = gFalse;
+    else
+	showScribbles = gTrue;
+
+    // Redraw screen
+    displayPage(view->ctrl->settings.getCurrentPage());
+}
+
+// TODO: Configure the speeds, or just hardcode?
+void CPDFPortraitView::setCPUSpeed(const CPUSpeed speed, const char* reason)
+{
+    
+    int newSpeed;
+    std::ofstream cpuspeed;
+
+    // Only do update if change of speed
+    if (speed == lastSpeed)
+	return;
+    lastSpeed = speed;
+
+    switch (speed) {
+    case CPU_HIGH:
+	// Set to 400 MhZ 
+	newSpeed = 400000;
+	break;
+    case CPU_MID:
+	newSpeed = 200000;
+	break;
+    case CPU_LOW:
+	newSpeed = 100000;
+	break;
+    default:
+	PV_LOGPRINTF("Error setting CPU speed, bad parameter\n");
+	newSpeed = 400000;
+    }
+
+    //PV_LOGPRINTF("Setting CPU speed to %d\n", newSpeed);
+    
+    try {
+	cpuspeed.open("/proc/sys/cpu/0/speed");
+	cpuspeed << newSpeed << "\n";
+	cpuspeed.close();
+
+    } catch (int e) {
+	PV_LOGPRINTF("CPU Speed set failed, code %d",e);
+    }
+}
+	    
+	    
diff -r -u ipdf-trunk/src/Settings.cpp ipdf-trunk-rincewind/src/Settings.cpp
--- ipdf-trunk/src/Settings.cpp	2007-03-23 21:41:41.000000000 +0100
+++ ipdf-trunk-rincewind/src/Settings.cpp	2007-03-23 21:29:27.000000000 +0100
@@ -38,6 +38,9 @@
     currentPage = -1; drawAreaWidth = SCREEN_WIDTH;
     drawAreaHeight = CLIENT_AREA; renderDir = RenderNext; 
     mode = ModePage; zbState = iconState_grey;
+    
+    // Pen defaults 
+    penSize = penColor = penLineStyle = penAttributes = -1;
 }
 
 CSettings::~CSettings(void)
@@ -145,7 +148,15 @@
         {
             mode = ModePage;
         }
-
+	
+	// Load pen style
+	if (RET_OK == ermXmlExist(&manifest, "/package/pen-settings/size")) 
+	{
+	    ermXmlGetInt(&manifest, "/package/pen-settings/size", &penSize);
+	    ermXmlGetInt(&manifest, "/package/pen-settings/color", &penColor);
+	    ermXmlGetInt(&manifest, "/package/pen-settings/linesteyle", &penLineStyle);
+	    ermXmlGetInt(&manifest, "/package/pen-settings/attributes", &penAttributes);
+	}
     }    
     ermXmlClose(&manifest);    
 }
@@ -223,7 +234,38 @@
         {
             ermXmlSetString(&manifest, "/package/viewer-settings/mode", "page");
         }
+	
+        if (RET_OK != ermXmlExist(&manifest, "/package/pen-settings"))
+        {
+            ermXmlNewString(&manifest, "/package", "pen-settings", "");            
+	}
+
+	// Save pen settings
+        if (RET_OK != ermXmlExist(&manifest, "/package/pen-settings/size"))
+        {
+            ermXmlNewString(&manifest, "/package/pen-settings", "size", "");            
+        }
+        ermXmlSetInt(&manifest, "/package/pen-settings/size", penSize);
+
+        if (RET_OK != ermXmlExist(&manifest, "/package/pen-settings/color"))
+        {
+            ermXmlNewString(&manifest, "/package/pen-settings", "color", "");            
+        }
+        ermXmlSetInt(&manifest, "/package/pen-settings/color", penColor);
+
+        if (RET_OK != ermXmlExist(&manifest, "/package/pen-settings/linestyle"))
+        {
+            ermXmlNewString(&manifest, "/package/pen-settings", "linestyle", "");            
+        }
+        ermXmlSetInt(&manifest, "/package/pen-settings/linesteyle", penLineStyle);
+
+        if (RET_OK != ermXmlExist(&manifest, "/package/pen-settings/attributes"))
+        {
+            ermXmlNewString(&manifest, "/package/pen-settings", "attributes", "");            
+        }
+        ermXmlSetInt(&manifest, "/package/pen-settings/attributes", penAttributes);
 
+	// Save
         ermXmlSaveAndClose(&manifest);
     }     
 }
