Spire.Presentation is a professional PowerPoint® compatible library that enables developers to create, read, write, modify, convert and Print PowerPoint documents. Get free and professional technical support for Spire.Presentation for .NET, Java, Android, C++, Python.

Wed Aug 31, 2022 4:15 pm

I try to save a presentation as a PDF, using getPdfSecurity encryption, but the pdf is not generated correctly (see pdf file)

Code: Select all
final Presentation presentation = new Presentation();
presentation.loadFromStream(new FileInputStream("presentation.pptx"), FileFormat.AUTO);
presentation.getSaveToPdfOption().getPdfSecurity().encrypt("", UUID.randomUUID().toString(), PdfPermissionsFlags.None, PdfEncryptionKeySize.Key_128_Bit);
presentation.saveToFile("test.pdf", FileFormat.PDF);



But,

If I use PdfDocument to do it it works better (could be a work around but it's not what expected !)

Code: Select all
final var output = new ByteArrayOutputStream();
final Presentation presentation = new Presentation();
presentation.loadFromStream(new FileInputStream("presentation.pptx"), FileFormat.AUTO);
presentation.getSaveToPdfOption().getPdfSecurity().encrypt("", UUID.randomUUID().toString(), PdfPermissionsFlags.None, PdfEncryptionKeySize.Key_128_Bit);
presentation.saveToFile(output, FileFormat.PDF);
final PdfDocument pdf = new PdfDocument();
 pdf.loadFromBytes(o.toByteArray());
 pdf.getSecurity().encrypt("", UUID.randomUUID().toString(), PdfPermissionsFlags.None, PdfEncryptionKeySize.Key_128_Bit);
 pdf.saveToFile("test2.pdf");

QuentinSup
 
Posts: 46
Joined: Mon Oct 18, 2021 9:18 am

Thu Sep 01, 2022 8:41 am

Hello,

Thanks for your inquiry.

I have tested your pptx and did reproduce the issue. I also tested the same code with other pptx files but still get the error when I tried to open the result PDF files. So this should be a bug in the encryption function. The specific cause is to be investigated by the development team. I have logged this issue in our bug tracking system with the ticket SPIREPPT-2057. I will notify you in time if there is any update about this issue. Apologize for the inconvenience caused.
Sincerely,
Andy
E-iceblue support team
User avatar

Andy.Zhou
 
Posts: 483
Joined: Mon Mar 29, 2021 3:03 am

Thu Oct 27, 2022 11:02 am

Hello,

Thanks for your patience!
Glad to inform you that we just released Spire.Office_7.10.4 for java which fixes the issue with SPIREPPT-2057.
Website download link: https://www.e-iceblue.com/Download/office-for-java.html

Sincerely
Abel
E-iceblue support team
User avatar

Abel.He
 
Posts: 860
Joined: Tue Mar 08, 2022 2:02 am

Return to Spire.Presentation