예제 #1
0
 /** Sets the open and close page additional action.
 * @param actionType the action type. It can be <CODE>PdfWriter.PAGE_OPEN</CODE>
 * or <CODE>PdfWriter.PAGE_CLOSE</CODE>
 * @param action the action to perform
 * @throws PdfException if the action type is invalid
 */
 public virtual void SetPageAction(PdfName actionType, PdfAction action)
 {
     if (!actionType.Equals(PAGE_OPEN) && !actionType.Equals(PAGE_CLOSE))
         throw new PdfException("Invalid page additional action type: " + actionType.ToString());
     pdf.SetPageAction(actionType, action);
 }
예제 #2
0
 /** Additional-actions defining the actions to be taken in
 * response to various trigger events affecting the document
 * as a whole. The actions types allowed are: <CODE>DOCUMENT_CLOSE</CODE>,
 * <CODE>WILL_SAVE</CODE>, <CODE>DID_SAVE</CODE>, <CODE>WILL_PRINT</CODE>
 * and <CODE>DID_PRINT</CODE>.
 *
 * @param actionType the action type
 * @param action the action to execute in response to the trigger
 * @throws PdfException on invalid action type
 */
 public override void SetAdditionalAction(PdfName actionType, PdfAction action)
 {
     if (!(actionType.Equals(DOCUMENT_CLOSE) ||
     actionType.Equals(WILL_SAVE) ||
     actionType.Equals(DID_SAVE) ||
     actionType.Equals(WILL_PRINT) ||
     actionType.Equals(DID_PRINT))) {
         throw new PdfException("Invalid additional action type: " + actionType.ToString());
     }
     PdfDictionary aa = reader.Catalog.GetAsDict(PdfName.AA);
     if (aa == null) {
         if (action == null)
             return;
         aa = new PdfDictionary();
         reader.Catalog.Put(PdfName.AA, aa);
     }
     MarkUsed(aa);
     if (action == null)
         aa.Remove(actionType);
     else
         aa.Put(actionType, action);
 }
예제 #3
0
 /** Additional-actions defining the actions to be taken in
 * response to various trigger events affecting the document
 * as a whole. The actions types allowed are: <CODE>DOCUMENT_CLOSE</CODE>,
 * <CODE>WILL_SAVE</CODE>, <CODE>DID_SAVE</CODE>, <CODE>WILL_PRINT</CODE>
 * and <CODE>DID_PRINT</CODE>.
 *
 * @param actionType the action type
 * @param action the action to execute in response to the trigger
 * @throws PdfException on invalid action type
 */
 public virtual void SetAdditionalAction(PdfName actionType, PdfAction action)
 {
     if (!(actionType.Equals(DOCUMENT_CLOSE) ||
     actionType.Equals(WILL_SAVE) ||
     actionType.Equals(DID_SAVE) ||
     actionType.Equals(WILL_PRINT) ||
     actionType.Equals(DID_PRINT))) {
         throw new PdfException("Invalid additional action type: " + actionType.ToString());
     }
     pdf.AddAdditionalAction(actionType, action);
 }
예제 #4
0
 /**
 * Sets the open and close page additional action.
 * @param actionType the action type. It can be <CODE>PdfWriter.PAGE_OPEN</CODE>
 * or <CODE>PdfWriter.PAGE_CLOSE</CODE>
 * @param action the action to perform
 * @param page the page where the action will be applied. The first page is 1
 * @throws PdfException if the action type is invalid
 */
 internal void SetPageAction(PdfName actionType, PdfAction action, int page)
 {
     if (!actionType.Equals(PAGE_OPEN) && !actionType.Equals(PAGE_CLOSE))
         throw new PdfException("Invalid page additional action type: " + actionType.ToString());
     PdfDictionary pg = reader.GetPageN(page);
     PdfDictionary aa = (PdfDictionary)PdfReader.GetPdfObject(pg.Get(PdfName.AA), pg);
     if (aa == null) {
         aa = new PdfDictionary();
         pg.Put(PdfName.AA, aa);
         MarkUsed(pg);
     }
     aa.Put(actionType, action);
     MarkUsed(aa);
 }