mirror of
https://github.com/ONLYOFFICE/server.git
synced 2026-04-07 14:04:35 +08:00
[bug] Add "oformAsPdf" conversion flag for PDF editor
This commit is contained in:
@ -108,6 +108,7 @@ function InputCommand(data, copyExplicit) {
|
||||
this['convertToOrigin'] = data['convertToOrigin'];
|
||||
this['isSaveAs'] = data['isSaveAs'];
|
||||
this['saveAsPath'] = data['saveAsPath'];
|
||||
this['oformAsPdf'] = data['oformAsPdf'];
|
||||
if (copyExplicit) {
|
||||
this['withAuthorization'] = data['withAuthorization'];
|
||||
this['externalChangeInfo'] = data['externalChangeInfo'];
|
||||
@ -170,6 +171,7 @@ function InputCommand(data, copyExplicit) {
|
||||
this['originformat'] = undefined;
|
||||
this['isSaveAs'] = undefined;
|
||||
this['saveAsPath'] = undefined;
|
||||
this['oformAsPdf'] = undefined;
|
||||
}
|
||||
}
|
||||
InputCommand.prototype = {
|
||||
@ -503,6 +505,12 @@ InputCommand.prototype = {
|
||||
},
|
||||
setSaveAsPath: function(data) {
|
||||
this['saveAsPath'] = data;
|
||||
},
|
||||
getOformAsPdf: function() {
|
||||
return this['oformAsPdf'];
|
||||
},
|
||||
setOformAsPdf: function(data) {
|
||||
this['oformAsPdf'] = data;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -279,6 +279,7 @@ function convertRequest(req, res, isJson) {
|
||||
utils.fillResponse(req, res, new commonDefines.ConvertStatus(constants.CONVERT_PARAMS), isJson);
|
||||
return;
|
||||
}
|
||||
let oformAsPdf;
|
||||
if (params.pdf) {
|
||||
if (true === params.pdf.pdfa && constants.AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_PDF === outputFormat) {
|
||||
outputFormat = constants.AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_PDFA;
|
||||
@ -288,6 +289,8 @@ function convertRequest(req, res, isJson) {
|
||||
if (params.pdf.form && (constants.AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_PDF === outputFormat ||
|
||||
constants.AVS_OFFICESTUDIO_FILE_CROSSPLATFORM_PDFA === outputFormat)) {
|
||||
outputFormat = constants.AVS_OFFICESTUDIO_FILE_DOCUMENT_OFORM_PDF;
|
||||
} else if (false === params.pdf.form) {
|
||||
oformAsPdf = true;
|
||||
}
|
||||
}
|
||||
//todo use hash of params as id
|
||||
@ -299,6 +302,7 @@ function convertRequest(req, res, isJson) {
|
||||
cmd.setFormat(filetype);
|
||||
cmd.setDocId(docId);
|
||||
cmd.setOutputFormat(outputFormat);
|
||||
cmd.setOformAsPdf(oformAsPdf);
|
||||
let outputExt = formatChecker.getStringFromFormat(cmd.getOutputFormat());
|
||||
|
||||
cmd.setCodepage(commonDefines.c_oAscEncodingsMap[params.codePage] || commonDefines.c_oAscCodePageUtf8);
|
||||
|
||||
@ -133,6 +133,7 @@ function TaskQueueDataConvert(ctx, task) {
|
||||
this.savePassword = cmd.getSavePassword();
|
||||
this.noBase64 = cmd.getNoBase64();
|
||||
this.convertToOrigin = cmd.getConvertToOrigin();
|
||||
this.oformAsPdf = cmd.getOformAsPdf();
|
||||
this.timestamp = new Date();
|
||||
}
|
||||
TaskQueueDataConvert.prototype = {
|
||||
@ -169,7 +170,7 @@ TaskQueueDataConvert.prototype = {
|
||||
xml += this.serializeXmlProp('m_bIsNoBase64', this.noBase64);
|
||||
xml += this.serializeXmlProp('m_sConvertToOrigin', this.convertToOrigin);
|
||||
xml += this.serializeLimit(ctx);
|
||||
xml += this.serializeOptions(ctx, false);
|
||||
xml += this.serializeOptions(ctx, false, this.oformAsPdf);
|
||||
xml += '</TaskQueueDataConvert>';
|
||||
fs.writeFileSync(fsPath, xml, {encoding: 'utf8'});
|
||||
},
|
||||
@ -192,7 +193,7 @@ TaskQueueDataConvert.prototype = {
|
||||
return xml;
|
||||
});
|
||||
},
|
||||
serializeOptions: function (ctx, isInJwtToken) {
|
||||
serializeOptions: function (ctx, isInJwtToken, oformAsPdf) {
|
||||
const tenRequesFilteringAgent = ctx.getCfg('services.CoAuthoring.request-filtering-agent', cfgRequesFilteringAgent);
|
||||
const tenExternalRequestDirectIfIn = ctx.getCfg('externalRequest.directIfIn', cfgExternalRequestDirectIfIn);
|
||||
const tenExternalRequestAction = ctx.getCfg('externalRequest.action', cfgExternalRequestAction);
|
||||
@ -231,6 +232,9 @@ TaskQueueDataConvert.prototype = {
|
||||
if (proxyHeadersStr.length > 0) {
|
||||
xml += this.serializeXmlProp('proxyHeader', proxyHeadersStr.join(';'));
|
||||
}
|
||||
if (undefined !== oformAsPdf) {
|
||||
xml += this.serializeXmlProp('oformAsPdf', oformAsPdf);
|
||||
}
|
||||
xml += '</options>';
|
||||
return xml;
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user