[]
Base class for PDF writers: GrapeCity.Documents.Pdf.Writer.PdfContentStreamWriter, PdfDocStreamWriter.
public abstract class PdfStreamWriterBase
The GcPdfDocument object content of which is written.
public readonly GcPdfDocument Doc
Gets a PdfObjID structure defining ID of PDF object currently written to the stream, used to encrypt strings. By default returns Empty.
public virtual PdfObjID CurrentObjID { get; }
Gets or sets the underlying stream.
public virtual Stream Stream { get; set; }
Adds dictionary entries, skips entries with name in propsToSkip.
public void AddDictEntries(IPdfDict entries, params PdfName[] propsToSkip)
Adds dictionary entries from specified collection, PDF dictionary should be started.
public void AddDictEntries(IPdfDict values, Func<PdfName, IPdfObject, bool> propCheckCallback)
values IPdfDictpropCheckCallback System.Func<T1, T2, TResult><PdfName, GrapeCity.Documents.Pdf.Spec.IPdfObject, bool>Adds dictionary entries except for "Length" entry.
public void AddDictEntriesSkipLength(IPdfDict ipd, Func<PdfName, IPdfObject, bool> propCheckCallback)
ipd IPdfDictpropCheckCallback System.Func<T1, T2, TResult><PdfName, GrapeCity.Documents.Pdf.Spec.IPdfObject, bool>Adds dictionary entries except for "Length", "Filter" and "DecodeParms" entries.
public void AddDictEntriesSkipStreamProps(IPdfDict ipd, Func<PdfName, IPdfObject, bool> propCheckCallback)
ipd IPdfDictpropCheckCallback System.Func<T1, T2, TResult><PdfName, GrapeCity.Documents.Pdf.Spec.IPdfObject, bool>Adds a dictionary entry with Offsets value.
public void AddDictEntry(PdfName key, Offsets value)
Adds a dictionary entry with PdfDateTime value.
public void AddDictEntry(PdfName key, PdfDateTime value)
key PdfNamevalue PdfDateTimeAdds a dictionary entry with value representing GrapeCity.Documents.Pdf.Spec.IPdfObject, see Write(IPdfObject).
public abstract void AddDictEntry(PdfName key, IPdfObject value)
key PdfNamevalue GrapeCity.Documents.Pdf.Spec.IPdfObjectAdds a dictionary entry with bool value.
public void AddDictEntry(PdfName key, bool value, bool defValue)
key PdfNamevalue booldefValue boolAdds a dictionary entry with PDF bool value.
public void AddDictEntry(PdfName key, bool value)
key PdfNamevalue boolAdds a dictionary entry with array of points.
convertMethod is called for each item in value.
public void AddDictEntry(PdfName key, IList<PointF> value, Func<PointF, PointF> convertMethod)
key PdfNamevalue System.Collections.Generic.IList<T><System.Drawing.PointF>convertMethod System.Func<T, TResult><System.Drawing.PointF, System.Drawing.PointF>Adds a dictionary entry with integer array value.
public void AddDictEntry(PdfName key, IList<int> value, IList<int> defValue = null)
key PdfNamevalue System.Collections.Generic.IList<T><int>defValue System.Collections.Generic.IList<T><int>Adds a dictionary entry with float array value.
public void AddDictEntry(PdfName key, IList<float> value, IList<float> defValue = null)
key PdfNamevalue System.Collections.Generic.IList<T><float>defValue System.Collections.Generic.IList<T><float>Adds a dictionary entry with double value.
public void AddDictEntry(PdfName key, double value)
key PdfNamevalue doubleAdds a dictionary entry with System.Drawing.Color value.
public void AddDictEntry(PdfName key, Color value)
key PdfNamevalue System.Drawing.ColorAdds a dictionary entry with System.Drawing.RectangleF value.
public void AddDictEntry(PdfName key, RectangleF value)
key PdfNamevalue System.Drawing.RectangleFAdds a dictionary entry with integer value.
public void AddDictEntry(PdfName key, int value, int defValue)
key PdfNamevalue intdefValue intAdds a dictionary entry with integer value.
public void AddDictEntry(PdfName key, int value)
key PdfNamevalue intAdds a dictionary entry with integer value.
public void AddDictEntry(PdfName key, long value)
key PdfNamevalue longAdds a dictionary entry with nullable Offsets value.
public void AddDictEntry(PdfName key, Offsets? value)
Adds a dictionary entry with nullable PdfDateTime value.
public void AddDictEntry(PdfName key, PdfDateTime? value)
key PdfNamevalue PdfDateTime?Adds a dictionary entry with nullable bool value.
public void AddDictEntry(PdfName key, bool? value)
key PdfNamevalue bool?Adds a dictionary entry with nullable System.Drawing.RectangleF value.
public void AddDictEntry(PdfName key, RectangleF? value, RectangleF defValue)
key PdfNamevalue System.Drawing.RectangleF?defValue System.Drawing.RectangleFAdds a dictionary entry with nullable System.Drawing.RectangleF value.
public void AddDictEntry(PdfName key, RectangleF? value)
key PdfNamevalue System.Drawing.RectangleF?Adds a dictionary entry with nullable integer value.
public void AddDictEntry(PdfName key, int? value)
key PdfNamevalue int?Adds a dictionary entry with nullable float value.
public void AddDictEntry(PdfName key, float? value, float defValue)
key PdfNamevalue float?defValue floatAdds a dictionary entry with nullable float value.
public void AddDictEntry(PdfName key, float? value)
key PdfNamevalue float?Adds a dictionary entry with System.Numerics.Matrix3x2 value.
public void AddDictEntry(PdfName key, Matrix3x2 value)
key PdfNamevalue System.Numerics.Matrix3x2Adds a dictionary entry with float value.
public void AddDictEntry(PdfName key, float value)
key PdfNamevalue floatAdds a dictionary entry with line style value.
public void AddDictEntry(PdfName key, float[] dashPattern, float dashPhase)
key PdfNamedashPattern float[]dashPhase floatAdds a dictionary entry with PdfEnum<TEnum> value.
public void AddDictEntry<TEnum>(PdfName key, PdfEnum<TEnum> value) where TEnum : struct
TEnumAdds a dictionary entry with PDF name value, the PDF name obtained as value.ToString().
public void AddDictEntry<T>(PdfName key, T? value, T defValue) where T : struct
key PdfNamevalue T?defValue TTAdds a dictionary entry with nullable PdfEnum<TEnum> value.
public void AddDictEntry<TEnum>(PdfName key, PdfEnum<TEnum>? value) where TEnum : struct
TEnumAdds a dictionary entry with PDF array value, does nothing if value is null, writes empty PDF array if value has no items.
public void AddDictEntryArray(PdfName key, params IPdfObject[] value)
key PdfNamevalue GrapeCity.Documents.Pdf.Spec.IPdfObject[]Adds a dictionary entry with PDF string value written as HEX string: <F1A0>
public void AddDictEntryHexString(PdfName key, IList<byte> value)
key PdfNamevalue System.Collections.Generic.IList<T><byte>Adds a dictionary entry with PDF name value, the entry is added only if value
is not null and not empty.
public void AddDictEntryName(PdfName key, string value)
key PdfNamevalue stringAdds a dictionary entry with PDF name array.
public void AddDictEntryNameArray(PdfName key, params string[] value)
key PdfNamevalue string[]Adds a dictionary entry with PDF name array.
public void AddDictEntryNames(PdfName key, string[] value, string[] defValue = null)
key PdfNamevalue string[]defValue string[]Adds a dictionary entry with PDF reference.
public void AddDictEntryObjRef(PdfName key, PdfObjID objID)
Adds a dictionary entry with PDF reference.
public void AddDictEntryObjRef(PdfName key, int objID)
key PdfNameobjID intAdds a dictionary entry with "placeholder" (spaces) the actual value should be written later, used when generating linearized PDF stream.
public void AddDictEntryPlaceHolder(PdfName key, int placeHolderLength, out long placeHolderOffset)
key PdfNameplaceHolderLength intplaceHolderOffset longAdds a dictionary entry with PDF rich string value, see PDF specification for details about Rich text in PDF.
public void AddDictEntryRichString(PdfName key, string value)
key PdfNamevalue stringAdds a dictionary entry with PDF string value. If string contains chars with code greater than 126 it encoded as unicode. The string is encrypted if an encryption specified for document.
public void AddDictEntryString(PdfName key, IList<byte> value, bool encrypt = true)
key PdfNamevalue System.Collections.Generic.IList<T><byte>encrypt boolAdds string dict entry, string is written as PDF string i.e. like (BlaBla). If string contains chars with code greater than 126 it encoded as unicode. String is encoded if encoding specified for document.
public void AddDictEntryString(PdfName key, IList<byte> value)
key PdfNamevalue System.Collections.Generic.IList<T><byte>Adds a dictionary entry with PDF string value. If string contains chars with code greater than 126 it encoded as unicode. The string is encrypted if an encryption specified for document.
public void AddDictEntryString(PdfName key, string value)
key PdfNamevalue stringAdds a dictionary entry with PDF string value. If string contains chars with code greater than 126 it encoded as unicode. The string is encrypted if an encryption specified for document.
public void AddDictEntryStringNotEmpty(PdfName key, string value)
key PdfNamevalue stringStarts a PDF array, should be enclosed with EndArray().
public void BeginArray()
Starts a PDF dictionary entry with array value, should be enclosed with EndArrayEntry().
public void BeginArrayEntry(PdfName propName)
propName PdfNameStarts a PDF dictionary, should be enclosed with EndDict().
public void BeginDict()
Starts a PDF dictionary entry with nested dictionary value, should be enclosed with EndDictEntry().
public void BeginDictEntry(PdfName propName)
propName PdfNameStarts a PDF dictionary entry, should be enclosed with EndEntry().
public void BeginEntry(PdfName propName)
propName PdfNameEnds a PDF array started with BeginArray().
public void EndArray()
Ends a PDF dictionary entry started with BeginArrayEntry(PdfName).
public void EndArrayEntry()
Ends a PDF dictionary started with BeginDict().
public void EndDict()
Ends a PDF dictionary entry started with BeginDictEntry(PdfName).
public void EndDictEntry()
Ends a PDF dictionary entry started with BeginEntry(PdfName).
public void EndEntry()
Flushes all data to the underlying stream.
public void Flush()
Converts specified float to string which can be written to PDF stream.
public static string FmtDouble(double value)
value doubleConverts specified float to string which can be written to PDF stream.
public static string FmtDouble(float value)
value floatConverts specified integer to string which can be written to PDF stream.
public static string FmtInteger(int value)
value intConverts specified long to string which can be written to PDF stream.
public static string FmtLong(long value)
value longConverts specified uint to string which can be written to PDF stream.
public static string FmtUint(uint value)
value uintFor internal use only. Gets the Position on the underlying stream.
public long GetPosition()
Sets the position within the underlying stream.
public void Seek(long offset, SeekOrigin origin)
offset longorigin System.IO.SeekOriginWrites the GrapeCity.Documents.Pdf.Spec.IPdfObject object
if value is indirect object then reference to this object will be written
otherwise GrapeCity.Documents.Pdf.Spec.IPdfObject.Write(GrapeCity.Documents.Pdf.Writer.PdfStreamWriterBase) will be
called to write value representing an object.
If value is null or GrapeCity.Documents.Pdf.Spec.IPdfObject.Empty is true
then PDF NULL value will be written.
public abstract void Write(IPdfObject value)
value GrapeCity.Documents.Pdf.Spec.IPdfObjectWrites a byte array.
public void Write(byte[] value)
value byte[]Writes a System.Drawing.PointF structure as 2 float values.
public void Write(PointF p)
p System.Drawing.PointFWrites content of specified stream.
public void Write(Stream stream)
stream System.IO.StreamWrites a System.Numerics.Matrix3x2 structure.
public void Write(Matrix3x2 value)
value System.Numerics.Matrix3x2Writes a string using ASCII encoding, each char converted to byte as (byte)s[i].
If string length is less than length the spaces will be added at right,
if string length is greater than length the string will be truncated.
public void Write(string value, int length)
value stringlength intWrites a string using ASCII encoding, each char converted to byte as (byte)s[i].
public void Write(string value)
value stringWrites a bool value.
public void WriteBool(bool value)
value boolWrites a single byte.
public void WriteByte(byte value)
value byteWrites specified count of bytes to the stream.
public void WriteBytes(byte b, int count)
b bytecount intWrites a System.Drawing.Color value as sequence of 3 numbers R, G, B. NOTE! alpha channel is NOT written.
public void WriteColor(Color value)
value System.Drawing.ColorWrites the CRLF, resets GrapeCity.Documents.Pdf.Writer.PdfStreamWriterBase.NeedDelimiter.
public void WriteCRLF()
Writes the (space) if GrapeCity.Documents.Pdf.Writer.PdfStreamWriterBase.NeedDelimiter is true, resets GrapeCity.Documents.Pdf.Writer.PdfStreamWriterBase.NeedDelimiter.
public void WriteDelim()
Writes a double value.
public void WriteDouble(double value, int decimalPlaces = -1)
value doubledecimalPlaces intWrites a nullable float value.
public void WriteFloat(float? value, int decimalPlaces = -1)
value float?decimalPlaces intWrites a float value.
public void WriteFloat(float value, int decimalPlaces = -1)
value floatdecimalPlaces intWrites a float array, writes a null if value is null.
public void WriteFloatArray(float[] value, int decimalPlaces = -1)
value float[]decimalPlaces intWrites a string as PDF HEX string, like <FF01>.
Note! String is encrypted if encrypt is true and encryption is specified for the document.
Note! If value is null or empty then empty '()' PDF string is written.
public void WriteHexString(IList<byte> value, bool encrypt = true)
value System.Collections.Generic.IList<T><byte>encrypt boolWrites an integer value.
public void WriteInt(int value)
value intWrites an integer value.
public void WriteIntValue(int value)
value intWrites a string and adds CRLF after, each char of the string converted to byte.
public void WriteLine(string s)
s stringWrites a long value.
public void WriteLong(long value)
value longWrites a long value.
public void WriteLongValue(long value)
value longWrites a PDF name value, like "/name".
public void WriteName(PdfName value)
value PdfNameWrites a byte array as PDF name value, i.e. like "/name".
public void WriteName(IList<byte> value)
value System.Collections.Generic.IList<T><byte>Writes a string as PDF name value, like "/name".
public void WriteName(string value)
value stringWrites a NULL value.
public void WriteNull()
Writes an Offsets structure as 4 float values.
public void WriteOffsets(Offsets value)
value OffsetsWrites a PdfDateTime value, the value is encoded as it defined in chapter 3.8.3 Dates of PdfSpec 1.7.
public void WritePdfDateTime(PdfDateTime value)
value PdfDateTimeWrites a placeholder to the PDF stream and returns its offset.
public void WritePlaceHolder(int placeHolderLength, out long placeHolderOffset)
placeHolderLength intplaceHolderOffset longWrites a System.Drawing.RectangleF structure as 4 float values Left, Top, Width, Height.
public void WriteRect(RectangleF value)
value System.Drawing.RectangleFWrites a System.Drawing.RectangleF structure as 4 float values Left, Top, Right, Bottom.
public void WriteRectLTRB(RectangleF value)
value System.Drawing.RectangleFWrites a PDF reference like "10 0 R".
public virtual void WriteRef(PdfObjID objID)
objID PdfObjIDWrites a PDF reference like "10 0 R".
public void WriteRef(int objID)
objID intWrites a byte array as PDF string, like "(BlaBla)".
Note! String is encrypted if encrypt is true and encryption is specified for the document.
Note! If value is null or empty then empty "()" PDF string is written.
public void WriteString(IList<byte> value, bool encrypt = true)
value System.Collections.Generic.IList<T><byte>encrypt boolWrites a string as PDF string, like "(BlaBla)".
Note! String is encrypted if encrypt is true and encryption is specified for the document.
Note! If value is null or empty then empty "()" PDF string is written.
public void WriteString(string value, bool encrypt = true)
value stringencrypt boolWrites an uint value.
public void WriteUint(uint value)
value uint