In our project, we are extracting image content from PDF file and doing some raster operation by using LeadTool and then flattening the processed image in PDF file.
Input PDf file: One page which has monochrome image
For extracting image content from PDF file, we are using below Acro Plugin API:
AVConversionConvertFromPDFWithHandler
After this, we will perform some raster operations by using LeadTool and then flattening will happen.
While doing flatten we are performing below operations in sequence:
1. Set bitspercomponent =1.
2. Create a new color table using DeviceRGB.
3. Create image by using below Acro Plugin API:
pdeimage = PDEImageCreate(&attrs, sizeof(attrs), &matrix, 0, cols1, NULL, &fil, asstm, NULL, 0);
4. Add image in PDF content.
Now flattening is successful, but monochrome(Original Image format) is changed to RGB. We want to retain the color space(DeviceGrey).
We have tried the below solution to retain the color space:
1. Using the old image's color space value for new image creation. But this gives inverted color(Black to White and vice versa)
Please help us to retain the color space while flattening.