src/main/java/com/visiansystems/psdcmd/PsdCmd.java
public static void exportText(Layer layer, String className) {
		if (layer.getPsdDescriptor() == null)
			return;

		// Get the Text object
		PsdText text = (PsdText) layer.getPsdDescriptor().get(TAGS.Txt.name());
		imageQueue.add("<div class=\"" + className + "\"" + ">" + text.getValue().replaceAll("(\\r\\n|\\n)", "<br>") + "</div>");

		// Append the CSS class
		cssBuffer.append("." + className + "{\n");
		cssBuffer.append("	position: fixed;\n");
		cssBuffer.append("	left:" + layer.getX() + "px;\n");
		cssBuffer.append("	top:" + layer.getY() + "px;\n");

		// Get the tex properties
		PsdTextData textData = (PsdTextData) layer.getPsdDescriptor().get(TAGS.EngineData.name());
		if (textData == null || textData.getProperties() == null) {
			cssBuffer.append("}\n");
			return;
		}

		// Get the Font list
		HashMap<String, Object> documentResources = (HashMap<String, Object>)textData.getProperties().get(TAGS.DocumentResources.name());
		if (documentResources == null || documentResources.size() == 0) {
			cssBuffer.append("}\n");
			return;
		}
		ArrayList<HashMap<String, Object>> fontSet = (ArrayList<HashMap<String, Object>>)documentResources.get(TAGS.FontSet.name());
		if (fontSet == null || fontSet.size() == 0) {
			cssBuffer.append("}\n");
			return;
		}
		ArrayList<String> fontList = new ArrayList<String>();
		for (HashMap<String, Object> f : fontSet) {
			fontList.add(f.get("Name").toString());
		}

		// Run all properties
		for (Map.Entry<String, Object> entry : textData.getProperties().entrySet()) {
//			System.out.println("Key: " + entry.getKey());
//			System.out.println("Value: " + entry.getValue());

			// Find the StyleRun table
			Object o = ((HashMap<String, Object>)entry.getValue()).get(TAGS.StyleRun.name());
			if (o == null)
				continue;

			// Run the properties to find de Font Size and color
			HashMap<String, Object> styleRun = (HashMap<String, Object>) o;
			ArrayList<Object> runArray = (ArrayList<Object>)styleRun.get(TAGS.RunArray.name());
			for (Object i : runArray) {
				HashMap<String, Object> item = (HashMap<String, Object>) i;
				for (Map.Entry<String, Object> e : item.entrySet()) {
					HashMap<String, Object> styleSheet = (HashMap<String, Object>) e.getValue();
					for (Map.Entry<String, Object> z : styleSheet.entrySet()) {
						HashMap<String, Object> styleSheetData = (HashMap<String, Object>) z.getValue();
						Double fontIndex = (Double)styleSheetData.get(TAGS.Font.name());
						Double fontSize = (Double)styleSheetData.get(TAGS.FontSize.name());
						HashMap<String, Object> fontColor = (HashMap<String, Object>)styleSheetData.get(TAGS.FillColor.name());
						ArrayList<Double> colors = (ArrayList<Double>)fontColor.get("Values");
						cssBuffer.append("    font-family: " + fontList.get(fontIndex.intValue()) + "px;\n");
						cssBuffer.append("    font-size: " + fontSize.intValue() + "px;\n");
						cssBuffer.append("    color: rgb(" + (int)(colors.get(0) * 255.0)
								+ "," + (int)(colors.get(1) * 255.0)
								+ "," + (int)(colors.get(2) * 255.0)
								+ ");\n"
						);
						Double opacity = colors.get(3);
						cssBuffer.append("	filter: alpha(opacity=" + opacity * 100.0 + ");\n");
						cssBuffer.append("	opacity: " + opacity + ";\n");
					}
				}
			}
		}
		cssBuffer.append("}\n");
	}
/**
	 * exportText
	 * Export a text object.
	 * @param layer The layer with the object.
	 * @param className The class name of the CSS.
	 */
