Merge pull request #5516 from Snuffleupagus/issue-5509

Fallback to the |Dummy| Pattern when we fail to parse a Shading Pattern (issue 5509)
This commit is contained in:
Yury Delendik 2014-12-05 08:21:01 -08:00
commit 37fe1d14e4
3 changed files with 33 additions and 14 deletions

View File

@ -15,7 +15,8 @@
* limitations under the License.
*/
/* globals ColorSpace, PDFFunction, Util, error, warn, info, isArray, isStream,
assert, isPDFFunction, UnsupportedManager, UNSUPPORTED_FEATURES */
assert, isPDFFunction, UnsupportedManager, UNSUPPORTED_FEATURES,
MissingDataException */
'use strict';
@ -49,19 +50,27 @@ var Pattern = (function PatternClosure() {
var dict = isStream(shading) ? shading.dict : shading;
var type = dict.get('ShadingType');
switch (type) {
case PatternType.AXIAL:
case PatternType.RADIAL:
// Both radial and axial shadings are handled by RadialAxial shading.
return new Shadings.RadialAxial(dict, matrix, xref, res);
case PatternType.FREE_FORM_MESH:
case PatternType.LATTICE_FORM_MESH:
case PatternType.COONS_PATCH_MESH:
case PatternType.TENSOR_PATCH_MESH:
return new Shadings.Mesh(shading, matrix, xref, res);
default:
UnsupportedManager.notify(UNSUPPORTED_FEATURES.shadingPattern);
return new Shadings.Dummy();
try {
switch (type) {
case PatternType.AXIAL:
case PatternType.RADIAL:
// Both radial and axial shadings are handled by RadialAxial shading.
return new Shadings.RadialAxial(dict, matrix, xref, res);
case PatternType.FREE_FORM_MESH:
case PatternType.LATTICE_FORM_MESH:
case PatternType.COONS_PATCH_MESH:
case PatternType.TENSOR_PATCH_MESH:
return new Shadings.Mesh(shading, matrix, xref, res);
default:
throw new Error('Unknown PatternType: ' + type);
}
} catch (ex) {
if (ex instanceof MissingDataException) {
throw ex;
}
UnsupportedManager.notify(UNSUPPORTED_FEATURES.shadingPattern);
warn(ex);
return new Shadings.Dummy();
}
};
return Pattern;

View File

@ -0,0 +1 @@
http://web.archive.org/web/20140908142029/http://kieranhealy.org/files/papers/data-visualization.pdf

View File

@ -499,6 +499,15 @@
"link": false,
"type": "eq"
},
{ "id": "issue5509",
"file": "pdfs/issue5509.pdf",
"md5": "1975ef8db7355b1d691bc79d0749574b",
"rounds": 1,
"link": true,
"firstPage": 1,
"lastPage": 1,
"type": "load"
},
{ "id": "txt2pdf",
"file": "pdfs/txt2pdf.pdf",
"md5": "02cefa0f5e8d96313bb05163b2f88c8c",