Thanks a lot, Tilman. I'll have a go. Cheers,
Adriaan On 15 July 2014 22:07, Tilman Hausherr <[email protected]> wrote: > It should be possible... You need to create a dictionary the hard way, > with everything, and don't forget the function. It starts like this: > > COSDictionary dict = new COSDictionary(); > > then you set the elements. It should not be too difficult, if you KNOW > what an axial shading is. Here's a segment in postscript: > > << > /ShadingType 2 > /ColorSpace [ /DeviceRGB ] > /Coords [100 400 400 600 ] > /Function << > /FunctionType 2 > /Domain [ 0 1 ] > /C0 [ 1 0 0 ] > /C1 [ .5 1 .5 ] > /N 1 > >> > >> > > This is the same in PDF: > > 14 0 obj > << /ColorSpace /DeviceRGB > /Coords [ 100 400 400 600 ] > /Function 15 0 R > /ShadingType 2 >> > endobj > 15 0 obj > << > /C0 [ 1 0 0 ] > /C1 [ 0.5 1 0.5 ] > /Domain [ 0 1 ] > /FunctionType 2 > /N 1 >> > endobj > > > So basically you have to set all these elements, note that coords is an > array, and function is itself a dictionary again. Try it, and if it doesn't > work, post your code here. Good luck! > > Tilman > > > > > > Am 15.07.2014 20:44, schrieb Adriaan Joubert: > > Hi, >> >> I need to draw an axial gradient with PdfBox, but have not found an >> example >> of how to do this. I'm using pdfbox 1.8.6. >> >> I need to add a PDFunctionType2, but this always takes a dictionary - >> which >> suggests that this is only implemented for reading documents? >> >> I somehow need to create a PDShadingType2 so that I can initialise an >> AxialShadingPaint. >> >> Does anybody have a small example of how to draw a gradient, or give me >> any >> idea of how to proceed? >> >> Thanks, >> >> Adriaan >> >> >

