Hi,

Very interesting problem. I did not try the solution by myself, but I
think it should work.

Why do you use PdfMemDocument::Write. The method is so simple that you
can easily create your own Write-Method which cleans the encryption
object after writing again instead of destroying the temporary
PdfWriter.

Regards,
  Dom

On Thu, Feb 16, 2012 at 10:45 PM, Palmer Zent <[email protected]> wrote:
> Hello,
>
> I'm trying to write the same PDF file twice using different Encrypt
> parameters (example: different user passwords).
> It goes like this :
>
> pdf->SetEncrypted(*encrypt1);
> pdf->Write(path1); // Creates the Encrypt object, but references it in a
> copy of the trailer, that is deleted after the write is complete
> pdf->SetEncrypted(*encrypt2);
> pdf->Write(path2); // Creates a second Encrypt object and references it in a
> new copy of the trailer, etc..
>
> When I do this, the Encrypt object that was created for the first Write also
> appears in the second file, along with the right one (but with no reference
> to it). If the file is written many times, the object is then duplicated as
> many times.
>
> Question: Is there a reason and is it necessary for the PdfWriter object to
> make a copy of the trailer in its constructors ? If it wasn't, we could
> delete the Encrypt object every time a new one is set because the reference
> would be stored in the PdfDocument Object. I actually tried changing it and
> it worked for each of my tests but I haven't tested every case and I don't
> have the necessary perspective to know if it could have broken something
> else somewhere.
>
> Thanks in advance for you answers.
>
> Regards,
>
> --
> Palmer Zent
> Sent with Sparrow
>
>
> ------------------------------------------------------------------------------
> Virtualization & Cloud Management Using Capacity Planning
> Cloud computing makes use of virtualization - but cloud computing
> also focuses on allowing computing to be delivered as a service.
> http://www.accelacomm.com/jaw/sfnl/114/51521223/
> _______________________________________________
> Podofo-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/podofo-users
>

------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Podofo-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/podofo-users

Reply via email to