Inheritance: IReadingProcessor
        /*
         * (non-Javadoc)
         * @see com.itextpdf.tool.xml.pipeline.css.CSSResolver#addCss(java.lang.String, java.lang.String)
         */
        public void AddCss(String content, Encoding charSet, bool isPersistent)
        {
            CssFileProcessor proc = new CssFileProcessor();

            try {
                retrieve.ProcessFromStream(new MemoryStream(charSet.GetBytes(content)), proc);
                ICssFile css = proc.GetCss();
                css.IsPersistent(isPersistent);
                this.cssFiles.Add(css);
            } catch (IOException e) {
                throw new CssResolverException(e);
            }
        }
        /**
         * Add a file to the CssFiles Collection.
         *
         * @param href the path, if it starts with http we try to retrieve the file
         *            from the net, if not we try a normal file operation.
         */
        public void AddCssFile(String href, bool isPersistent)
        {
            CssFileProcessor cssFileProcessor = new CssFileProcessor();

            try {
                retrieve.ProcessFromHref(href, cssFileProcessor);
            } catch (IOException e) {
                throw new CssResolverException(e);
            }
            ICssFile css = cssFileProcessor.GetCss();

            css.IsPersistent(isPersistent);
            this.cssFiles.Add(css);
        }
Exemple #3
0
 virtual public void SetUp() {
     LoggerFactory.GetInstance().SetLogger(new SysoLogger(3));
     proc = new CssFileProcessor();
     retriever = new FileRetrieveImpl();
 }
    	public static ICssFile GetCSS(Stream inp) {
            ICssFile cssFile = null; 
			if (null != inp) {
				CssFileProcessor cssFileProcessor = new CssFileProcessor();
                try {
                    int i = -1;
                    while (-1 != (i = inp.ReadByte())) {
                        cssFileProcessor.Process((char) i);
                    }
                    cssFile = new CSSFileWrapper(cssFileProcessor.GetCss(), true);
                } catch (IOException e) {
                    throw new RuntimeWorkerException(e);
                } finally {
                    try {
                        inp.Close();
                    } catch (IOException e) {
                        throw new RuntimeWorkerException(e);
                    }
                }
            }
            return cssFile;
        }
        /* (non-Javadoc)
         * @see com.itextpdf.tool.xml.pipeline.css.CSSResolver#addCss(java.lang.String)
         */
        virtual public void AddCss(String content, bool isPersistent) {
            CssFileProcessor proc = new CssFileProcessor();
            IFileRetrieve retrieve = new FileRetrieveImpl();
            try {
                retrieve.ProcessFromStream(new MemoryStream(Encoding.GetEncoding(1252).GetBytes(content)), proc);
                ICssFile css = proc.GetCss();
                css.IsPersistent(isPersistent);
                this.cssFiles.Add(css);
            } catch (IOException e) {
                throw new CssResolverException(e);
            }

        }
 /**
  * Add a file to the CssFiles Collection.
  *
  * @param href the path, if it starts with http we try to retrieve the file
  *            from the net, if not we try a normal file operation.
  */
 virtual public void AddCssFile(String href, bool isPersistent) {
     CssFileProcessor cssFileProcessor = new CssFileProcessor();
     try {
         retrieve.ProcessFromHref(href, cssFileProcessor);
     } catch (IOException e) {
         throw new CssResolverException(e);
     }
     ICssFile css = cssFileProcessor.GetCss();
     css.IsPersistent(isPersistent);
     this.cssFiles.Add(css);
 }
Exemple #7
0
 public ICssFile GetDefaultCSS()
 {
     if (defaultCssFile == null)
     {
         Stream input = Assembly.GetExecutingAssembly().GetManifestResourceStream("iTextSharp.tool.xml.css.default.css");
         if (input != null)
         {
             CssFileProcessor cssFileProcessor = new CssFileProcessor();
             int i = -1;
             try
             {
                 while (-1 != (i = input.ReadByte())) {
                     cssFileProcessor.Process((char)i);
                 }
                 defaultCssFile = new CSSFileWrapper(cssFileProcessor.GetCss(), true);
             }
             catch (IOException e)
             {
                 throw new RuntimeWorkerException(e);
             }
             finally 
             {
                 try
                 {
                     input.Close();
                 }
                 catch (IOException e)
                 {
                     throw new RuntimeWorkerException(e);
                 }
             }
         }
     }
     return defaultCssFile;
 }