Merge pull request #1557 from ONLYOFFICE/fix/pdf-download
Fix/pdf download
This commit is contained in:
commit
18359ef56e
18
apps/common/main/resources/img/doc-formats/djvu.svg
Normal file
18
apps/common/main/resources/img/doc-formats/djvu.svg
Normal file
|
@ -0,0 +1,18 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 127" version="1.1" width="100" height="127">
|
||||
<symbol id="svg-format-djvu">
|
||||
<path d="M95 23V119C95 119.796 94.6839 120.559 94.1213 121.121C93.5587 121.684 92.7956 122 92 122H8C7.20435 122 6.44129 121.684 5.87868 121.121C5.31607 120.559 5 119.796 5 119V8C5 7.20435 5.31607 6.44129 5.87868 5.87868C6.44129 5.31607 7.20435 5 8 5H77L95 23Z" fill="#BC8C18"/>
|
||||
<path opacity="0.2" d="M95 23H80C79.2044 23 78.4413 22.6839 77.8787 22.1213C77.3161 21.5587 77 20.7956 77 20V5L95 23Z" fill="black"/>
|
||||
<path d="M44.5845 109.635C44.5845 111.045 44.1821 112.125 43.3774 112.875C42.5767 113.625 41.4185 114 39.9028 114H37.4771V105.434H40.1665C41.5649 105.434 42.6509 105.803 43.4243 106.541C44.1978 107.279 44.5845 108.311 44.5845 109.635ZM42.6978 109.682C42.6978 107.842 41.8853 106.922 40.2603 106.922H39.2935V112.5H40.0728C41.8228 112.5 42.6978 111.561 42.6978 109.682ZM45.6919 116.883C45.2349 116.883 44.8423 116.834 44.5142 116.736V115.33C44.7876 115.404 45.0669 115.441 45.3521 115.441C45.6528 115.441 45.8716 115.357 46.0083 115.189C46.1489 115.021 46.2192 114.773 46.2192 114.445V107.449H48.0063V114.709C48.0063 115.404 47.8052 115.939 47.4028 116.314C47.0005 116.693 46.4302 116.883 45.6919 116.883ZM46.1431 105.756C46.1431 105.174 46.4673 104.883 47.1157 104.883C47.7642 104.883 48.0884 105.174 48.0884 105.756C48.0884 106.033 48.0063 106.25 47.8423 106.406C47.6821 106.559 47.4399 106.635 47.1157 106.635C46.4673 106.635 46.1431 106.342 46.1431 105.756ZM54.9146 105.434H56.7485L53.8364 114H51.856L48.9497 105.434H50.7837L52.395 110.531C52.4849 110.832 52.5767 111.184 52.6704 111.586C52.7681 111.984 52.8286 112.262 52.8521 112.418C52.895 112.059 53.0415 111.43 53.2915 110.531L54.9146 105.434ZM62.3325 114L62.0923 113.162H61.9985C61.8071 113.467 61.5356 113.703 61.1841 113.871C60.8325 114.035 60.4321 114.117 59.9829 114.117C59.2134 114.117 58.6333 113.912 58.2427 113.502C57.8521 113.088 57.6567 112.494 57.6567 111.721V107.449H59.4438V111.275C59.4438 111.748 59.5278 112.104 59.6958 112.342C59.8638 112.576 60.1313 112.693 60.4985 112.693C60.9985 112.693 61.3599 112.527 61.5825 112.195C61.8052 111.859 61.9165 111.305 61.9165 110.531V107.449H63.7036V114H62.3325Z" fill="white"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M27 58V52V50H29H35H44H50H52V52V58H50V52H44V74H49V76H44H35H30V74H35V52H29V58H27Z" fill="white"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M27 58V52V50H29H35H44H50H52V52V58H50V52H44V74H49V76H44H35H30V74H35V52H29V58H27Z" fill="white"/>
|
||||
<rect x="55" y="50" width="19" height="2" fill="white"/>
|
||||
<rect x="55" y="50" width="19" height="2" fill="white"/>
|
||||
<rect x="55" y="58" width="19" height="2" fill="white"/>
|
||||
<rect x="55" y="58" width="19" height="2" fill="white"/>
|
||||
<rect x="55" y="66" width="19" height="2" fill="white"/>
|
||||
<rect x="55" y="66" width="19" height="2" fill="white"/>
|
||||
<rect x="55" y="74" width="19" height="2" fill="white"/>
|
||||
<rect x="55" y="74" width="19" height="2" fill="white"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M80 43.4348H21V82.5653H80V43.4348ZM19 41.4348V84.5653H82V41.4348H19Z" fill="white"/>
|
||||
</symbol>
|
||||
</svg>
|
After Width: | Height: | Size: 3.1 KiB |
11
apps/common/main/resources/img/doc-formats/oxps.svg
Normal file
11
apps/common/main/resources/img/doc-formats/oxps.svg
Normal file
|
@ -0,0 +1,11 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 127" version="1.1" width="100" height="127">
|
||||
<symbol id="svg-format-oxps">
|
||||
<path d="M95 23V119C95 119.796 94.6839 120.559 94.1213 121.121C93.5587 121.684 92.7956 122 92 122H8C7.20435 122 6.44129 121.684 5.87868 121.121C5.31607 120.559 5 119.796 5 119V8C5 7.20435 5.31607 6.44129 5.87868 5.87868C6.44129 5.31607 7.20435 5 8 5H77L95 23Z" fill="#51968F"/>
|
||||
<circle cx="44.5" cy="62.5" r="2.5" fill="white"/>
|
||||
<circle cx="54.5" cy="62.5" r="2.5" fill="white"/>
|
||||
<path opacity="0.2" d="M95 23H80C79.2044 23 78.4413 22.6839 77.8787 22.1213C77.3161 21.5587 77 20.7956 77 20V5L95 23Z" fill="black"/>
|
||||
<path d="M42.894 109.705C42.894 111.123 42.5425 112.213 41.8394 112.975C41.1362 113.736 40.1284 114.117 38.8159 114.117C37.5034 114.117 36.4956 113.736 35.7925 112.975C35.0894 112.213 34.7378 111.119 34.7378 109.693C34.7378 108.268 35.0894 107.18 35.7925 106.43C36.4995 105.676 37.5112 105.299 38.8276 105.299C40.144 105.299 41.1499 105.678 41.8452 106.436C42.5444 107.193 42.894 108.283 42.894 109.705ZM36.6421 109.705C36.6421 110.662 36.8237 111.383 37.187 111.867C37.5503 112.352 38.0933 112.594 38.8159 112.594C40.2651 112.594 40.9897 111.631 40.9897 109.705C40.9897 107.775 40.269 106.811 38.8276 106.811C38.105 106.811 37.5601 107.055 37.1929 107.543C36.8257 108.027 36.6421 108.748 36.6421 109.705ZM51.5952 114H49.521L47.5288 110.76L45.5366 114H43.5913L46.4331 109.582L43.7729 105.434H45.7769L47.6226 108.516L49.4331 105.434H51.3901L48.7007 109.682L51.5952 114ZM54.4897 109.465H55.0874C55.646 109.465 56.064 109.355 56.3413 109.137C56.6187 108.914 56.7573 108.592 56.7573 108.17C56.7573 107.744 56.6401 107.43 56.4058 107.227C56.1753 107.023 55.812 106.922 55.3159 106.922H54.4897V109.465ZM58.5913 108.105C58.5913 109.027 58.3022 109.732 57.7241 110.221C57.1499 110.709 56.3315 110.953 55.269 110.953H54.4897V114H52.6733V105.434H55.4097C56.4487 105.434 57.2378 105.658 57.7769 106.107C58.3198 106.553 58.5913 107.219 58.5913 108.105ZM65.2651 111.621C65.2651 112.395 64.9858 113.004 64.4272 113.449C63.8726 113.895 63.0991 114.117 62.1069 114.117C61.1929 114.117 60.3843 113.945 59.6812 113.602V111.914C60.2593 112.172 60.7476 112.354 61.146 112.459C61.5483 112.564 61.9155 112.617 62.2476 112.617C62.646 112.617 62.9507 112.541 63.1616 112.389C63.3765 112.236 63.4839 112.01 63.4839 111.709C63.4839 111.541 63.437 111.393 63.3433 111.264C63.2495 111.131 63.1108 111.004 62.9272 110.883C62.7476 110.762 62.3784 110.568 61.8198 110.303C61.2964 110.057 60.9038 109.82 60.6421 109.594C60.3804 109.367 60.1714 109.104 60.0151 108.803C59.8589 108.502 59.7808 108.15 59.7808 107.748C59.7808 106.99 60.0366 106.395 60.5483 105.961C61.064 105.527 61.7749 105.311 62.6812 105.311C63.1265 105.311 63.5503 105.363 63.9526 105.469C64.3589 105.574 64.7827 105.723 65.2241 105.914L64.6382 107.326C64.1812 107.139 63.8022 107.008 63.5015 106.934C63.2046 106.859 62.9116 106.822 62.6226 106.822C62.2788 106.822 62.0151 106.902 61.8315 107.062C61.6479 107.223 61.5562 107.432 61.5562 107.689C61.5562 107.85 61.5933 107.99 61.6675 108.111C61.7417 108.229 61.8589 108.344 62.019 108.457C62.1831 108.566 62.5679 108.766 63.1733 109.055C63.9741 109.438 64.5229 109.822 64.8198 110.209C65.1167 110.592 65.2651 111.062 65.2651 111.621Z" fill="white"/>
|
||||
<path d="M62 53V57.8L75.5 62.5L62 67.2V72L80 64.2V60.8L62 53Z" fill="white"/>
|
||||
<path d="M19 64.2L37 72V67.2L23.5 62.5L37 57.8V53L19 60.8V64.2Z" fill="white"/>
|
||||
</symbol>
|
||||
</svg>
|
After Width: | Height: | Size: 3.4 KiB |
11
apps/common/main/resources/img/doc-formats/xps.svg
Normal file
11
apps/common/main/resources/img/doc-formats/xps.svg
Normal file
|
@ -0,0 +1,11 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 127" version="1.1" width="100" height="127">
|
||||
<symbol id="svg-format-xps">
|
||||
<path d="M95 23V119C95 119.796 94.6839 120.559 94.1213 121.121C93.5587 121.684 92.7956 122 92 122H8C7.20435 122 6.44129 121.684 5.87868 121.121C5.31607 120.559 5 119.796 5 119V8C5 7.20435 5.31607 6.44129 5.87868 5.87868C6.44129 5.31607 7.20435 5 8 5H77L95 23Z" fill="#51968F"/>
|
||||
<circle cx="44.5" cy="62.5" r="2.5" fill="white"/>
|
||||
<circle cx="54.5" cy="62.5" r="2.5" fill="white"/>
|
||||
<path opacity="0.2" d="M95 23H80C79.2044 23 78.4413 22.6839 77.8787 22.1213C77.3161 21.5587 77 20.7956 77 20V5L95 23Z" fill="black"/>
|
||||
<path d="M47.3198 114H45.2456L43.2534 110.76L41.2612 114H39.3159L42.1577 109.582L39.4976 105.434H41.5015L43.3472 108.516L45.1577 105.434H47.1147L44.4253 109.682L47.3198 114ZM50.2144 109.465H50.812C51.3706 109.465 51.7886 109.355 52.0659 109.137C52.3433 108.914 52.4819 108.592 52.4819 108.17C52.4819 107.744 52.3647 107.43 52.1304 107.227C51.8999 107.023 51.5366 106.922 51.0405 106.922H50.2144V109.465ZM54.3159 108.105C54.3159 109.027 54.0269 109.732 53.4487 110.221C52.8745 110.709 52.0562 110.953 50.9937 110.953H50.2144V114H48.3979V105.434H51.1343C52.1733 105.434 52.9624 105.658 53.5015 106.107C54.0444 106.553 54.3159 107.219 54.3159 108.105ZM60.9897 111.621C60.9897 112.395 60.7104 113.004 60.1519 113.449C59.5972 113.895 58.8237 114.117 57.8315 114.117C56.9175 114.117 56.1089 113.945 55.4058 113.602V111.914C55.9839 112.172 56.4722 112.354 56.8706 112.459C57.2729 112.564 57.6401 112.617 57.9722 112.617C58.3706 112.617 58.6753 112.541 58.8862 112.389C59.1011 112.236 59.2085 112.01 59.2085 111.709C59.2085 111.541 59.1616 111.393 59.0679 111.264C58.9741 111.131 58.8354 111.004 58.6519 110.883C58.4722 110.762 58.103 110.568 57.5444 110.303C57.021 110.057 56.6284 109.82 56.3667 109.594C56.105 109.367 55.896 109.104 55.7397 108.803C55.5835 108.502 55.5054 108.15 55.5054 107.748C55.5054 106.99 55.7612 106.395 56.2729 105.961C56.7886 105.527 57.4995 105.311 58.4058 105.311C58.8511 105.311 59.2749 105.363 59.6772 105.469C60.0835 105.574 60.5073 105.723 60.9487 105.914L60.3628 107.326C59.9058 107.139 59.5269 107.008 59.2261 106.934C58.9292 106.859 58.6362 106.822 58.3472 106.822C58.0034 106.822 57.7397 106.902 57.5562 107.062C57.3726 107.223 57.2808 107.432 57.2808 107.689C57.2808 107.85 57.3179 107.99 57.3921 108.111C57.4663 108.229 57.5835 108.344 57.7437 108.457C57.9077 108.566 58.2925 108.766 58.8979 109.055C59.6987 109.438 60.2476 109.822 60.5444 110.209C60.8413 110.592 60.9897 111.062 60.9897 111.621Z" fill="white"/>
|
||||
<path d="M62 53V57.8L75.5 62.5L62 67.2V72L80 64.2V60.8L62 53Z" fill="white"/>
|
||||
<path d="M19 64.2L37 72V67.2L23.5 62.5L37 57.8V53L19 60.8V64.2Z" fill="white"/>
|
||||
</symbol>
|
||||
</svg>
|
After Width: | Height: | Size: 2.7 KiB |
|
@ -494,7 +494,7 @@ define([
|
|||
enable = !this.editorConfig.customization || (this.editorConfig.customization.plugins!==false);
|
||||
docInfo.asc_putIsEnabledPlugins(!!enable);
|
||||
|
||||
var type = /^(?:(pdf|djvu|xps))$/.exec(data.doc.fileType);
|
||||
var type = /^(?:(pdf|djvu|xps|oxps))$/.exec(data.doc.fileType);
|
||||
if (type && typeof type[1] === 'string') {
|
||||
this.permissions.edit = this.permissions.review = false;
|
||||
}
|
||||
|
|
|
@ -367,9 +367,12 @@ define([
|
|||
clickSaveAsFormat: function(menu, format, ext) { // ext isn't undefined for save copy as
|
||||
var me = this,
|
||||
fileType = this.getApplication().getController('Main').document.fileType;
|
||||
if ( /^pdf|xps|oxps$/.test(fileType)) {
|
||||
if (format===undefined || format == Asc.c_oAscFileType.PDF || format == Asc.c_oAscFileType.PDFA || format == Asc.c_oAscFileType.XPS)
|
||||
if ( /^pdf|xps|oxps|djvu$/.test(fileType)) {
|
||||
if (format===undefined) {
|
||||
this._saveAsFormat(undefined, format, ext); // download original
|
||||
menu && menu.hide();
|
||||
} else if (format == Asc.c_oAscFileType.PDF || format == Asc.c_oAscFileType.PDFA)
|
||||
this._saveAsFormat(menu, format, ext);
|
||||
else {
|
||||
(new Common.Views.OptionsDialog({
|
||||
width: 300,
|
||||
|
|
|
@ -1463,9 +1463,9 @@ define([
|
|||
this.appOptions.canChat = false;
|
||||
}
|
||||
|
||||
var type = /^(?:(djvu))$/.exec(this.document.fileType);
|
||||
this.appOptions.canDownloadOrigin = this.permissions.download !== false && (type && typeof type[1] === 'string');
|
||||
this.appOptions.canDownload = this.permissions.download !== false && (!type || typeof type[1] !== 'string');
|
||||
// var type = /^(?:(djvu))$/.exec(this.document.fileType);
|
||||
this.appOptions.canDownloadOrigin = false;
|
||||
this.appOptions.canDownload = this.permissions.download !== false;
|
||||
this.appOptions.canUseSelectHandTools = this.appOptions.canUseThumbnails = this.appOptions.canUseViwerNavigation = isPDFViewer;
|
||||
this.appOptions.canDownloadForms = this.appOptions.canLicense && this.appOptions.canDownload;
|
||||
|
||||
|
|
|
@ -98,12 +98,20 @@ define([
|
|||
},
|
||||
|
||||
render: function() {
|
||||
if (/^pdf|xps|oxps$/.test(this.fileType)) {
|
||||
if (/^pdf$/.test(this.fileType)) {
|
||||
this.formats[0].splice(1, 1); // remove pdf
|
||||
this.formats[1].splice(1, 1); // remove pdfa
|
||||
this.formats[3].push({name: 'Original', imgCls: 'pdf', type: ''});
|
||||
this.formats[3].push({name: 'PDF', imgCls: 'pdf', type: ''}); // original pdf
|
||||
} else if (/^xps|oxps$/.test(this.fileType)) {
|
||||
this.formats[3].push({name: this.fileType.toUpperCase(), imgCls: this.fileType, type: ''}); // original xps/oxps
|
||||
} else if (/^djvu$/.test(this.fileType)) {
|
||||
this.formats = [[
|
||||
{name: 'DJVU', imgCls: 'djvu', type: ''}, // original djvu
|
||||
{name: 'PDF', imgCls: 'pdf', type: Asc.c_oAscFileType.PDF}
|
||||
]];
|
||||
}
|
||||
if (this.mode && !this.mode.canFeatureForms) {
|
||||
|
||||
if (this.mode && !this.mode.canFeatureForms && this.formats.length>2) {
|
||||
this.formats[2].splice(1, 2);
|
||||
this.formats[2] = this.formats[2].concat(this.formats[3]);
|
||||
this.formats[3] = undefined;
|
||||
|
@ -186,12 +194,20 @@ define([
|
|||
},
|
||||
|
||||
render: function() {
|
||||
if (/^pdf|xps|oxps$/.test(this.fileType)) {
|
||||
if (/^pdf$/.test(this.fileType)) {
|
||||
this.formats[0].splice(1, 1); // remove pdf
|
||||
this.formats[1].splice(1, 1); // remove pdfa
|
||||
this.formats[3].push({name: 'Original', imgCls: 'pdf', type: '', ext: true});
|
||||
this.formats[3].push({name: 'PDF', imgCls: 'pdf', type: '', ext: true}); // original pdf
|
||||
} else if (/^xps|oxps$/.test(this.fileType)) {
|
||||
this.formats[3].push({name: this.fileType.toUpperCase(), imgCls: this.fileType, type: '', ext: true}); // original xps/oxps
|
||||
} else if (/^djvu$/.test(this.fileType)) {
|
||||
this.formats = [[
|
||||
{name: 'DJVU', imgCls: 'djvu', type: '', ext: true}, // original djvu
|
||||
{name: 'PDF', imgCls: 'pdf', type: Asc.c_oAscFileType.PDF, ext: '.pdf'}
|
||||
]];
|
||||
}
|
||||
if (this.mode && !this.mode.canFeatureForms) {
|
||||
|
||||
if (this.mode && !this.mode.canFeatureForms && this.formats.length>2) {
|
||||
this.formats[2].splice(1, 2);
|
||||
this.formats[2] = this.formats[2].concat(this.formats[3]);
|
||||
this.formats[3] = undefined;
|
||||
|
|
|
@ -324,6 +324,9 @@
|
|||
<img class="inline-svg" src="../../common/main/resources/img/doc-formats/docm.svg">
|
||||
<img class="inline-svg" src="../../common/main/resources/img/doc-formats/oform.svg">
|
||||
<img class="inline-svg" src="../../common/main/resources/img/doc-formats/docxf.svg">
|
||||
<img class="inline-svg" src="../../common/main/resources/img/doc-formats/djvu.svg">
|
||||
<img class="inline-svg" src="../../common/main/resources/img/doc-formats/xps.svg">
|
||||
<img class="inline-svg" src="../../common/main/resources/img/doc-formats/oxps.svg">
|
||||
<img class="inline-svg" src="resources/img/blank.svg">
|
||||
<img class="inline-svg" src="resources/img/recent-file.svg">
|
||||
<img class="inline-svg" src="resources/img/file-template.svg">
|
||||
|
|
|
@ -313,6 +313,9 @@
|
|||
<inline src="resources/img/doc-formats/docm.svg" />
|
||||
<inline src="resources/img/doc-formats/oform.svg" />
|
||||
<inline src="resources/img/doc-formats/docxf.svg" />
|
||||
<inline src="resources/img/doc-formats/djvu.svg" />
|
||||
<inline src="resources/img/doc-formats/xps.svg" />
|
||||
<inline src="resources/img/doc-formats/oxps.svg" />
|
||||
<inline src="resources/img/toolbar/shapetypes.svg" />
|
||||
<inline src="resources/img/toolbar/charttypes.svg" />
|
||||
<inline src="resources/img/recent-file.svg" />
|
||||
|
|
|
@ -285,6 +285,9 @@
|
|||
<img class="inline-svg" src="../../common/main/resources/img/doc-formats/docm.svg">
|
||||
<img class="inline-svg" src="../../common/main/resources/img/doc-formats/oform.svg">
|
||||
<img class="inline-svg" src="../../common/main/resources/img/doc-formats/docxf.svg">
|
||||
<img class="inline-svg" src="../../common/main/resources/img/doc-formats/djvu.svg">
|
||||
<img class="inline-svg" src="../../common/main/resources/img/doc-formats/xps.svg">
|
||||
<img class="inline-svg" src="../../common/main/resources/img/doc-formats/oxps.svg">
|
||||
<img class="inline-svg" src="resources/img/blank.svg">
|
||||
<img class="inline-svg" src="resources/img/recent-file.svg">
|
||||
<img class="inline-svg" src="resources/img/file-template.svg">
|
||||
|
|
|
@ -332,6 +332,9 @@
|
|||
<inline src="resources/img/doc-formats/docm.svg" />
|
||||
<inline src="resources/img/doc-formats/oform.svg" />
|
||||
<inline src="resources/img/doc-formats/docxf.svg" />
|
||||
<inline src="resources/img/doc-formats/djvu.svg" />
|
||||
<inline src="resources/img/doc-formats/xps.svg" />
|
||||
<inline src="resources/img/doc-formats/oxps.svg" />
|
||||
<inline src="resources/img/toolbar/shapetypes.svg" />
|
||||
<inline src="resources/img/toolbar/charttypes.svg" />
|
||||
<inline src="resources/img/recent-file.svg" />
|
||||
|
|
Loading…
Reference in a new issue