I was trying convert multi page CDR file to PSD through aspose imaging 24.12.0. CDR file contains 3 pages after conversion to PSD generated PSD has single page only i.e the first page of CDR file. CDR file can contain multiple pages but PSD file is single page format.
I have attached cdr file as zip file. Please look into the issue. placards_a (1).cdr.zip (29.3 KB)
To convert a multi-page CDR file to a PSD format using Aspose.Imaging, you need to ensure that you are handling the multi-page options correctly. By default, when you convert a multi-page CDR file, only the first page may be exported if the settings are not configured to handle multiple pages.
Here’s a step-by-step guide to ensure that all pages are included in the PSD output:
Load the CDR File: Start by loading your CDR file using the appropriate Aspose.Imaging methods.
Define PSD Conversion Options: Create an instance of PsdOptions to specify the options for the PSD format.
Handle Multi-page Options: Set the MergeLayers property to true if you want to export all pages as a single layer in the PSD file. If you want each page to be exported separately, you can set this property to false.
Set Rasterization Options: Configure rasterization options to control how the text and images are rendered in the output file.
Save the PSD File: Finally, save the converted PSD file to your desired location.
Here is a code example in C# that demonstrates this process:
using Aspose.Imaging;
using Aspose.Imaging.FileFormats.Cdr;
using Aspose.Imaging.ImageOptions;
class CdrToPsdMultipageExample
{
public static void Run()
{
string inputFileName = "path/to/your/multipage.cdr";
string outputFileName = "path/to/output/multipage.psd";
using (CdrImage image = (CdrImage)Image.Load(inputFileName))
{
PsdOptions options = new PsdOptions();
options.MultiPageOptions = new MultiPageOptions
{
MergeLayers = true // Set to true to merge all pages into one layer
};
// Set rasterization options
options.VectorRasterizationOptions = (VectorRasterizationOptions)image.GetDefaultOptions(new object[] { Color.White, image.Width, image.Height });
options.VectorRasterizationOptions.TextRenderingHint = TextRenderingHint.SingleBitPerPixel;
options.VectorRasterizationOptions.SmoothingMode = SmoothingMode.None;
// Save the PSD file
image.Save(outputFileName, options);
}
}
}
Make sure to replace "path/to/your/multipage.cdr" and "path/to/output/multipage.psd" with the actual paths to your input and output files.
By following these steps and using the provided code, you should be able to convert your multi-page CDR file into a PSD format successfully. If you continue to experience issues, please check the settings and ensure that the CDR file is being loaded correctly.
Tried the solution by using the code provide still either converted PSD file contain first page only or it contain no data only black background. Please test with the file attached in ticket.
We will review your request and give a feedback after the company holiday lasting till January 8 inclusive.
Our apologies for the inconveniences you are facing.
Hello, @vaib44
Thank you for being so interested in Aspose.Imaging.
Firstly, you should be aware that PSD itself (format restriction) can contain only 1 page with many layers, whereas CDR can contain many pages. That is why, you can see only the first page in the exported PSD.
If you need to get all pages you may use the following approach.
Or you can export each page in a separated PSD file.
string inputFileName = "D:\\Temp\\placards_a (1).cdr";
using (var image = (Aspose.Imaging.FileFormats.Cdr.CdrImage)Image.Load(inputFileName))
{
int index = 1;
foreach (Image page in image.Pages)
{
PsdOptions options = new PsdOptions();
VectorRasterizationOptions rasterizationOptions = (VectorRasterizationOptions) image.GetDefaultOptions(
new object[]{Color.White, page.Width, page.Height});
rasterizationOptions.TextRenderingHint = TextRenderingHint.SingleBitPerPixel;
rasterizationOptions.SmoothingMode = SmoothingMode.None;
options.VectorRasterizationOptions = rasterizationOptions;
page.Save(inputFileName + index + ".psd", options);
index++;
}
}
Thanks for your reply. Is it possible to merge all pages of cdr file & create a single psd file after conversion. As mentioned in earlier response can use following option to merge all pages
PsdOptions options = new PsdOptions();
options.MultiPageOptions = new MultiPageOptions
{
MergeLayers = true // Set to true to merge all pages into one layer
};
Tried above command but has no effect.
Thanks for your reply. Can you please tell me how I can identify number of pages in file . Is there is any property in Image class that return number of pages in loaded file through Image.Load function.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.