Hi,

 

Thanks for response!

 

One thing I forgot to mention that I am doing it without xsl.

 

Please find attachment code to write text/image to AFP file. Write text is
successful but write image is getting failed.

Some portion of code that try to write image to AFP page as below:

 

        IMImageObject imImageObject = factory.createIMImageObject();

        ImageInputDescriptor imageInputDescriptor=new
ImageInputDescriptor();

        

        imageInputDescriptor.setResolution(50);

            imImageObject.setImageInputDescriptor(imageInputDescriptor);

            

            ImageOutputControl imageOutputControl=new ImageOutputControl(0,
0);

            imageOutputControl.setOrientation(0);

            imImageObject.setImageOutputControl(imageOutputControl);

          

            

          ImageCellPosition imageCellPosition=new
ImageCellPosition(100,100);

          imageCellPosition.setXFillSize(20);

        imageCellPosition.setYFillSize(20);

        imageCellPosition.setXSize(50);

        imageCellPosition.setYSize(50);

        imImageObject.setImageCellPosition(imageCellPosition);

        

        File imgPath = new
File("D:\\WorkSpace\\SampleAFP\\img\\newgen.jpg");

        BufferedImage bufferedImage = ImageIO.read(imgPath);

 

        // get DataBufferBytes from Raster

        WritableRaster raster = bufferedImage .getRaster();

        DataBufferByte data   = (DataBufferByte) raster.getDataBuffer();

 

        byte[] rasterData =data.getData(); 

        ImageRasterData
imageRasterData=factory.createImageRasterData(rasterData);

            imImageObject.setImageRasterData(imageRasterData);

        

          

        //defining this as a resource

         page.addObject(imImageObject);

 

 

From: Robert Meyer [mailto:rme...@hotmail.co.uk] 
Sent: Tuesday, August 16, 2016 9:07 PM
To: fop-dev@xmlgraphics.apache.org
Subject: RE: rendering Image file(png/bmp) on AFP file

 

Do you mean something like the following:

 

   <fo:block-container absolute-position="absolute" ...>
        <fo:block top="150mm" left="150mm" padding="0mm" margin="0mm">
            <fo:external-graphic src="#"/>
        </fo:block>

?

 

Best regards,

 

Robert

 

  _____  

From: rajkumar_si...@newgen.co.in
To: fop-dev@xmlgraphics.apache.org
Subject: rendering Image file(png/bmp) on AFP file
Date: Tue, 16 Aug 2016 20:15:25 +0530

Dear Sir,

 

I am developing an application using fop2.1 that create an AFP file and
write text and image at specified position in that file.

I am able to write text at specified position. But I am not getting any clue
how to do it with an image. Can you please guide for this. Thanks in
advance!

 

Regards

Rajkumar Singh

 

 


Disclaimer :- This e-mail and any attachment may contain confidential,
proprietary or legally privileged information. If you are not the original
intended recipient and have erroneously received this message, you are
prohibited from using, copying, altering or disclosing the content of this
message. Please delete it immediately and notify the sender. Newgen Software
Technologies Ltd (NSTL) accepts no responsibilities for loss or damage
arising from the use of the information transmitted by this email including
damages from virus and further acknowledges that no binding nature of the
message shall be implied or assumed unless the sender does so expressly with
due authority of NSTL. 


 


Disclaimer :- This e-mail and any attachment may contain confidential, 
proprietary or legally privileged information. If you are not the original 
intended recipient and have erroneously received this message, you are 
prohibited from using, copying, altering or disclosing the content of this 
message. Please delete it immediately and notify the sender. Newgen Software 
Technologies Ltd (NSTL)  accepts no responsibilities for loss or damage arising 
from the use of the information transmitted by this email including damages 
from virus and further acknowledges that no binding nature of the message shall 
be implied or assumed unless the sender does so expressly with due authority of 
NSTL.

Attachment: SampleAFP.java
Description: Binary data

Reply via email to