Roshnikanta Sharma

Greenhorn
+ Follow
since Dec 26, 2008
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Roshnikanta Sharma

[ UD: Please do not hijack a topic with unrelated posts. ]
[ December 30, 2008: Message edited by: Ulf Dittmer ]
15 years ago
Thank you Ulf Dittmer,
Please provide me code by rectifying the above code snippet.
I have been stuck to this issue for nearly a week.

With regards,
B Roshnikanta Sharma
15 years ago
What I have done using BATIK is as follows
---------------------------------
public static void main(String[] a)
{
String wmfPath="F:\\images\\image4.wmf";
FileOutputStream awmfPath=new FileOutputStream("F:mages\\a4.wmf");
File wmf=new File(wmfPath);
FileInputStream wmfStream=new FileInputStream(wmf);
ByteArrayOutputStream imageOut=new ByteArrayOutputStream();
byte[]buffer=new byte[1024*1024];
int noOfByteRead=0;
while((noOfByteRead=wmfStream.read())!=-1)
{
imageOut.write(noOfByteRead);
awmfPath.write(noOfByteRead);
}
imageOut.flush();
awmfPath.flush();
WMFTranscoder transcoder = new WMFTranscoder();
TranscodingHints hints=new TranscodingHints();
hints.put(WMFTranscoder.KEY_HEIGHT,2000f);
hints.put(WMFTranscoder.KEY_WIDTH,2000f);
transcoder.setTranscodingHints(hints);
TranscoderInput input = new TranscoderInput(new ByteArrayInputStream(imageOut.toByteArray()));
ByteArrayOutputStream svg = new ByteArrayOutputStream();
TranscoderOutput output = new TranscoderOutput(svg);

transcoder.transcode(input, output);
String svgFile=StringUtils.replace(wmfPath,"wmf","svg");
FileOutputStream fileOut=new FileOutputStream(svgFile);
fileOut.write(svg.toByteArray());
fileOut.flush();
// svg -> jpg
ImageTranscoder it = new JPGTranscoder();
ByteArrayOutputStream jpg = new ByteArrayOutputStream();
it.transcode(new TranscoderInput(new
ByteArrayInputStream(svg.toByteArray())), new TranscoderOutput(jpg));
String jpgFile=StringUtils.replace(wmfPath,"wmf","jpg");
FileOutputStream jpgOut=new FileOutputStream(jpgFile);
jpgOut.write(jpg.toByteArray());
jpgOut.flush();
}
-------------------------------
But the generated image is scaled up so hugely.
Did I do something wrong, PLease help me out.
And dplease suggest me some other alternatives.
Any help and suggestions would be highly appreciative.
Thanking you in advance.
15 years ago
Thank you Sir,
Please suggest me some of the jar which will be availabale as opensource project. I have tried with BATIK . Is there any other jar(api) which would serve the purpose for converting wmf(window metafile) to jpg or other image formats

--------------------

With regards,

B Roshnikanta Sharma
Thank you Sir,
Please suggest me some of the jar which will be availabale as opensource project. I have tried with BATIK . Is there any other jar(api) which would serve the purpose for converting wmf(window metafile) to jpg or other image formats
15 years ago
I have been working on openxml4j and dom4j to parse docx to html. I am using xslt to serve the prupose. I am sucessful in parsing the docx to html. but I have some issues in images files which is embedded in docx( as wmf-windows metafile) and the presentation ( displaying the same format in html as we see in docx file).
Please suggest me of some jars(api) using which I can easily convert this wmf file to jpg or png. I also treid with BATIK in which too I have some issues in scaling image. The image shoud be of exact size and resolution, no scaling needed actually.
Please help out.
Nay sort of suggestions and help will be very appreciative.