Example #1
0
 /// <summary>
 /// Sets the entry to a direct boolean value.
 /// </summary>
 public void SetBoolean(string key, bool value)
 {
   this[key] = new PdfBoolean(value);
 }
Example #2
0
 /// <summary>
 /// Writes the specified value to the PDF stream.
 /// </summary>
 public void Write(PdfBoolean value)
 {
   WriteSeparator(CharCat.Character);
   WriteRaw(value.Value ? "true" : "false");
   this.lastCat = CharCat.Character;
 }
Example #3
0
      /// <summary>
      /// Converts the specified value to boolean.
      /// If the value not exists, the function returns false.
      /// If the value is not convertible, the function throws an InvalidCastException.
      /// </summary>
      public bool GetBoolean(string key, bool create)
      {
        object obj = this[key];
        if (obj == null)
        {
          if (create)
            this[key] = new PdfBoolean();
          return false;
        }
        if (obj is PdfReference)
          obj = ((PdfReference)obj).Value;

        if (obj is PdfBoolean)
          return ((PdfBoolean)obj).Value;
        else if (obj is PdfBooleanObject)
          return ((PdfBooleanObject)obj).Value;
        throw new InvalidCastException("GetBoolean: Object is not a boolean.");
      }