I don't think the higher-level APIs will let you remove a page action.

You can get the page's PdfDictionary and remove the "AA" key.

Here's an off-the-cuff code submission for PdfStamper:

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

public boolean PurgePageActions() {
    int pages = stamper.reader.getNumberOfPages();
    for (int i = 1; i <= pages; ++i) { // getPageN is 1-indexed rather than
0-indexed
        if (!PurgePageActions( i )) {
            return false;
        }
    }

    return true;
}

public boolean PurgePageActions( int pageNum ) {
    PdfDictionary pageDict = stamper.reader.getPageN( pageNum );
    // if someone calls this purgePageActions with a bad pageNum, getPageN
will return null
    if (pageDict != null) {
        return PurgePageActions( pageDict );
    }
    return false;
}

public boolean PurgePageActions( PdfDictionary pageDict ) {
    // is it really a page?
    if (pageDict == null || PdfName.PAGE.equals( ((PdfName)pageDict.get(
PdfName.TYPE ) )) {
        return false;
    }
    pageDict.remove( PdfName.AA );

    return true; // whether or not there were any actions to remove
}

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

Dennis, for your purposes, You just need access to the reader's
getNumberOfPages() and getPageN().  Kill the "AA" entry (as shown above) and
you're good to go.

--Mark Storer
Professional Geek
-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

Reply via email to