rohi001
November 22, 2022, 12:01pm
1
When I am converting cdr file to jpg. The paragraph in cdr automatically unwrap and get out of the image. but while converting from online platform of aspose the output is correct.
Here is my code:
CdrImage image = Image.load(inputFileName);
JpegOptions options = new JpegOptions();
VectorRasterizationOptions rasterizationOptions = (VectorRasterizationOptions) image.getDefaultOptions(new Object[]{Color.getWhite(), image.getWidth(), image.getHeight()});
rasterizationOptions.setPositioning(PositioningTypes.DefinedByDocument);
options.setVectorRasterizationOptions(rasterizationOptions);
for(int i = 1; i<((IMultipageImage)image).getPageCount(); i++) {
options.setMultiPageOptions(new MultiPageOptions(new IntRange(i, 1))); //initial pages
image.save("C:\\Users\\admin\\Desktop\\cdr\\02-Adimission form " + i + ".jpg", options);
}
Here is the output from code: 02-Adimission form 1.jpg (101.1 KB)
Here is the output from aspose online : 02-Adimission form.cdr_p2.jpg (129.2 KB)
Here is the Input File : 02-Adimission form.cdr - Google Drive
Kindly look at text carefully to find the difference (error)
@rohi001 , you can use next code that produces file as expected result1.jpg (131.8 KB)
using (CdrImage image = (CdrImage)Image.Load(path))
{
VectorRasterizationOptions rasterizationOptions = new CdrRasterizationOptions();
rasterizationOptions.PageWidth = image.Width;
rasterizationOptions.PageHeight = image.Height;
JpegOptions exportOptions = new JpegOptions();
exportOptions.VectorRasterizationOptions = rasterizationOptions;
//exportOptions.MultiPageOptions = new MultiPageOptions(new IntRange(0, image.Pages.Length));
for (int i = 0; i < image.Pages.Length; i++)
{
image.Pages[i].Save($@"c:\Users\USER\Downloads\result{i}.jpg", exportOptions);
}
}
rohi001
November 23, 2022, 8:02am
3
the Output is same again:
I am using java programming language and Here is the code:
try (CdrImage image = (com.aspose.imaging.fileformats.cdr.CdrImage)Image.load(inputFileName))
{
VectorRasterizationOptions rasterizationOptions = new CdrRasterizationOptions();
rasterizationOptions.setPageWidth(image.getWidthF());
rasterizationOptions.setPageHeight(image.getHeightF());
JpegOptions exportOptions = new JpegOptions();
exportOptions.setVectorRasterizationOptions(rasterizationOptions);
for(Image im : image.getPages()) {
im.save("C:\\Users\\admin\\Desktop\\cdr\\02-Adimission form" + ".jpg", exportOptions);
}
}
Output File : 02-Adimission form 1.jpg (101.1 KB)
@rohi001
Hello! Please, let me know the version of Aspose.Imaging that you use. Last version of Aspose.Imaging for Java produces correct output.
rohi001
November 23, 2022, 9:39am
5
I am using aspose.imaging 22.3 jdk16
Thats it. There was a such error in Aspose.Imaging 22.3. You need to use the last version.
rohi001
November 24, 2022, 5:11am
7
Yes You’re right it’s working fine in version 22.4 also.
But, Actually I have the license valid till 21 March 2022.
So, it will be so kind of you if you can provide a solution on aspose.imaging 22.3.
or
Something else that can solve the problem.
@rohi001 , unfortunately we ca not apply patches for previous releases of Aspose.Imaging. The only solution is to use versions 22.4 and higher that support work with paragraphs in cdr.