Yes, but not "out of the box".
 
You'll need to create a PdfDictionary, and .put() the /S and /N as PdfName 
objects.  To get it to work with PdfAnnotation.setAdditionalActions you'll 
actually have to create a PdfAction and wipe its dictionary before setting the 
/S and /N:
 
PdfAction action = new PdfAction();
action.put( PdfName.S, PdfName.NAMED );
action.put( PdfName.N, new PdfName( "SaveAs" ) ); // write out the new name for 
this action.
 
You could also modify the PdfAction class to support it directly, though I 
suggest a new constructor rather than extending the current int-based one.  
It'll become unmanagable QUICKLY.  Something like:
 
public PdfAction( PdfName namedAction ) {
  put( PdfName.S, PdfName.NAMED );
  put( PdfName.N, namedAction );
}
 
// and then you could rewrite the int-based one thusly:
private static PdfName validNamedActions[] = { 
  null, PdfName.FIRSTPAGE, PdfName.PREVPAGE, PdfName.NEXTPAGE, PdfName.LASTPAGE 
};
 
public PdfAction( int named ) {
  if (named > 0 && named < validNamedActions.length) {
    this( validNamedActions[ named ] );
  } else if (named == PRINTDIALOG) {
    put( PdfName.S, PdfName.JAVASCRIPT );
    put( PdfName.JS, new PdfString( "this.print( true );" ) );
  } else {
    throw new RuntimeException( MessageLocalization.getComposedMessage( 
"invalid.named.action" ) );
  }
}
 
Or something.  ;)

--Mark Storer 
  Senior Software Engineer 
  Cardiff.com

#include <disclaimer> 
typedef std::Disclaimer<Cardiff> DisCard; 

-----Original Message-----
From: Pavol Behul [mailto:pbe...@gmail.com]
Sent: Thursday, December 10, 2009 10:21 AM
To: itext-questions@lists.sourceforge.net
Subject: Spam: [iText-questions] Acroforms SaveAs menu action


Hello,

by editing pdf via adobe acrobat pro extended i make button with SaveAs Menu 
action.
It creates object:

165 0  <mailto:itext-questions@lists.sourceforge.net> obj<< /N /SaveAs /S 
/Named>>
endobj

It is some possibility to make this menu actions by itext ?

Regards,
Pavol.


------------------------------------------------------------------------------
Return on Information:
Google Enterprise Search pays you back
Get the facts.
http://p.sf.net/sfu/google-dev2dev
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
Check the site with examples before you ask questions: 
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/

Reply via email to