/** * Constructs a new RtfColorTableParser. * * @param importHeader The RtfImportHeader to add the color mappings to. */ public RtfDestinationColorTable(RtfParser parser) : base(parser) { colorMap = new Hashtable(); this.colorNr = 0; this.importHeader = parser.GetImportManager(); this.SetToDefaults(); }
public override void SetParser(RtfParser parser) { this.rtfParser = parser; colorMap = new Hashtable(); this.colorNr = 0; this.importHeader = parser.GetImportManager(); this.SetToDefaults(); }
/** * Initialize the parser object values. * * @param type Type of conversion or import * @param rtfDoc The <code>RtfDocument</code> * @param readerIn The input stream * @param doc The iText <code>Document</code> */ private void Init(int type, RtfDocument rtfDoc, Stream readerIn, Document doc, IElement elem) { Init_stats(); // initialize reader to a PushbackReader this.pbReader = Init_Reader(readerIn); this.conversionType = type; this.rtfDoc = rtfDoc; this.document = doc; this.elem = elem; this.currentState = new RtfParserState(); this.stackState = new Stack(); this.SetParserState(PARSER_STARTSTOP); this.importMgr = new RtfImportMgr(this.rtfDoc, this.document); // get destination Mgr this.destinationMgr = RtfDestinationMgr.GetInstance(this); // set the parser RtfDestinationMgr.SetParser(this); // DEBUG INFO for timing and memory usage of RtfCtrlWordMgr object // create multiple new RtfCtrlWordMgr objects to check timing and memory usage // System.Gc(); // long endTime = 0; // Date endDate = null; // long endFree = 0; // DecimalFormat df = new DecimalFormat("#,##0"); // Date startDate = new Date(); // long startTime = System.CurrentTimeMillis(); // long startFree = Runtime.GetRuntime().FreeMemory(); // System.out.Println("1:"); this.rtfKeywordMgr = new RtfCtrlWordMgr(this, this.pbReader);/////////DO NOT COMMENT OUT THIS LINE /////////// foreach (object listener in listeners) { if (listener is IRtfCtrlWordListener) { this.rtfKeywordMgr.AddRtfCtrlWordListener((IRtfCtrlWordListener)listener); } } // endFree = Runtime.GetRuntime().FreeMemory(); // endTime = System.CurrentTimeMillis(); // endDate = new Date(); // System.out.Println("RtfCtrlWordMgr start date: " + startDate.ToLocaleString()); // System.out.Println("RtfCtrlWordMgr end date : " + endDate.ToLocaleString()); // System.out.Println(" Elapsed time : " + Long.ToString(endTime - startTime) + " milliseconds."); // System.out.Println("Begin Constructor RtfCtrlWordMgr , free mem is " + df.Format(startFree / 1024) + "k"); // System.out.Println("End Constructor RtfCtrlWordMgr , free mem is " + df.Format(endFree / 1024) + "k"); // System.out.Println("RtfCtrlWordMgr used approximately " + df.Format((startFree - endFree) / 1024) + "k"); // // System.Gc(); // System.out.Println("2:"); // startDate = new Date(); // startTime = System.CurrentTimeMillis(); // startFree = Runtime.GetRuntime().FreeMemory(); // RtfCtrlWordMgr rtfKeywordMgr2 = new RtfCtrlWordMgr(this, this.pbReader); // endFree = Runtime.GetRuntime().FreeMemory(); // endTime = System.CurrentTimeMillis(); // endDate = new Date(); // System.out.Println("RtfCtrlWordMgr start date: " + startDate.ToLocaleString()); // System.out.Println("RtfCtrlWordMgr end date : " + endDate.ToLocaleString()); // System.out.Println(" Elapsed time : " + Long.ToString(endTime - startTime) + " milliseconds."); // System.out.Println("Begin Constructor RtfCtrlWordMgr , free mem is " + df.Format(startFree / 1024) + "k"); // System.out.Println("End Constructor RtfCtrlWordMgr , free mem is " + df.Format(endFree / 1024) + "k"); // System.out.Println("RtfCtrlWordMgr used approximately " + df.Format((startFree - endFree) / 1024) + "k"); // // System.Gc(); // System.out.Println("3:"); // startDate = new Date(); // startTime = System.CurrentTimeMillis(); // startFree = Runtime.GetRuntime().FreeMemory(); // RtfCtrlWordMgr rtfKeywordMgr3 = new RtfCtrlWordMgr(this, this.pbReader); // endFree = Runtime.GetRuntime().FreeMemory(); // endTime = System.CurrentTimeMillis(); // endDate = new Date(); // System.out.Println("RtfCtrlWordMgr start date: " + startDate.ToLocaleString()); // System.out.Println("RtfCtrlWordMgr end date : " + endDate.ToLocaleString()); // System.out.Println(" Elapsed time : " + Long.ToString(endTime - startTime) + " milliseconds."); // System.out.Println("Begin Constructor RtfCtrlWordMgr , free mem is " + df.Format(startFree / 1024) + "k"); // System.out.Println("End Constructor RtfCtrlWordMgr , free mem is " + df.Format(endFree / 1024) + "k"); // System.out.Println("RtfCtrlWordMgr used approximately " + df.Format((startFree - endFree) / 1024) + "k"); // // System.Gc(); // System.out.Println("4:"); // startDate = new Date(); // startTime = System.CurrentTimeMillis(); // startFree = Runtime.GetRuntime().FreeMemory(); // RtfCtrlWordMgr rtfKeywordMgr4 = new RtfCtrlWordMgr(this, this.pbReader); // endFree = Runtime.GetRuntime().FreeMemory(); // endTime = System.CurrentTimeMillis(); // endDate = new Date(); // System.out.Println("RtfCtrlWordMgr start date: " + startDate.ToLocaleString()); // System.out.Println("RtfCtrlWordMgr end date : " + endDate.ToLocaleString()); // System.out.Println(" Elapsed time : " + Long.ToString(endTime - startTime) + " milliseconds."); // System.out.Println("Begin Constructor RtfCtrlWordMgr , free mem is " + df.Format(startFree / 1024) + "k"); // System.out.Println("End Constructor RtfCtrlWordMgr , free mem is " + df.Format(endFree / 1024) + "k"); // System.out.Println("RtfCtrlWordMgr used approximately " + df.Format((startFree - endFree) / 1024) + "k"); // // System.Gc(); // System.out.Println("5:"); // startDate = new Date(); // startTime = System.CurrentTimeMillis(); // startFree = Runtime.GetRuntime().FreeMemory(); // RtfCtrlWordMgr rtfKeywordMgr5 = new RtfCtrlWordMgr(this, this.pbReader); // endFree = Runtime.GetRuntime().FreeMemory(); // endTime = System.CurrentTimeMillis(); // endDate = new Date(); // System.out.Println("RtfCtrlWordMgr start date: " + startDate.ToLocaleString()); // System.out.Println("RtfCtrlWordMgr end date : " + endDate.ToLocaleString()); // System.out.Println(" Elapsed time : " + Long.ToString(endTime - startTime) + " milliseconds."); // System.out.Println("Begin Constructor RtfCtrlWordMgr , free mem is " + df.Format(startFree / 1024) + "k"); // System.out.Println("End Constructor RtfCtrlWordMgr , free mem is " + df.Format(endFree / 1024) + "k"); // System.out.Println("RtfCtrlWordMgr used approximately " + df.Format((startFree - endFree) / 1024) + "k"); // System.Gc(); // System.out.Println("At ed:"); // startDate = new Date(); // startTime = System.CurrentTimeMillis(); // startFree = Runtime.GetRuntime().FreeMemory(); // //RtfCtrlWordMgr rtfKeywordMgr6 = new RtfCtrlWordMgr(this, this.pbReader); // endFree = Runtime.GetRuntime().FreeMemory(); // endTime = System.CurrentTimeMillis(); // endDate = new Date(); // System.out.Println("RtfCtrlWordMgr start date: " + startDate.ToLocaleString()); // System.out.Println("RtfCtrlWordMgr end date : " + endDate.ToLocaleString()); // System.out.Println(" Elapsed time : " + Long.ToString(endTime - startTime) + " milliseconds."); // System.out.Println("Begin Constructor RtfCtrlWordMgr , free mem is " + df.Format(startFree / 1024) + "k"); // System.out.Println("End Constructor RtfCtrlWordMgr , free mem is " + df.Format(endFree / 1024) + "k"); // System.out.Println("RtfCtrlWordMgr used approximately " + df.Format((startFree - endFree) / 1024) + "k"); }
public override void SetParser(RtfParser parser) { this.rtfParser = parser; this.importHeader = parser.GetImportManager(); }
public RtfDestinationStylesheetTable(RtfParser parser, String type) : base(parser){ this.importHeader = parser.GetImportManager(); this.type = type; }
/** * Initialize the object. * * @param importFonts true to import the fonts into the FontFactory, false do not load fonts * * @since 2.0.8 */ private void Init(bool importFonts) { fontMap = new Hashtable(); if (this.rtfParser != null) { this.importHeader = this.rtfParser.GetImportManager(); } this.SetToDefaults(); if (importFonts) { ImportSystemFonts(); } }
public RtfDestinationListTable(RtfParser parser) : base(parser) { this.importHeader = parser.GetImportManager(); }