Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #8303 Reply

    Andreas

    Hi, is it possible to get an OutputStream to an encrypted PDF (after opening it with the correct password) in order to send it e.g. to a printer or upload it to a server? As far as I can see I can only create Bitmaps from the decrypted PDF or save it as a File, right?

    #8336 Reply

    Dr. Plug
    Moderator

    Hi Andreas,

    You can do what you want by using an ObjectOutputStream object.

    This is a sample snippet.

    • This reply was modified 1 year, 6 months ago by  Dr. Plug.
    • This reply was modified 1 year, 5 months ago by  jordi.
    • This reply was modified 1 year, 5 months ago by  jordi.
    • This reply was modified 1 year, 5 months ago by  jordi.
    • This reply was modified 1 year, 5 months ago by  jordi.
    #8558 Reply

    Andreas

    Thanks for the reply. If I understand this correctly then this is just saving the whole PDFDocument-Object as a file. I just need to save the decrypted PDF as a file – or even better, get a OutputStream to the decrypted PDF.
    I now tried to save the decrypted as a PDF using the doc.saveAsFile("decrypted_pdf.pdf") function and got the following error:

    You can't save this PDFDocument. This PDFDocument has not permission.

    What does this mean? What – beside generating Bitmaps from the decrypted PDF – can I do with the decrypted PDF anyways?

    Thanks

    #8677 Reply

    Dr. Plug
    Moderator

    Hi Andreas

    Keep in mind that there are a number of different permissions.

    On the other hand, a file must have the modification permission set in order for it to be saved.

    This permission can easily be set, however.

    Please look at the params of the getUserAccessPermissions method.

    • This reply was modified 1 year, 6 months ago by  Dr. Plug.
    • This reply was modified 1 year, 5 months ago by  jordi.
    • This reply was modified 1 year, 5 months ago by  jordi.
    #8687 Reply

    Andreas

    Unfortunately this is not working. I did the following:

    This is still throwing an exception:

    java.lang.SecurityException: You can't save this PDFDocument. This PDFDocument has not permission.

    #8772 Reply

    Dr. Plug
    Moderator

    Hi Andreas,

    We are sorry for the delay in replying.

    I found the issue you indicated: If you open the file with a user password (without permissions) the security settings can’t be changed.

    Now our SDK is throwing an exception when calling the saveAsFile method.

    We’ll fix this and then release a new PlugPDF update.

    Please wait a little.

    • This reply was modified 1 year, 6 months ago by  Dr. Plug.
    • This reply was modified 1 year, 5 months ago by  jordi.
    • This reply was modified 1 year, 5 months ago by  jordi.
    • This reply was modified 1 year, 5 months ago by  jordi.
    • This reply was modified 1 year, 5 months ago by  jordi.
    #8783 Reply

    Dr. Plug
    Moderator

    Hi Andreas,

    Our SDK has been updated!

    http://plugpdf.com/sdkfile/PlugPDF_Android.zip

    Now you can saveAsFile without any exception.

    Thank you.

Viewing 7 posts - 1 through 7 (of 7 total)
Reply To: Android: get OutputStream from encrypted PDF
Your information: