Package net.sf.jpluck.plucker

Examples of net.sf.jpluck.plucker.Paragraph


            src = URIUtil.fixURI(src);
            String url = ser.resolveLink(src);
            // As a precaution we remove any anchors. (These should not occur in image links in the first place.)
            url = URIUtil.removeAnchor(url);

            Paragraph p = ser.getCurrentParagraph();
            p.addEmbeddedImage(url, elem.getAttributes().getValue("alt"));
            if (ser.isIncludeImages()) {
                ser.addEmbeddedImageURL(url);
            }
        } catch (Exception e) {
            // Invalid URL or null
View Full Code Here


public class H2Handler implements TagHandler, Alignable {
    public void start(HTMLSerializer ser, StyledElement elem) {
        Style style = new Style();
        style.setHeading(2);
        elem.setStyle(style);
        Paragraph p = ser.addParagraph();
        p.setSpacing(3);
    }
View Full Code Here

public class H1Handler implements TagHandler, Alignable {
    public void start(HTMLSerializer ser, StyledElement elem) {
        Style style = new Style();
        style.setHeading(1);
        elem.setStyle(style);
        Paragraph p = ser.addParagraph();
        p.setSpacing(4);
    }
View Full Code Here

        try {
            height = Integer.parseInt(s);
        } catch (NumberFormatException e) {
        }

        Paragraph p = ser.addParagraph();
        p.setSpacing(4);
        String align = elem.getAttributes().getValue("align");
        if (align==null) {
            align="center";
        }
        if (align.equalsIgnoreCase("center")) {
            p.addAlignCenter();
        } else if (align.equalsIgnoreCase("right")) {
            p.addAlignRight();
        }
        if (relative) {
            if (width > 100) {
                width = 100;
            }
            p.addHorizontalRuleRelative(width, height);
        } else {
            if (width > 160) {
                width = 160;
            }
            p.addHorizontalRuleAbsolute(width, height);
        }
        ser.addParagraph(4);
    }
View Full Code Here

      if (charset == null) {
        charset = "ISO-8859-1";
      }
      LineNumberReader rdr = new LineNumberReader(new InputStreamReader(new ByteArrayInputStream(resource.getData()),
                                        charset));
      Paragraph paragraph = textRecord.addParagraph(Paragraph.DEFAULT_SPACING);
      for (String line; (line = rdr.readLine()) != null;) {
        if (line.length() == 0) {
          paragraph = textRecord.addParagraph(Paragraph.DEFAULT_SPACING);
        } else {
          int start = line.indexOf("http://");
          if (start > -1) {
            int end = line.indexOf(' ', start);
            if (end == -1) {
              end = line.length();
            }

            String url = line.substring(start, end);
            paragraph.addLinkStart(url);
            paragraph.addPreformattedText(url);
            paragraph.addLinkEnd();
          } else {
            paragraph.addPreformattedText(line);
          }
          paragraph.addNewline();
        }
      }
      pluckerDocument.addRecord(textRecord);
    } catch (IOException e) {
      throw new HandlingException(e);
View Full Code Here

import net.sf.jpluck.plucker.Paragraph;


public class ParagraphHandler implements TagHandler, Alignable {
  public void start(HTMLSerializer ser, StyledElement elem) {
    Paragraph p = ser.addParagraph();
    String id = elem.getAttributes().getValue("id");
    if (id != null) {
      p.addAnchor(id);
    }
  }
View Full Code Here

import net.sf.jpluck.plucker.Paragraph;
import net.sf.jpluck.plucker.Text;

public class ListItemHandler implements TagHandler {
    public void start(HTMLSerializer ser, StyledElement elem) {
        Paragraph p = ser.addParagraph(0);
        Style cascadedStyle = elem.getCascadedStyle();
        ListStack.HTMLList list = ser.getListStack().peek();
        if (list != null) {
            list.add();
            Style style = new Style();
            elem.setStyle(style);
            if (list.isOrdered()) {
                p.addOrderedListItem(cascadedStyle.getMarginLeft(), list.size());
                int margin = cascadedStyle.getMarginLeft() + 3;
                if (list.size() > 9) {
                    margin += 5;
                }
                if (list.size() > 99) {
                    margin += 5;
                }
                style.setMarginLeft(ser.scaledValue(margin));
                ser.marginApplied();
            } else {
                p.addListBullet(cascadedStyle.getMarginLeft());
                style.setMarginLeft(ser.scaledValue(6));
                ser.marginApplied();
            }
        } else {
            p.addText(Text.createPalmMidDot()).addText(" ");
        }
    }
View Full Code Here

public class H4Handler implements TagHandler, Alignable {
    public void start(HTMLSerializer ser, StyledElement elem) {
        Style style = new Style();
        style.setHeading(4);
        elem.setStyle(style);
        Paragraph p = ser.addParagraph();
        p.setSpacing(2);
    }
View Full Code Here

        }
        catch (NumberFormatException e) {
        }
            }
        } else {
            Paragraph p = ser.addParagraph();
            Element table = elem.getAncestor("table");
            if ((table != null) && (elem.getSiblings().length > 0)) {
                try {
                    int border = Integer.parseInt(table.getAttributes().getValue("border"));

                    if (border > 0) {
                        if (elem.getQName().equals("tr")) {
                            border = border * 2;
                        }

                        p.addHorizontalRuleRelative(100, border);
                        p = ser.addParagraph();
                    }
                } catch (Exception e) {
                }
            }
View Full Code Here

public class H3Handler implements TagHandler, Alignable {
    public void start(HTMLSerializer ser, StyledElement elem) {
        Style style = new Style();
        style.setHeading(3);
        elem.setStyle(style);
        Paragraph p = ser.addParagraph();
        p.setSpacing(3);
    }
View Full Code Here

TOP

Related Classes of net.sf.jpluck.plucker.Paragraph

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.