Free Support Forum - aspose.com

Blank pages after privilege setting to pdf

Hey,
Our customers experiencing odd behavior when trying to set privileges to a PDF which was created with GPL GhostScript lib.
The thing is that after the process ends they get a PDF with blank pages.
We use Aspose.Pdf 5.2.1.0 and Aspose.Pdf.Kit 5.6.0.0. At this point we cannot upgrade to a newer Aspose version.
I would appreciate it if upon successful reproduce of the bug you would try to find a solution which does not involving upgrade.

Attached is a GPL GhostScript lib Pdf file that was found on the web, for reproducing purposes.

Thanks

Hi,


I have tested the scenario while using following code snippet with Aspose.Pdf.Kit for .NET 5.6.0 and I am unable to notice any issue in resultant PDF file. Can you please share the code snippet which you are currently using. We are sorry for your inconvenience.

Hey,


Thank you for the quick reply.
I forgot to wrote that we also creating PdfFileStamp as follows
create a PdfFileStamp
create a PdfFileInfo object to get the page count.
create FormattedText
create Stamp
call Stamp.BindLogo(FormattedText)
call PdfFileStamp.addStamp(Stamp)

That’s about it, hope it will help reproducing the problem.

Thanks

Hi,


Thanks for sharing the details.

I have again tested the scenario using following code snippet and I am unable to notice any problem. I have tested the issue over Windows 7 (X64) Enterprise in VisualStudio 2010 Professional (where target platform of application is set to .NET Framework4.0). For your reference, I have also attached the resultant PDF file which is being generated over my end.

Can you please share the sample project which you are using ? We are really sorry for this inconvenience.

[C#]

//open document<o:p></o:p>

Aspose.Pdf.Kit.PdfFileStamp fileStamp = new Aspose.Pdf.Kit.PdfFileStamp("d:/OWASP_Testing_Guide_v3.pdf", "d:/ OWASP_Testing_Guide_v3_output.pdf");

//create stamp

Aspose.Pdf.Kit.Stamp stamp = new Aspose.Pdf.Kit.Stamp();

stamp.BindLogo(new Aspose.Pdf.Kit.FormattedText("Hello World!", System.Drawing.Color.Blue, System.Drawing.Color.Transparent, Aspose.Pdf.Kit.FontStyle.Helvetica, Aspose.Pdf.Kit.EncodingType.Winansi, true, 14));

stamp.SetOrigin(200, 200);

stamp.Rotation = 90.0F;

stamp.IsBackground = true;

//add stamp to PDF file

fileStamp.AddStamp(stamp);

//save updated PDF file

fileStamp.Close();

//create DocumentPrivileges object

Aspose.Pdf.Kit.DocumentPrivilege privilege = Aspose.Pdf.Kit.DocumentPrivilege.ForbidAll;

privilege.ChangeAllowLevel = 1;

privilege.AllowPrint = true;

privilege.AllowCopy = true;

//open PDF document

Aspose.Pdf.Kit.PdfFileSecurity fileSecurity = new Aspose.Pdf.Kit.PdfFileSecurity("d:/OWASP_Testing_Guide_v3_output.pdf", "d:/ OWASP_Testing_Guide_v3_Secured.pdf");

//set document privileges

fileSecurity.SetPrivilege(privilege);