application.ui.preview.EmbossTask Maven / Gradle / Ivy
package application.ui.preview;
import java.io.InputStream;
import java.net.URL;
import java.util.logging.Logger;
import org.daisy.braille.utils.api.embosser.Embosser;
import org.daisy.braille.utils.api.embosser.EmbosserWriter;
import org.daisy.braille.utils.pef.PEFConverterFacade;
import org.daisy.braille.utils.pef.PEFHandler;
import org.daisy.braille.utils.pef.PEFHandler.Alignment;
import application.common.Configuration;
import application.common.FeatureSwitch;
import org.daisy.braille.utils.pef.PrinterDevice;
import org.daisy.braille.utils.pef.Range;
import javafx.concurrent.Task;
class EmbossTask extends Task {
private static final Logger logger = Logger.getLogger(EmbossTask.class.getCanonicalName());
private final URL url;
private final String deviceName;
private final String align;
private final Range range;
private final int copies;
private final Configuration conf;
EmbossTask(URL url, String deviceName, String align, Range range, int copies, Configuration conf) {
this.url = url;
this.deviceName = deviceName;
this.align = align;
this.range = range;
this.copies = copies;
this.conf = conf;
}
@Override
protected Void call() throws Exception {
//TODO: include range (requires release of pef-tools v2.3.0)
logger.info("About to emboss " + (copies>1?copies + " copies ":"") + "on " + deviceName + " with alignment " + align);
if (FeatureSwitch.EMBOSSING.isOn()) {
for (int i=0; i