mirror of
https://github.com/UglyToad/PdfPig.git
synced 2026-03-10 00:23:29 +08:00
Do not throw if the Mask dictionary contains a ColorSpace key
This commit is contained in:
@@ -7,6 +7,24 @@
|
||||
|
||||
public class GithubIssuesTests
|
||||
{
|
||||
[Fact]
|
||||
public void Issue1054()
|
||||
{
|
||||
var path = IntegrationHelpers.GetSpecificTestDocumentPath("MOZILLA-11518-0.pdf");
|
||||
|
||||
using (var document = PdfDocument.Open(path, new ParsingOptions() { UseLenientParsing = true }))
|
||||
{
|
||||
for (int p = 1; p <= document.NumberOfPages; p++)
|
||||
{
|
||||
var page = document.GetPage(p);
|
||||
foreach (var image in page.GetImages())
|
||||
{
|
||||
Assert.NotNull(image);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Issue1050()
|
||||
{
|
||||
|
||||
Binary file not shown.
@@ -73,10 +73,16 @@
|
||||
}
|
||||
else if (dictionary.TryGet(NameToken.Mask, out StreamToken maskStream))
|
||||
{
|
||||
if (maskStream.StreamDictionary.ContainsKey(NameToken.ColorSpace))
|
||||
{
|
||||
throw new Exception("The SMask dictionary contains a 'ColorSpace'.");
|
||||
}
|
||||
/* As per Pdf Specifications:
|
||||
* "The image dictionary shall not contain a ColorSpace entry because sample values represent masking properties (1 bit per sample) rather than colours."
|
||||
*
|
||||
* TODO - We assume here lenient parsing, but we should actually get the value from parsing options. See Issue #1054
|
||||
*
|
||||
* if (maskStream.StreamDictionary.ContainsKey(NameToken.ColorSpace))
|
||||
* {
|
||||
* throw new Exception("The SMask dictionary contains a 'ColorSpace'.");
|
||||
* }
|
||||
*/
|
||||
|
||||
// Stencil masking
|
||||
XObjectContentRecord maskImageRecord = new XObjectContentRecord(XObjectType.Image,
|
||||
|
||||
Reference in New Issue
Block a user