Inheritance: IFileRetrieve
Exemplo n.º 1
0
        public void SetUp() {
            retriever = new FileRetrieveImpl();
            actual = TARGET + "css/actual.css";
            expected = RESOURCES + "css/test.css";

            Directory.CreateDirectory(TARGET + @"css\");
        }
Exemplo n.º 2
0
 public void SetUp() {
     LoggerFactory.GetInstance().SetLogger(new SysoLogger(3));
     cssFiles = new CssFilesImpl();
     String path = RESOURCES + @"\css\test.css";
     path = path.Substring(0, path.LastIndexOf("test.css"));
     FileRetrieveImpl r = new FileRetrieveImpl(new String[] {path});
     StyleAttrCSSResolver cssResolver = new StyleAttrCSSResolver(cssFiles, r);
     HtmlPipelineContext hpc = new HtmlPipelineContext(null);
     hpc.SetAcceptUnknown(false).AutoBookmark(true).SetTagFactory(Tags.GetHtmlTagProcessorFactory());
     IPipeline pipeline = new CssResolverPipeline(cssResolver, new HtmlPipeline(hpc, null));
     XMLWorker worker = new XMLWorker(pipeline, true);
     p = new XMLParser(worker);
 }
        /* (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);
            }

        }