PDF getting Corrpupted when deleting Annotation

Hi,

We are using the aspose.pdf dll in our .NET code to create and delete annotations. We are able to delete annotations one by one through our program. When we try to delete annotations, we are able to delete each and every annotation. But the issue happens if the user clicks on the delete button if there are no annotations present in that PDF file; the PDF file is getting corrupted.

This is the code we are using for deleting annotations. So the issue is, contentEditor.GetStamps(1); returns a valid value even if all the annotations are deleted from the PDF file.

PdfContentEditor contentEditor = new PdfContentEditor();
Stream stream = spfile.OpenBinaryStream();

// Bind input PDF file
contentEditor.BindPdf(stream);

		// Get information of all the stamps on a particular page
StampInfo[] stampInfos = contentEditor.GetStamps(1);
foreach (StampInfo stampInfo in stampInfos)
{
    contentEditor.DeleteStampById(1, stampInfo.StampId);
        break;
        }

		// Save output PDF file
contentEditor.Save(stream);

Regards

Aravind S

Hi Aravind,

Thank you for sharing the code sample.

I checked your issue, but I am unable to reproduce the issue. Please share your template file and resultant (corrupt) PDF file to help us reproduce the issue.

Sorry for the inconvenience,

I have attached file. This file had content and it got deleted when i try to perform delete operation when no annotation was present( Note: I had added annotation and then deleted all annotation. Then again i tried to perform delete when there was no annotation. That is where the PDF content got deleted).

Also i have another clarification.

foreach(StampInfo stampInfo in stampInfos)
{
    contentEditor.DeleteStampById(1, stampInfo.StampId);
    break;
}

This stampId will be the last added stampId correct?

Hi Aravind,

Thank you for sharing the sample source code and the resultant documents, can you please share the template file (before content deletion). This will help us to figure out the issue and reply back to you soon.

We apologize for the inconvenience,

Thanks & Regards,

Hi,

i am attaching original file.

Hi Aravind,


Thanks for sharing the resource files. We are working over this query and will get back to you, shortly.

Hi Aravind,

I tested the scenario using your provided sample source code and templated PDF document and able to notice that the template PDF document contains only one image on first page, when we get stamps from first page, one stamp of image type is found. It means the image available in the PDF document, added as a stamp and after deleting the stamp from first page, the resultant PDF is visible blank because no other data is available except that image. However, I have tested this scenario with another PDF which has no stamp, the data is available as it is.

Please feel free to contact support in case you need any further assistance.

Thanks & Regards,

Hi
Aravind,


Thanks for your patience.

I have again tested the scenario in further details and I have managed to reproduce the same problem that if source PDF contains Image and does not contain any annotation, any attempt to remove the annotation will remove the contents/image from PDF document. However in case of text, the contents remain over the page. For the sake of correction, I have logged this problem as PDFNEWNET-33319 in our issue tracking system. We will further look into the details of this problem and will keep you updated on the status of correction. Please be patient and spare us little time. We apologize for your inconvenience.

Do you have any update on this? Our system is going live in another 10 days and we are using this dll for annotation

Hi Aravind,

Thanks for your patience.

Our development team is working hard to get this issue fixed but I am afraid its not yet completely resolved. However I have requested the development team to share the ETA regarding its resolution. As soon as I get required information, I will be more than happy to update you with the status of correction. Please be patient and spare us little time.

We apologize for your inconvenience.

Thanks & Regards,

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


This message was posted using Notification2Forum from Downloads module by aspose.notifier.