All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.docx4j.convert.out.FopReflective Maven / Gradle / Ivy

Go to download

docx4j is a library which helps you to work with the Office Open XML file format as used in docx documents, pptx presentations, and xlsx spreadsheets.

There is a newer version: 11.4.11
Show newest version
package org.docx4j.convert.out;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

public class FopReflective {
	
	public static void invokeFORendererApacheFOP(FOSettings settings) 
			throws NoSuchMethodException, SecurityException, ClassNotFoundException, 
			IllegalAccessException, IllegalArgumentException, InvocationTargetException {
		
		/*
		 *  FopFactoryBuilder fopFactoryBuilder = FORendererApacheFOP.getFopFactoryBuilder(foSettings) ;
		 */
		Class foRendererApacheFOPClass = Class.forName("org.docx4j.convert.out.fo.renderers.FORendererApacheFOP");
		Method method = foRendererApacheFOPClass.getMethod("getFopFactoryBuilder", FOSettings.class );

		Object fopFactoryBuilder = method.invoke(null, settings);
		
		/*
		 * FopFactory fopFactory = fopFactoryBuilder.build();
		 */
		Class fopFactoryBuilderClass = Class.forName("org.apache.fop.apps.FopFactoryBuilder");
		method = fopFactoryBuilderClass.getDeclaredMethod("build", new Class[0] );						
		Object fopFactory = method.invoke(fopFactoryBuilder);
		
		/*
		 * FOUserAgent foUserAgent = FORendererApacheFOP.getFOUserAgent(foSettings, fopFactory); 			
		 */
		Method getFOUserAgent = foRendererApacheFOPClass.getMethod("getFOUserAgent", FOSettings.class, 
				Class.forName("org.apache.fop.apps.FopFactory") );
		getFOUserAgent.invoke(null, settings, fopFactory);
		
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy