Package com.adobe.dp.epub.opf

Examples of com.adobe.dp.epub.opf.StyleResource


        CSSParser parser = new CSSParser();
        parser.setCSSURLFactory(new EPUBCSSURLFactory(document.resource));
        try {
          CSSStylesheet css = parser.readStylesheet(new StringReader(content));
          String inlineName = PathUtil.resolveRelativeReference(document.resource.getName(), "inline.css");
          StyleResource sr = epub.createStyleResource(inlineName);
          sr.setCSS(css);
          document.addStyleResource(sr.getResourceRef());
        } catch (IOException e) {
          e.printStackTrace();
        }
      }
    }
View Full Code Here


    Iterator s = styleResources();
    while (s.hasNext()) {
      ResourceRef ref = (ResourceRef) s.next();
      Resource r = ref.getResource();
      if (r instanceof StyleResource) {
        StyleResource sr = (StyleResource) r;
        Stylesheet stylesheet = sr.getStylesheet();
        if (stylesheet != null) {
          CSSStylesheet css = stylesheet.getCSS();
          if (css != null)
            engine.add(css, null);
        }
View Full Code Here

      // prepare table of contents
      NCXResource toc = epub.getTOC();
      TOCEntry rootTOCEntry = toc.getRootTOCEntry();

      // create a stylesheet
      StyleResource style = epub.createStyleResource("OPS/styles.css");
      Stylesheet stylesheet = style.getStylesheet();

      // style h1 element
      Selector h1Selector = stylesheet.getSimpleSelector("h1", null);
      SelectorRule h1Rule = stylesheet.getRuleForSelector(h1Selector,
          true);
View Full Code Here

      // prepare table of contents
      NCXResource toc = epub.getTOC();
      TOCEntry rootTOCEntry = toc.getRootTOCEntry();

      // create a stylesheet
      StyleResource style = epub.createStyleResource("OPS/styles.css");
      Stylesheet stylesheet = style.getStylesheet();

      // style h1 element
      Selector h1Selector = stylesheet.getSimpleSelector("h1", null);
      SelectorRule h1Rule = stylesheet.getRuleForSelector(h1Selector,
          true);
View Full Code Here

TOP

Related Classes of com.adobe.dp.epub.opf.StyleResource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.