Added a new flag to switch SWF files conversion on and off.

This commit is contained in:
Ghazi Triki 2019-03-06 19:07:28 +01:00
parent 25a2d0a707
commit 5482fa07f9
3 changed files with 33 additions and 19 deletions

View File

@ -57,6 +57,7 @@ public class PdfToSwfSlidesGenerationService {
private long MAX_CONVERSION_TIME = 5 * 60 * 1000L * 1000L * 1000L;
private String BLANK_SLIDE;
private int MAX_SWF_FILE_SIZE;
private boolean swfSlidesRequired;
private boolean svgImagesRequired;
private boolean generatePngs;
@ -64,26 +65,29 @@ public class PdfToSwfSlidesGenerationService {
executor = Executors.newFixedThreadPool(numConversionThreads);
}
public void generateSlides(UploadedPresentation pres) {
determineNumberOfPages(pres);
if (pres.getNumberOfPages() > 0) {
convertPdfToSwf(pres);
createTextFiles(pres);
createThumbnails(pres);
public void generateSlides(UploadedPresentation pres) {
determineNumberOfPages(pres);
if (pres.getNumberOfPages() > 0) {
// Only create SWF files if the configuration requires it
if (swfSlidesRequired) {
convertPdfToSwf(pres);
createTextFiles(pres);
createThumbnails(pres);
}
// only create SVG images if the configuration requires it
if (svgImagesRequired) {
createSvgImages(pres);
}
// only create SVG images if the configuration requires it
if (svgImagesRequired) {
createSvgImages(pres);
}
// only create PNG images if the configuration requires it
if (generatePngs) {
createPngImages(pres);
}
// only create PNG images if the configuration requires it
if (generatePngs) {
createPngImages(pres);
}
notifier.sendConversionCompletedMessage(pres);
notifier.sendConversionCompletedMessage(pres);
}
}
}
private boolean determineNumberOfPages(UploadedPresentation pres) {
try {
@ -331,9 +335,13 @@ public class PdfToSwfSlidesGenerationService {
this.generatePngs = generatePngs;
}
public void setSvgImagesRequired(boolean svg) {
this.svgImagesRequired = svg;
}
public void setSwfSlidesRequired(boolean swf) {
this.swfSlidesRequired = swf;
}
public void setSvgImagesRequired(boolean svg) {
this.svgImagesRequired = svg;
}
public void setThumbnailCreator(ThumbnailCreator thumbnailCreator) {
this.thumbnailCreator = thumbnailCreator;

View File

@ -84,6 +84,11 @@ defineTextThreshold=2000
#------------------------------------
numConversionThreads=2
#----------------------------------------------------
# Conversion of the presentation slides to SWF to be
# used in the Flash client
swfSlidesRequired=true
#----------------------------------------------------
# Additional conversion of the presentation slides to SVG
# to be used in the HTML5 client

View File

@ -99,6 +99,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
<property name="maxSwfFileSize" value="${MAX_SWF_FILE_SIZE}"/>
<property name="maxConversionTime" value="${maxConversionTime}"/>
<property name="swfSlidesGenerationProgressNotifier" ref="swfSlidesGenerationProgressNotifier"/>
<property name="swfSlidesRequired" value="${swfSlidesRequired}"/>
<property name="svgImagesRequired" value="${svgImagesRequired}"/>
<property name="generatePngs" value="${generatePngs}"/>
</bean>