Hi Team,
We have implemented the check to find the transparent images and flatten them in the PDF. But there is no any feature to Flatten the image in the PDF. As per the intellisense we are only getting the option to delete the image.
I’m providing the below code I’m using to check and correct the transparent images.
Document pdfDocument = new Document((inputStream));
for (int i = 1; i < pageCount + 1; i++)
{
if (pdfDocument.Pages[i].Resources.Images.Count > 0)
{
for (int j = 1; j < pdfDocument.Pages[i].Resources.Images.Count + 1; j++)
{
XImage xImage = pdfDocument.Pages[i].Resources.Images[j];
if (xImage.ContainsTransparency)
{
// Here I’ve to flatten the image in the PDF
pdfDocument.Pages[i].Resources.Images.Delete(j);
}
}
}
}
Also please let us know if there is any other option to do this task.
Regards,
Ishan Adarsh
Hi Ishan,
Hi Team,
Thanks for your quick response. Your proposed solution is not working in our scenario.
Basically we have to correct all the transparent images in the PDF that can be in any form e.g. watermark too. If we would save the image and replace it would change the opacity and also the style of the watermark.
I need assistance how we can correct the transparent images in the PDF and flatten them in the PDF without effecting the PDF style.
Also I’m attaching the sample PDF which we are using for our testing purpose.
Regards,
Ishan Adarsh
Hi Ishan,
Hi Team,
Thanks for your reply. I implemented your solution for fixing up the transparency issue in PDF which goes like this :
1. Extract the images from the PDF using Aspose Imaging.
2. Replace the transparent images by removing the transparency from the extracted image.
The above didn’t resolved my issue as in the output file the images totally differs when compared to the actual input file. Also for cross testing I used Adobe PRO for removing the transparency and the output was totally different compared to what Aspose generated for us.
I am attaching all the three files for your reference.
1. pdf with Transparent image.pdf
2. File Generated Through Aspose.pdf
3. Transparent image ADOBE fixup.pdf
Please Help,
Regards,
Ishan Adarsh
Hi Ishan,
Hi Team,
Thanks for your response and logging this new feature in APOSE. We have already initiated the purchase of ASPOSE Tool from our side (Company Mercer). I need a confirmation till when this feature would be available in ASPOSE. This is the second feature I’ve requested for. First was a bug that is “Converting PDF to PDF/A Standards”. The requirement document is already signed and purchase is in progress. If in case these features are not supported by your tool I would be in a big trouble. Please confirm a TAT for the availability of the feature, so that I can assure the management who are responsible to the purchase of the tool.
Regards,
Ishan Adarsh
Hi Ishan,
The issues you have found earlier (filed as PDFNET-40875) have been fixed in Aspose.PDF for .NET 24.8.