exportText
Export a text object.
@param layer The layer with the object.
@param className The class name of the CSS.
exportText Export a text object . @param layer The layer with the object . @param className The class name of the CSS .
public static void exportText(Layer layer, String className) {
		if (layer.getPsdDescriptor() == null)
			return;
		PsdText text = (PsdText) layer.getPsdDescriptor().get(TAGS.Txt.name());
		imageQueue.add("<div class=\"" + className + "\"" + ">" + text.getValue().replaceAll("(\\r\\n|\\n)", "<br>") + "</div>");
		cssBuffer.append("." + className + "{\n");
		cssBuffer.append("	position: fixed;\n");
		cssBuffer.append("	left:" + layer.getX() + "px;\n");
		cssBuffer.append("	top:" + layer.getY() + "px;\n");
		PsdTextData textData = (PsdTextData) layer.getPsdDescriptor().get(TAGS.EngineData.name());
		if (textData == null || textData.getProperties() == null) {
			cssBuffer.append("}\n");
			return;
		}
		HashMap<String, Object> documentResources = (HashMap<String, Object>)textData.getProperties().get(TAGS.DocumentResources.name());
		if (documentResources == null || documentResources.size() == 0) {
			cssBuffer.append("}\n");
			return;
		}
		ArrayList<HashMap<String, Object>> fontSet = (ArrayList<HashMap<String, Object>>)documentResources.get(TAGS.FontSet.name());
		if (fontSet == null || fontSet.size() == 0) {
			cssBuffer.append("}\n");
			return;
		}
		ArrayList<String> fontList = new ArrayList<String>();
		for (HashMap<String, Object> f : fontSet) {
			fontList.add(f.get("Name").toString());
		}
		for (Map.Entry<String, Object> entry : textData.getProperties().entrySet()) {
			Object o = ((HashMap<String, Object>)entry.getValue()).get(TAGS.StyleRun.name());
			if (o == null)
				continue;
			HashMap<String, Object> styleRun = (HashMap<String, Object>) o;
			ArrayList<Object> runArray = (ArrayList<Object>)styleRun.get(TAGS.RunArray.name());
			for (Object i : runArray) {
				HashMap<String, Object> item = (HashMap<String, Object>) i;
				for (Map.Entry<String, Object> e : item.entrySet()) {
					HashMap<String, Object> styleSheet = (HashMap<String, Object>) e.getValue();
					for (Map.Entry<String, Object> z : styleSheet.entrySet()) {
						HashMap<String, Object> styleSheetData = (HashMap<String, Object>) z.getValue();
						Double fontIndex = (Double)styleSheetData.get(TAGS.Font.name());
						Double fontSize = (Double)styleSheetData.get(TAGS.FontSize.name());
						HashMap<String, Object> fontColor = (HashMap<String, Object>)styleSheetData.get(TAGS.FillColor.name());
						ArrayList<Double> colors = (ArrayList<Double>)fontColor.get("Values");
						cssBuffer.append("    font-family: " + fontList.get(fontIndex.intValue()) + "px;\n");
						cssBuffer.append("    font-size: " + fontSize.intValue() + "px;\n");
						cssBuffer.append("    color: rgb(" + (int)(colors.get(0) * 255.0)
								+ "," + (int)(colors.get(1) * 255.0)
								+ "," + (int)(colors.get(2) * 255.0)
								+ ");\n"
						);
						Double opacity = colors.get(3);
						cssBuffer.append("	filter: alpha(opacity=" + opacity * 100.0 + ");\n");
						cssBuffer.append("	opacity: " + opacity + ";\n");
					}
				}
			}
		}
		cssBuffer.append("}\n");
	}
