We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Bad password!: v5.5.0.0 Securing Aspose.Pdf

Hi,

We have been encountering this “Bad password!: v5.2.0.0 Securing Aspose.Pdf” error for a little while now. We were on version 5.5.0.0 of the Aspose PDF KIT but upgraded and still see this error.

The difficult thing is this error is sporatic. It doesn’t happen all the time. We see it in our load tests and some of our customers have encountered this when trying to render a PDF document that was originally generated from SSRS. It seems to occur in about 1 in every 500 rendered PDF’s and we can’t see to understand why it’s occuring. Our hope was the upgrade would resolve this but it seems to still occur. Our code is pretty simple:


Aspose.Pdf.Kit.License lic = new License();
lic.SetLicense(“Aspose.Pdf.Kit.lic”);
DocumentPrivilege privilege = DocumentPrivilege.ForbidAll;
privilege.PrintAllowLevel = 2;
privilege.CopyAllowLevel = 2;
privilege.AllowScreenReaders = true;

try
{
using (MemoryStream inStream = new MemoryStream(composite.ReportData))
{
using (MemoryStream outStream = new MemoryStream(composite.ReportData.Length))
{
PdfFileSecurity pdfFileSecurity = new PdfFileSecurity(inStream, outStream);

if (!pdfFileSecurity.SetPrivilege(privilege))
{
throw new Exception(string.Format(“Securing PDF failed: report: {0}”, path));
}

inStream.Close();
outStream.Close();
composite.ReportData = outStream.ToArray();
}
}
}
catch (Exception ex)
{
throw new Exception(string.Format("{1} Securing Aspose.Pdf, MemoryStream input length =’{0}’", composite.ReportData.Length, ex.Message), ex);
}


I think it is coming from setting the privilege as this is the location of passwords?

Any help would be appreciated. We have had some negative feedback from customers regarding this issue.

Thanks!

Hi Luiz,

Please share the sample problematic input PDF file with us, so we could investigate the issue at our end. You’ll be updated with the results accordingly.

We’re sorry for the inconvenience and looking forward to help you out.
Regards,