fix colorspace error when form xobject contains a transparency group (#1088)

* fix colorspace error when form xobject contains a transparency group

when a form xobject contains a reference to a group xobject this can only
be used to change attributes of the transparency imaging model. the old
code was setting the main colorspaces incorrectly causing errors when the
transparency component had a different number of channels. this was
causing #1071 in addition to the failure in file 0000355.pdf of the test corpus

* add master integration tests for corpus group 0000

* tidy up actions

* remove invalid reference in echo

* move new action to different branch
This commit is contained in:
Eliot Jones 2025-07-19 05:46:56 -05:00 committed by GitHub
parent 31658ca020
commit e3388ec6b6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -511,21 +511,22 @@
startState.AlphaConstantNonStroking = 1.0;
startState.AlphaConstantStroking = 1.0;
// TODO: the /CS colorspace of the transparency group should not affect the main colorspace, only the transparent imaging model.
if (formGroupToken.TryGet(NameToken.Cs, PdfScanner, out NameToken? csNameToken))
{
startState.ColorSpaceContext!.SetNonStrokingColorspace(csNameToken);
// startState.ColorSpaceContext!.SetNonStrokingColorspace(csNameToken);
}
else if (formGroupToken.TryGet(NameToken.Cs, PdfScanner, out ArrayToken? csArrayToken)
&& csArrayToken.Length > 0)
{
if (csArrayToken.Data[0] is NameToken firstColorSpaceName)
{
startState.ColorSpaceContext!.SetNonStrokingColorspace(firstColorSpaceName, formGroupToken);
}
else
{
throw new InvalidOperationException("Invalid color space in Transparency Group XObjects.");
}
//if (csArrayToken.Data[0] is NameToken firstColorSpaceName)
//{
// startState.ColorSpaceContext!.SetNonStrokingColorspace(firstColorSpaceName, formGroupToken);
//}
//else
//{
// throw new InvalidOperationException("Invalid color space in Transparency Group XObjects.");
//}
}
bool isolated = false;