CDR (Coral draw) to PDF conversion (Java)

Is it possible to convert CDR file to PDF using expose imaging library in java. As per documentation CDR file is supported & there is class as CDRImage in imaging jar but its unable to convert it.

Getting following error while processing CDR file:

class com.aspose.imaging.coreexceptions.ImageLoadException: Cannot open an image. The image file format may be not supported at the moment

@vvorld,

Can you please share source file along with generated result and sample code so that we may further investigate to help you out.

Hello @Adnan.Ahmad ,

I have tried the following code in Android(Java):

// please modify the path of file as per file location of your
//directory
public String APP_FOLDER_EXT_STORAGE = Environment.getExternalStorageDirectory().getPath() + File.separator + “testing” + File.separator;
Image im = Image.load(APP_FOLDER_EXT_STORAGE + “tiger1.cdr”);

I have also tried the the following code

CdrImage cdrImage = (CdrImage) Image.load(APP_FOLDER_EXT_STORAGE + “tiger1.cdr”) ;

Getting same error on both the occasions.

Please download the CDR from the below mentioned link:

https://drive.google.com/drive/folders/1NqZuQxRm-hNVMtUTX9Q1tj-t3OFkqf_P?usp=sharing

Let me know if require any info from my side.

Thanks & Regards,
Vaibhav

@vvorld,

I have worked with source files and created investigation ticket. A ticket with ID IMAGINGJAVA-1445 has been created in our issue tracking system for further investigate either is it possible using Aspose.Imaging. This thread has been associated with this ticket, so that you can be automatically notified as soon as this issue is resolved.

@Adnan.Ahmad

Thanks for you reply. Can you please provide me full URL of ticket created .

Regards,
Vaibhav

@vvorld,

I like to inform that you can only see status of the ticket which is attached to this thread. Please check bottom of the page you will see status of the ticket.

@Adnan.Ahmad

Status is still new any expected timeline you can provide when this issue will be resolved?

Regards,
Vaibhav

@vvorld,

I have verified from our issue tracking system and like to share that the issue is likely going to get resolved in Aspose.Imaging for Java 19.12. We request for your patience till the time the issue gets resolved.

Would be great if you can provide any estimated date by which Java 19.12 will be released?

@vvorld,

Thanks for contacting us. I like to inform that Aspose.Email 19.12 will be release by the end of December 2019.

Can we expect issue to be resolved by end of December 2019 or there is any delay?

@vvorld,

Yes, this issue has been marked as resolved in upcoming Aspose.Imaging for .NET 19.12. We will share the good news with you as soon as the product will be shared online.

Thanks for the update. Is the issue is going to be resolved for Aspose.Imaging for Java as well in version 19.12?

@vvorld,

Yes, this issue will be resolved in Aspose.Imaging 19.12 for Java as well.

The issues you have found earlier (filed as IMAGINGJAVA-1445) have been fixed in this update.

Can you please tell me what are the things we can do with CDR Files using aspose imaging for java. Am not able to find proper documentation/ sample for CDR files. Is it possible to preview CDR files & convert CDR file to PDF using aspose imaging library

@vvorld.

I suggest you to please try using following sample code on your end to serve the purpose using Aspose.Imaging for Java 19.12.

public void exportToPdf(String inputCdrFileName, String outputPdfFileName)
{
    Image image = Image.load(inputCdrFileName);
    try
    {
        PdfOptions pdfOptions = new PdfOptions();
        CdrRasterizationOptions rasterizationOptions = new CdrRasterizationOptions();
        rasterizationOptions.setTextRenderingHint(TextRenderingHint.SingleBitPerPixel);
        rasterizationOptions.setSmoothingMode(SmoothingMode.None);
        rasterizationOptions.setPositioning(PositioningTypes.DefinedByDocument);
        pdfOptions.setVectorRasterizationOptions(rasterizationOptions);
        image.save(outputPdfFileName, pdfOptions);
    }
    finally
    {
        image.close();
    }
}

Thanks @mudassir.fayyaz for sharing the code. I tried it but getting the following exception

class com.aspose.imaging.coreexceptions.ImageLoadException: Image saving failed. —> java.lang.NoClassDefFoundError: Failed resolution of: Ljava/awt/geom/Dimension2D;

Sample file link:

Sorry to say there is lot of scope of improvement in documentation & example provided on github.

I tried to PSD example but getting exception as well. I will suggest to retest examples . provided on github.

Can you please let me know is it possible to get bitmap from Image object to display in imageview in android?

@vvorld,

I have observed the issue shared by you with newly shared file. It seems to be an issue with API while loading attached file. An issue with ID IMAGINGJAVA-1520 has been created in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be notified once the issue will be fixed.

I am afraid at present the API does not support in case of Android platforms.