RE: rendering Image file(png/bmp) on AFP file

2016-08-17 Thread Rajkumar Singh
Hi ,

Can you provide me a sample for the same.

 

Thanks

 

From: Simon Steiner [mailto:simonsteiner1...@gmail.com] 
Sent: Wednesday, August 17, 2016 5:48 PM
To: fop-dev@xmlgraphics.apache.org
Subject: RE: rendering Image file(png/bmp) on AFP file

 

Hi,

 

Why are you using such a low level api, try using fo or IF or even calling
AFPPainter.

 

Thanks

 

From: Rajkumar Singh [mailto:rajkumar_si...@newgen.co.in] 
Sent: 17 August 2016 13:11
To: fop-dev@xmlgraphics.apache.org
Subject: RE: rendering Image file(png/bmp) on AFP file

 

Hi,

Can you help me to provide a sample for adding image in AFP file.

I am trying with IMImageObject

And my sample code is 

 

   

IMImageObject io = new IMImageObject(imagePath);

 ImageOutputControl ioc = new ImageOutputControl(0, 0);

 ImageInputDescriptor iid = new ImageInputDescriptor();

 ImageCellPosition icp = new ImageCellPosition(5, 5);

 icp.setXFillSize(20);

 icp.setYFillSize(20);

 icp.setXSize(64);

 icp.setYSize(8);

 float shade = (float) ((5 * 0.3) + (5 * 0.59) + (5 *
0.11));

 

 int greyscale = Math.round((shade / 255) * 16);

 

   

 ImageRasterData ird = new
ImageRasterData(ImageRasterPattern

.getRasterData(greyscale));

 

 io.setImageOutputControl(ioc);

 io.setImageInputDescriptor(iid);

 io.setImageCellPosition(icp);

io.setImageRasterData(ird);

page.addObject(io);

but still not able to add image.

Please provide me sample for the same.

 

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:

 

   




?

 

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. 


 


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.


RE: rendering Image file(png/bmp) on AFP file

2016-08-17 Thread Simon Steiner
Hi,

 

Why are you using such a low level api, try using fo or IF or even calling
AFPPainter.

 

Thanks

 

From: Rajkumar Singh [mailto:rajkumar_si...@newgen.co.in] 
Sent: 17 August 2016 13:11
To: fop-dev@xmlgraphics.apache.org
Subject: RE: rendering Image file(png/bmp) on AFP file

 

Hi,

Can you help me to provide a sample for adding image in AFP file.

I am trying with IMImageObject

And my sample code is 

 

   

IMImageObject io = new IMImageObject(imagePath);

 ImageOutputControl ioc = new ImageOutputControl(0, 0);

 ImageInputDescriptor iid = new ImageInputDescriptor();

 ImageCellPosition icp = new ImageCellPosition(5, 5);

 icp.setXFillSize(20);

 icp.setYFillSize(20);

 icp.setXSize(64);

 icp.setYSize(8);

 float shade = (float) ((5 * 0.3) + (5 * 0.59) + (5 *
0.11));

 

 int greyscale = Math.round((shade / 255) * 16);

 

   

 ImageRasterData ird = new
ImageRasterData(ImageRasterPattern

.getRasterData(greyscale));

 

 io.setImageOutputControl(ioc);

 io.setImageInputDescriptor(iid);

 io.setImageCellPosition(icp);

io.setImageRasterData(ird);

page.addObject(io);

but still not able to add image.

Please provide me sample for the same.

 

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:

 

   




?

 

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. 


 



RE: rendering Image file(png/bmp) on AFP file

2016-08-17 Thread Rajkumar Singh
Hi,

Can you help me to provide a sample for adding image in AFP file.

I am trying with IMImageObject

And my sample code is 

 

   

IMImageObject io = new IMImageObject(imagePath);

 ImageOutputControl ioc = new ImageOutputControl(0, 0);

 ImageInputDescriptor iid = new ImageInputDescriptor();

 ImageCellPosition icp = new ImageCellPosition(5, 5);

 icp.setXFillSize(20);

 icp.setYFillSize(20);

 icp.setXSize(64);

 icp.setYSize(8);

 float shade = (float) ((5 * 0.3) + (5 * 0.59) + (5 *
0.11));

 

 int greyscale = Math.round((shade / 255) * 16);

 

   

 ImageRasterData ird = new
ImageRasterData(ImageRasterPattern

.getRasterData(greyscale));

 

 io.setImageOutputControl(ioc);

 io.setImageInputDescriptor(iid);

 io.setImageCellPosition(icp);

io.setImageRasterData(ird);

page.addObject(io);

but still not able to add image.

Please provide me sample for the same.

 

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:

 

   




?

 

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.


RE: rendering Image file(png/bmp) on AFP file

2016-08-17 Thread Rajkumar Singh
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:

 

   




?

 

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.


SampleAFP.java
Description: Binary data