Java Code Examples for org.docx4j.convert.out.FOSettings#getWmlPackage()

The following examples show how to use org.docx4j.convert.out.FOSettings#getWmlPackage() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FORendererApacheFOP.java    From docx4j-export-FO with Apache License 2.0 5 votes vote down vote up
/**
 * Generate a Fop configuration (unless FOSettings already has it)
 * based on fonts used in the document.
 * 
 * @param settings
 * @return
 * @throws Docx4JException
 */
private static String setupApacheFopConfiguration(FOSettings settings) throws Docx4JException {

	if (settings==null) throw new Docx4JException("FOSettings was null");
	String ret = settings.getApacheFopConfiguration();
	if (ret == null) {
		
		WordprocessingMLPackage wmlPackage = (WordprocessingMLPackage)settings.getWmlPackage();
		if (wmlPackage==null) throw new Docx4JException("No WmlPackage in FOSettings");
		
		ret = FopConfigUtil.createDefaultConfiguration(wmlPackage.getFontMapper(), 
				wmlPackage.getMainDocumentPart().fontsInUse());
	}
	return ret;
}
 
Example 2
Source File: Conversion.java    From docx4j-export-FO with Apache License 2.0 5 votes vote down vote up
protected void setupSettings(FOSettings settings, String mime) {
	if ((wordMLPackage != null) && (settings.getWmlPackage() == null)) {
		settings.setWmlPackage(wordMLPackage);
	}
	if ((saveFO != null) && (settings.getFoDumpFile() == null)) {
		settings.setFoDumpFile(saveFO);
	}
	settings.setApacheFopMime(mime);
}