Example #1
0
 public PdfTextString(
     String value,
     SerializationModeEnum serializationMode
     )
     : base(value, serializationMode)
 {
 }
Example #2
0
 /**
  * <summary>Serializes the file to the specified stream.</summary>
  * <remarks>It's caller responsibility to close the stream after this method ends.</remarks>
  * <param name="stream">Target stream.</param>
  * <param name="mode">Serialization mode.</param>
  */
 public void Save(
     System.IO.Stream stream,
     SerializationModeEnum mode
     )
 {
     Save(new bytes.Stream(stream), mode);
 }
Example #3
0
 public PdfTextString(
     byte[] rawValue,
     SerializationModeEnum serializationMode
     )
     : base(rawValue, serializationMode)
 {
 }
Example #4
0
        /**
         * <summary>Serializes the file to the specified stream.</summary>
         * <remarks>It's caller responsibility to close the stream after this method ends.</remarks>
         * <param name="stream">Target stream.</param>
         * <param name="mode">Serialization mode.</param>
         */
        public void Save(
            IOutputStream stream,
            SerializationModeEnum mode
            )
        {
            var information = Document.Information;

            if (Reader == null)
            {
                information.CreationDate = DateTime.Now;
                try
                {
                    string assemblyTitle   = ((AssemblyTitleAttribute)Attribute.GetCustomAttribute(Assembly.GetExecutingAssembly(), typeof(AssemblyTitleAttribute))).Title;
                    string assemblyVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString();
                    information.Producer = assemblyTitle + " " + assemblyVersion;
                }
                catch
                { /* NOOP */ }
            }
            else
            {
                information.ModificationDate = DateTime.Now;
            }

            Writer writer = Writer.Get(this, stream);

            writer.Write(mode);
        }
 public PdfString(
     byte[] rawValue,
     SerializationModeEnum serializationMode
     )
 {
     SerializationMode = serializationMode;
     RawValue          = rawValue;
 }
 public PdfString(
     string value,
     SerializationModeEnum serializationMode
     )
 {
     SerializationMode = serializationMode;
     Value             = value;
 }
Example #7
0
 /**
  * <summary>Serializes the file to the specified file system path.</summary>
  * <param name="path">Target path.</param>
  * <param name="mode">Serialization mode.</param>
  */
 public void Save(
     string path,
     SerializationModeEnum mode
     )
 {
     using (var outputStream = new System.IO.FileStream(path, FileMode.Create, FileAccess.Write))
     { Save(new bytes.Stream(outputStream), mode); }
 }
Example #8
0
        /**
         * <summary>Serializes the file to the specified stream.</summary>
         * <remarks>It's caller responsibility to close the stream after this method ends.</remarks>
         * <param name="stream">Target stream.</param>
         * <param name="mode">Serialization mode.</param>
         */
        public void Save(
            IOutputStream stream,
            SerializationModeEnum mode
            )
        {
            Writer writer = Writer.Get(this, stream);

            writer.Write(mode);
        }
Example #9
0
        /**
         * <summary>Serializes the file to the current file-system path.</summary>
         * <param name="mode">Serialization mode.</param>
         */
        public void Save(
            SerializationModeEnum mode
            )
        {
            if (!System.IO.File.Exists(path))
            {
                throw new FileNotFoundException("No valid source path available.");
            }

            /*
             * NOTE: The document file cannot be directly overwritten as it's locked for reading by the
             * open stream; its update is therefore delayed to its disposal, when the temporary file will
             * overwrite it (see Dispose() method).
             */
            Save(TempPath, mode);
        }
Example #10
0
        /**
         * <summary>Serializes the file to the specified file system path.</summary>
         * <param name="path">Target path.</param>
         * <param name="mode">Serialization mode.</param>
         */
        public void Save(
            string path,
            SerializationModeEnum mode
            )
        {
            FileStream outputStream = new System.IO.FileStream(
                path,
                System.IO.FileMode.Create,
                System.IO.FileAccess.Write
                );

            Save(
                new bytes.Stream(outputStream),
                mode
                );
            outputStream.Flush();
            outputStream.Close();
        }
Example #11
0
        /**
         * <summary>Serializes the <see cref="File">file</see> to the <see cref="Stream">target stream</see>.</summary>
         * <param name="mode">Serialization mode.</param>
         */
        public void Write(SerializationModeEnum mode)
        {
            switch (mode)
            {
            case SerializationModeEnum.Incremental:
                if (file.Reader == null)
                {
                    goto case SerializationModeEnum.Standard;
                }

                WriteIncremental();
                break;

            case SerializationModeEnum.Standard:
                WriteStandard();
                break;

            case SerializationModeEnum.Linearized:
                WriteLinearized();
                break;
            }
        }
Example #12
0
        /**
          <summary>Serializes the file to the current file-system path.</summary>
          <param name="mode">Serialization mode.</param>
        */
        public void Save(
      SerializationModeEnum mode
      )
        {
            if(!System.IO.File.Exists(path))
            throw new FileNotFoundException("No valid source path available.");

              /*
            NOTE: The document file cannot be directly overwritten as it's locked for reading by the
            open stream; its update is therefore delayed to its disposal, when the temporary file will
            overwrite it (see Dispose() method).
              */
              Save(TempPath, mode);
        }
Example #13
0
        /**
          <summary>Serializes the file to the specified stream.</summary>
          <remarks>It's caller responsibility to close the stream after this method ends.</remarks>
          <param name="stream">Target stream.</param>
          <param name="mode">Serialization mode.</param>
        */
        public void Save(
      IOutputStream stream,
      SerializationModeEnum mode
      )
        {
            if(Reader == null)
              {
            try
            {
              string assemblyTitle = ((AssemblyTitleAttribute)Attribute.GetCustomAttribute(Assembly.GetExecutingAssembly(), typeof(AssemblyTitleAttribute))).Title;
              string assemblyVersion = Assembly.GetExecutingAssembly().GetName().Version.ToString();
              Document.Information.Producer = assemblyTitle + " " + assemblyVersion;
            }
            catch
            {/* NOOP */}
              }

              Writer writer = Writer.Get(this, stream);
              writer.Write(mode);
        }
Example #14
0
        /**
          <summary>Serializes the <see cref="File">file</see> to the <see cref="Stream">target stream</see>.</summary>
          <param name="mode">Serialization mode.</param>
         */
        public void Write(
      SerializationModeEnum mode
      )
        {
            switch(mode)
              {
            case SerializationModeEnum.Incremental:
              if(file.Reader == null)
            goto case SerializationModeEnum.Standard;

              WriteIncremental();
              break;
            case SerializationModeEnum.Standard:
              WriteStandard();
              break;
            case SerializationModeEnum.Linearized:
              WriteLinearized();
              break;
              }
        }
Example #15
0
 public PdfTextString(
     byte[] rawValue,
     SerializationModeEnum serializationMode
     ) : base(rawValue, serializationMode)
 {
 }
Example #16
0
 public PdfTextString(
     String value,
     SerializationModeEnum serializationMode
     ) : base(value, serializationMode)
 {
 }
Example #17
0
   /**
     <summary>Serializes the file to the specified file system path.</summary>
     <param name="path">Target path.</param>
     <param name="mode">Serialization mode.</param>
   */
   public void Save(
 string path,
 SerializationModeEnum mode
 )
   {
       FileStream outputStream = new System.IO.FileStream(
       path,
       System.IO.FileMode.Create,
       System.IO.FileAccess.Write
       );
         Save(
       new bytes.Stream(outputStream),
       mode
       );
         outputStream.Flush();
         outputStream.Close();
   }