public static void exportText ( Layer layer , String className ) { if ( layer . getPsdDescriptor ( ) == null ) return ; PsdText text = ( PsdText ) layer . getPsdDescriptor ( ) . get ( TAGS . Txt . name ( ) ) ; imageQueue . add ( "<div class=\"" + className + "\"" + ">" + text . getValue ( ) . replaceAll ( "(\\r\\n|\\n)" , "<br>" ) + "</div>" ) ; cssBuffer . append ( "." + className + "{\n" ) ; cssBuffer . append ( "	position: fixed;\n" ) ; cssBuffer . append ( "	left:" + layer . getX ( ) + "px;\n" ) ; cssBuffer . append ( "	top:" + layer . getY ( ) + "px;\n" ) ; PsdTextData textData = ( PsdTextData ) layer . getPsdDescriptor ( ) . get ( TAGS . EngineData . name ( ) ) ; if ( textData == null || textData . getProperties ( ) == null ) { cssBuffer . append ( "}\n" ) ; return ; } HashMap < String , Object > documentResources = ( HashMap < String , Object > ) textData . getProperties ( ) . get ( TAGS . DocumentResources . name ( ) ) ; if ( documentResources == null || documentResources . size ( ) == 0 ) { cssBuffer . append ( "}\n" ) ; return ; } ArrayList < HashMap < String , Object > > fontSet = ( ArrayList < HashMap < String , Object > > ) documentResources . get ( TAGS . FontSet . name ( ) ) ; if ( fontSet == null || fontSet . size ( ) == 0 ) { cssBuffer . append ( "}\n" ) ; return ; } ArrayList < String > fontList = new ArrayList < String > ( ) ; for ( HashMap < String , Object > f : fontSet ) { fontList . add ( f . get ( "Name" ) . toString ( ) ) ; } for ( Map . Entry < String , Object > entry : textData . getProperties ( ) . entrySet ( ) ) { Object o = ( ( HashMap < String , Object > ) entry . getValue ( ) ) . get ( TAGS . StyleRun . name ( ) ) ; if ( o == null ) continue ; HashMap < String , Object > styleRun = ( HashMap < String , Object > ) o ; ArrayList < Object > runArray = ( ArrayList < Object > ) styleRun . get ( TAGS . RunArray . name ( ) ) ; for ( Object i : runArray ) { HashMap < String , Object > item = ( HashMap < String , Object > ) i ; for ( Map . Entry < String , Object > e : item . entrySet ( ) ) { HashMap < String , Object > styleSheet = ( HashMap < String , Object > ) e . getValue ( ) ; for ( Map . Entry < String , Object > z : styleSheet . entrySet ( ) ) { HashMap < String , Object > styleSheetData = ( HashMap < String , Object > ) z . getValue ( ) ; Double fontIndex = ( Double ) styleSheetData . get ( TAGS . Font . name ( ) ) ; Double fontSize = ( Double ) styleSheetData . get ( TAGS . FontSize . name ( ) ) ; HashMap < String , Object > fontColor = ( HashMap < String , Object > ) styleSheetData . get ( TAGS . FillColor . name ( ) ) ; ArrayList < Double > colors = ( ArrayList < Double > ) fontColor . get ( "Values" ) ; cssBuffer . append ( "    font-family: " + fontList . get ( fontIndex . intValue ( ) ) + "px;\n" ) ; cssBuffer . append ( "    font-size: " + fontSize . intValue ( ) + "px;\n" ) ; cssBuffer . append ( "    color: rgb(" + ( int ) ( colors . get ( 0 ) * 255.0 ) + "," + ( int ) ( colors . get ( 1 ) * 255.0 ) + "," + ( int ) ( colors . get ( 2 ) * 255.0 ) + ");\n" ) ; Double opacity = colors . get ( 3 ) ; cssBuffer . append ( "	filter: alpha(opacity=" + opacity * 100.0 + ");\n" ) ; cssBuffer . append ( "	opacity: " + opacity + ";\n" ) ; } } } } cssBuffer . append ( "}\n" ) ; }
exportText
 Export a text object.
exportText Export a text object .
// Get the Text object // Append the CSS class // Get the tex properties // Get the Font list // Run all properties //			System.out.println("Key: " + entry.getKey()); //			System.out.println("Value: " + entry.getValue()); // Find the StyleRun table // Run the properties to find de Font Size and color