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. * limitations under the License.
*/ */
/* globals ColorSpace, PDFFunction, Util, error, warn, info, isArray, isStream, /* globals ColorSpace, PDFFunction, Util, error, warn, info, isArray, isStream,
assert, isPDFFunction, UnsupportedManager, UNSUPPORTED_FEATURES */ assert, isPDFFunction, UnsupportedManager, UNSUPPORTED_FEATURES,
MissingDataException */
'use strict'; 'use strict';
@ -49,19 +50,27 @@ var Pattern = (function PatternClosure() {
var dict = isStream(shading) ? shading.dict : shading; var dict = isStream(shading) ? shading.dict : shading;
var type = dict.get('ShadingType'); var type = dict.get('ShadingType');
switch (type) { try {
case PatternType.AXIAL: switch (type) {
case PatternType.RADIAL: case PatternType.AXIAL:
// Both radial and axial shadings are handled by RadialAxial shading. case PatternType.RADIAL:
return new Shadings.RadialAxial(dict, matrix, xref, res); // Both radial and axial shadings are handled by RadialAxial shading.
case PatternType.FREE_FORM_MESH: return new Shadings.RadialAxial(dict, matrix, xref, res);
case PatternType.LATTICE_FORM_MESH: case PatternType.FREE_FORM_MESH:
case PatternType.COONS_PATCH_MESH: case PatternType.LATTICE_FORM_MESH:
case PatternType.TENSOR_PATCH_MESH: case PatternType.COONS_PATCH_MESH:
return new Shadings.Mesh(shading, matrix, xref, res); case PatternType.TENSOR_PATCH_MESH:
default: return new Shadings.Mesh(shading, matrix, xref, res);
UnsupportedManager.notify(UNSUPPORTED_FEATURES.shadingPattern); default:
return new Shadings.Dummy(); 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; 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, "link": false,
"type": "eq" "type": "eq"
}, },
{ "id": "issue5509",
"file": "pdfs/issue5509.pdf",
"md5": "1975ef8db7355b1d691bc79d0749574b",
"rounds": 1,
"link": true,
"firstPage": 1,
"lastPage": 1,
"type": "load"
},
{ "id": "txt2pdf", { "id": "txt2pdf",
"file": "pdfs/txt2pdf.pdf", "file": "pdfs/txt2pdf.pdf",
"md5": "02cefa0f5e8d96313bb05163b2f88c8c", "md5": "02cefa0f5e8d96313bb05163b2f88c8c",