fdict.setItem(COSName.C0, c0);
fdict.setItem(COSName.C1, c1);
fdict.setInt(COSName.N, 1);
PDFunctionType2 func = new PDFunctionType2(fdict);
PDShadingType2 shading = new PDShadingType2(new COSDictionary());
// shading attributes
shading.setColorSpace(PDDeviceRGB.INSTANCE);
shading.setShadingType(PDShadingType2.SHADING_TYPE2);
COSArray coords = new COSArray();
coords.add(COSInteger.get(100));
coords.add(COSInteger.get(400));
coords.add(COSInteger.get(400));
coords.add(COSInteger.get(600));
shading.setCoords(coords);
shading.setFunction(func);
// create and add to shading resources
page.setResources(new PDResources());
Map<String, PDShadingResources> shadings = new HashMap<String, PDShadingResources>();
shadings.put("sh1", (PDShadingResources) shading);