/// <summary> /// Adds the specified graphics state to this resource dictionary /// and returns its local resource name. /// </summary> public string AddExtGState(PDFExtGState extGState) { if (!_resources.TryGetValue(extGState, out string name)) { name = NextExtGStateName; _resources[extGState] = name; if (extGState.Reference == null) { Owner.IrefTable.Add(extGState); } ExtGStates.Elements[name] = extGState.Reference; } return(name); }
/// <summary> /// Gets a PDFExtGState with the key 'CA' set to the specified alpha value. /// </summary> public PDFExtGState GetExtGStateStroke(double alpha, bool overprint) { string key = PDFExtGState.MakeKey(alpha, overprint); if (!_strokeAlphaValues.TryGetValue(key, out PDFExtGState extGState)) { extGState = new PDFExtGState(Owner) { //extGState.Elements[PDFExtGState.Keys.CA] = new PDFReal(alpha); StrokeAlpha = alpha }; if (overprint) { extGState.StrokeOverprint = true; extGState.Elements.SetInteger(PDFExtGState.Keys.OPM, 1); } _strokeAlphaValues[key] = extGState; } return(extGState); }