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

Free Support Forum - aspose.com

Simple pdf.save saves pdf with warnings

Simple pdf.save method call saves original PDF with warnings.


jUnit test to reproduce the issue
https://github.com/martin-grofcik/aspose-test/tree/pdf-save

(see zip attachment too)

code:
https://github.com/martin-grofcik/aspose-test/blob/pdf-save/aspose-test/src/test/java/com/edorasware/one/integration/test/aspose/AsposePdfSaveTest.java#L32

the saved file is in project root directory documentSaved.pdf

Warnings:
See Capture.PNG

Regards
Martin

Hi Martin,


Thanks for your inquiry. I have tested the scenario, please note your document has user extended rights and Aspose.Pdf for Java is not preserving the rights, so you are getting the issue. We have logged a ticket PDFNEWJAVA-35096 for further investigation and resolution. We will notify you as soon as it is resolved.

However as a workaround, you may remove extend rights from PDF document as following.

InputStream docStream = new FileInputStream(myDir+" documentOriginal.pdf");<o:p></o:p>

com.aspose.pdf.Document document = new com.aspose.pdf.Document(docStream);

OutputStream pdfStream = null;

try {

pdfStream = new FileOutputStream(myDir+"documentOriginal_no_ex_rights.pdf");

PdfFileSignature sign = new PdfFileSignature();

sign.bindPdf(document);

sign.removeUsageRights();

document.save(pdfStream);

} finally {

if (pdfStream != null)

pdfStream.close();

}


We are sorry for the inconvenience caused.

Best Regards,