LPD-files are lecture-recordings that can be play-backed with the Lecturnity-Player (http://132.230.139.59/csc/). Because theres currently no java-interface exists to extract the text-elements of the file, a specification for the extraction has to be developed. Base for this specification (2 tags)
TEXT-Tag
<TEXT x=245 y=123 width=300 height=20>...</TEXT> This TEXT-Tag can contain several TEXTITEM-Tags:
Classes Best would be java-classes for the Text-&TextItem-Tags. The class LPDTextTag represents a TEXT-Tag and contains an array of the containing TEXTITEM-Tags (LPDTextItemTag[]). Over a class LPDFile (see far below) it should be possible to retrieve the Meta-Data and TEXT-Tags (indirectly also the TEXTITEM-Tags). The contents could be completely filled statically when opening the file. A stream-based variant should not be necessay.
LPDTextTag package imc.epresenter.filesdk;
/** * Class for storing a TEXT-Tag * @author Markus Krebs */ public class LPDTextTag { private int x; private int y; private int width; private int height; /** * The page-nr (started from 1 to maxpages) the TEXT-Tag lies into * VERY IMPORTANT */ private int pageNr; /** The TEXTITEM-Tags that are inside this TEXT-Tag. */ private LPDTextItemTag[] textItemTags; public LPDTextTag() {} public int getHeight() { return height; } public int getPageNr() { return pageNr; } public LPDTextItemTag[] getTextItemTags() { return textItemTags; } public int getWidth() { return width; } public int getX() { return x; } public int getY() { return y; }
} A page-number where the Tag occure (see above: pageNr) must necessarily available! (page-numbering from x = 1 to n according to MetaData.ThumbnailData[x-1]).
LPDTextItemTag package imc.epresenter.filesdk; import java.awt.Color;
/** * Class for storing a TEXTITEM-Tag * @author Markus Krebs */ public class LPDTextItemTag { // Weights // Add here more for other weights by assigning integer-values. If it is // possible that a font can have mixed weights, than use 1, 2, 4, 8, 16, ... // so that the values can be mixed by addition. public static final int WEIGHT_NORMAL = 0; // Styles // Add here more for other styles. Because e.g. font-styles normally can be mixed, // use e.g. STYLE_BOLD=1, STYLE_ITALIC=2, STYLE_UNDERLINE=4. // for a bold and underline style results: 5 (1+4) public static final int STYLE_NONE = 0; // Fields private int x; private int y; private int offx; private int offy; private String font; private int size; private Color ccolor; private int weight; // a constant from above starting with WEIGHT_ (addition possible) private String slant; private int style; // a constant from above starting with STYLE_ (addition possible) private String ttf; private Color rgb; // the raw text the textitem describes private String text; /* optional fields (i think not really needed) * width and heigth of the textitembox in pixel (same scaling as x y size, etc) * if this values are present in the LPD-File, than include it. * needed, to determine text-overlapping. */ private int width; private int height; public LPDTextItemTag() { weight = WEIGHT_NORMAL; style = STYLE_NONE; } public Color getCColor() { return ccolor; } public String getFont() { return font; } public int getHeight() { return height; } public int getOffX() { return offx; } public int getOffY() { return offy; } public Color getRGB() { return rgb; } public int getSize() { return size; } public String getSlant() { return slant; } public int getStyle() { return style; } public String getText() { return text; } public String getTTF() { return ttf; } public int getWeight() { return weight; } public int getWidth() { return width; } public int getX() { return x; } public int getY() { return y; }
}
LPDFile package imc.epresenter.filesdk; import java.io.File; public class LPDFile { public static LPDFile open(File file) { // Code for opening the file and filling the MetaData and LPDTextTags // this method can close the file afterwards immediatly return null; } /** * Returns the MetaData of the lpd-file * (imc.epresenter.filesdk.MetaData) * @return */ public Metadata getMetaData() { return null; } /** * Returns the TEXT-Tags of the lpd-file as an array * @return */ public LPDTextTag[] getTextTags() { return null; }
}
Later application (example) File file = new File("einleitung.lpd"); LPDFile lpdFile = LPDFile.open(file); LPDTextTag[] textTags = lpdFile.getTextTags();
// process the text and textitem-tags .....
Remark The HTML-Code of this page is so designed, that one can mark the Java-Codes and Copy-Paste them out.