"The PDF was authored so that it can be opened in Adobe Reader, fields in the form can be filled, and the form can be saved by Reader to the file system."

I feel like I'm missing something. You've got a PDF that appears to have at least PdfWriter.ALLOW_FILL_IN. If the form has that permission (retrieved from PdfReader.getPermissions()) then your code should allow you to fill in the form. If it has other permissions too then just set the output PDF with the result of PdfReader.getPermissions() using the PdfEncryptor. Something on the order of:

PdfReader reader = new PdfReader( "input.pdf" );
int pdfPermissions = reader.getPermissions();
if( !(pdfPermissions & PdfWriter.ALLOW_FILL_IN))
// throw exception? exit? either way, don't allow the form to be filled

//
// modify the pdf contents as needed
//
PdfEncryptor.encrypt( reader,
                             new FileOutputStream( "output.pdf"),
                             null, null,    // no user name and password
                             pdfPermissions,
                             true);

I apologize if I've missed something but it seems that, based on your original question, this is what you wanted.



Leonard Rosenthol wrote:
Nope and nope :(.

Leonard

On Dec 3, 2007, at 9:33 AM, Samuel B. Quiring wrote:

Leonard,
Is there any documentation anywhere on this? Do you know of an example iText program that I could look at? -Sam

    ----- Original Message -----
    *From:* Leonard Rosenthol <mailto:[EMAIL PROTECTED]>
    *To:* Post all your questions about iText here
    <mailto:itext-questions@lists.sourceforge.net>
    *Sent:* Monday, December 03, 2007 4:20 AM
    *Subject:* Re: [iText-questions] How to change a PDF but preserve
    the rights

    It _IS_ possible to fill in a PDF that has been "Reader Enabled"
    w/o violating the rights - but it MUST be done in a very specific
    fashion using "append mode" on the source PDF AND only modifying
    a limited number of objects in the PDF.

    So yes, if you are going to create a whole new PDF - you'll break
    the "Reader Enabling".  If you're careful about what you do, and
    how you do it, you CAN accomplish your goal.

    Leonard


    On Dec 3, 2007, at 2:05 AM, Samuel B. Quiring wrote:

I have a PDF containing an XFA form; isXfaPresent() == true. The PDF was authored so that it can be opened in Adobe Reader,
    fields in the form can be filled, and the form can be saved by
    Reader to the file system.
Using iText I have read in the PDF, obtained the XfaForm,
    changed values in the XML Document, and written a new PDF to the
    file system.
The PDF I write out contains the values I put into the XML, but
    the rights to save the PDF from Reader have been lost.  Is this
    expected?  Other features of the original PDF are also lost in
    the newly-written PDF.
I wrote the changed PDF to a new file. If this is the reason
    the save rights were lost, is there a way I can modify the
    existing PDF in place so that the rights to save the file from
    Adobe Reader are maintained?
-Sam
    -------------------------------------------------------------------------
    SF.Net email is sponsored by: The Future of Linux Business White
    Paper
    from Novell.  From the desktop to the data center, Linux is going
    mainstream.  Let it simplify your IT future.
    
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4_______________________________________________
    iText-questions mailing list
    iText-questions@lists.sourceforge.net
    <mailto:iText-questions@lists.sourceforge.net>
    https://lists.sourceforge.net/lists/listinfo/itext-questions
    Buy the iText book: http://itext.ugent.be/itext-in-action/


    ------------------------------------------------------------------------

    -------------------------------------------------------------------------
    SF.Net email is sponsored by: The Future of Linux Business White
    Paper
    from Novell.  From the desktop to the data center, Linux is going
    mainstream.  Let it simplify your IT future.
    http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4

    ------------------------------------------------------------------------

    _______________________________________________
    iText-questions mailing list
    iText-questions@lists.sourceforge.net
    <mailto:iText-questions@lists.sourceforge.net>
    https://lists.sourceforge.net/lists/listinfo/itext-questions
    Buy the iText book: http://itext.ugent.be/itext-in-action/

-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net <mailto:iText-questions@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

------------------------------------------------------------------------

-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
------------------------------------------------------------------------

_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell.  From the desktop to the data center, Linux is going
mainstream.  Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

Reply via email to