Package com.adobe.dp.css

Examples of com.adobe.dp.css.CSSParser


    css = new CSSStylesheet();
  }

  public Stylesheet(StyleResource owner, InputStream in) throws IOException {
    this.owner = owner;
    CSSParser parser = new CSSParser();
    this.css = parser.readStylesheet(in);
    initExisting();
  }
View Full Code Here


  public void serialize(PrintWriter pout) {
    css.serialize(pout);
  }

  public void addDirectStyles(InputStream in) throws IOException {
    CSSParser parser = new CSSParser();
    parser.readStylesheet(in, css);
    initExisting();
  }
View Full Code Here

    if (className != null)
      element.setClassName(className);
    String styleStr = attributes.getValue("style");
    InlineRule style = null;
    if (styleStr != null) {
      CSSParser parser = new CSSParser();
      parser.setCSSURLFactory(new EPUBCSSURLFactory(document.resource));
      style = parser.readInlineStyle(styleStr);
    }
    if (element instanceof ImageElement) {
      ImageElement imageElement = (ImageElement) element;
      String src = attributes.getValue("src");
      if (src != null) {
View Full Code Here

  public void endElement(String uri, String localName, String name) throws SAXException {
    String content = flushText();
    if (uri.equals(OPSDocument.xhtmlns)) {
      if (localName.equals("style")) {
        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) {
View Full Code Here

      String lname = name.toLowerCase();
      if (lname.endsWith(".css")) {
        InputStream in = getInputStream(name);
        if (stylesheet == null)
          stylesheet = new CSSStylesheet();
        CSSParser parser = new CSSParser();
        parser.readStylesheet(in, stylesheet);
        in.close();
      } else if (lname.endsWith(".ttf") || lname.endsWith(".otf") || lname.endsWith(".ttc")) {
        fonts.add(name);
      }
    }
View Full Code Here

    getStylesheet().serialize(pout);
    pout.close();
  }
 
  public void load(DataSource data) throws IOException {
    CSSParser parser = new CSSParser();
    parser.setCSSURLFactory(new EPUBCSSURLFactory(this));
    CSSStylesheet css = parser.readStylesheet(data.getInputStream());
    stylesheet = new Stylesheet(this, css);
  }
View Full Code Here

TOP

Related Classes of com.adobe.dp.css.CSSParser

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.