Hello and welcome,

If you want to render an image, the code is like this after getting the pdpage object:

BufferedImage bim = RenderUtil.convertToImage(pdPage, BufferedImage.TYPE_INT_RGB, 300);

ImageIO.write(bim, "png", new File(fname));


(Assuming you are using the 2.0 code)

And then watch the magic happen :-)

Tilman



Am 28.02.2014 14:04, schrieb Thimal Kempitiya:
Hi,
I'm Thimal Kempitiya, third year computer science and engineering
undergraduate at university of moratuwa. I'm interested in the project idea
"implement shading with Coons and tensor-product patch meshes". I have the
basic knowledge about the cubic Bézier curves", , "bilinear interpolation",
" and "Bernstein polynomials and i think can manage rest of the mathematics
needed for this project. Also I have the java knowledge to do the
implementation part.

I clone the PDFBOX repository and checked the code regarding to the shading
and I tried some examples in pdfbox cook book.

Also I tried code to work with the type 1 shading type.

         File f=new File("C:\\asy-latticeshading.pdf");
         try {
             PDDocument doc=PDDocument.load(f);
                PDPage p;
           p=(PDPage)doc.getDocumentCatalog().getAllPages().get(0);
           PDShadingType1 pdst1=new PDShadingType1(p.getCOSDictionary());
           PDRectangle pdr=p.findCropBox();
           PDGraphicsState pdg=new PDGraphicsState(pdr);
           Matrix m=pdg.getCurrentTransformationMatrix();
           Type1ShadingPaint t1sp=new Type1ShadingPaint(pdst1, m,
(int)p.findCropBox().getHeight());

But this give me error saying unknown shading type 0
java.io.IOException: Error: Unknown shading type 0

can you please tell me what I'm doing wrong here and how can i solve this.

Reply via email to