[]
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
Func<PdfName, IPdfObject, bool>Adds dictionary entries except for "Length" entry.
public void AddDictEntriesSkipLength(IPdfDict ipd, Func<PdfName, IPdfObject, bool> propCheckCallback)
ipd
IPdfDictpropCheckCallback
Func<PdfName, IPdfObject, bool>Adds dictionary entries except for "Length", "Filter" and "DecodeParms" entries.
public void AddDictEntriesSkipStreamProps(IPdfDict ipd, Func<PdfName, IPdfObject, bool> propCheckCallback)
ipd
IPdfDictpropCheckCallback
Func<PdfName, 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 IPdfObject, see Write(IPdfObject).
public abstract void AddDictEntry(PdfName key, IPdfObject value)
key
PdfNamevalue
IPdfObjectAdds a dictionary entry with PDF bool value.
public void AddDictEntry(PdfName key, bool value)
Adds a dictionary entry with bool value.
public void AddDictEntry(PdfName key, bool value, bool defValue)
Adds 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)
Adds a dictionary entry with integer array value.
public void AddDictEntry(PdfName key, IList<int> value, IList<int> defValue = null)
Adds a dictionary entry with float array value.
public void AddDictEntry(PdfName key, IList<float> value, IList<float> defValue = null)
Adds a dictionary entry with double value.
public void AddDictEntry(PdfName key, double value)
Adds a dictionary entry with Color value.
public void AddDictEntry(PdfName key, Color value)
Adds a dictionary entry with RectangleF value.
public void AddDictEntry(PdfName key, RectangleF value)
key
PdfNamevalue
RectangleFAdds a dictionary entry with integer value.
public void AddDictEntry(PdfName key, int value)
Adds a dictionary entry with integer value.
public void AddDictEntry(PdfName key, int value, int defValue)
Adds a dictionary entry with integer value.
public void AddDictEntry(PdfName key, long value)
Adds 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)
Adds a dictionary entry with nullable RectangleF value.
public void AddDictEntry(PdfName key, RectangleF? value)
key
PdfNamevalue
RectangleF?Adds a dictionary entry with nullable RectangleF value.
public void AddDictEntry(PdfName key, RectangleF? value, RectangleF defValue)
key
PdfNamevalue
RectangleF?defValue
RectangleFAdds a dictionary entry with nullable integer value.
public void AddDictEntry(PdfName key, int? value)
Adds a dictionary entry with nullable float value.
public void AddDictEntry(PdfName key, float? value)
Adds a dictionary entry with nullable float value.
public void AddDictEntry(PdfName key, float? value, float defValue)
Adds a dictionary entry with Matrix3x2 value.
public void AddDictEntry(PdfName key, Matrix3x2 value)
Adds a dictionary entry with float value.
public void AddDictEntry(PdfName key, float value)
Adds a dictionary entry with line style value.
public void AddDictEntry(PdfName key, float[] dashPattern, float dashPhase)
Adds 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
IPdfObject[]Adds a dictionary entry with PDF string value written as HEX string: <F1A0>
public void AddDictEntryHexString(PdfName key, IList<byte> value)
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)
Adds a dictionary entry with PDF name array.
public void AddDictEntryNameArray(PdfName key, params string[] value)
Adds a dictionary entry with PDF name array.
public void AddDictEntryNames(PdfName key, string[] value, string[] defValue = null)
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)
Adds 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)
Adds 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)
Adds 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)
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, IList<byte> value, bool encrypt = true)
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)
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 AddDictEntryStringNotEmpty(PdfName key, string value)
Adds a dictionary entry with PdfEnum<TEnum> value.
public void AddDictEntry<TEnum>(PdfName key, PdfEnum<TEnum> value) where TEnum : struct
TEnum
Adds a dictionary entry with nullable PdfEnum<TEnum> value.
public void AddDictEntry<TEnum>(PdfName key, PdfEnum<TEnum>? value) where TEnum : struct
TEnum
Adds 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
TT
Starts 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
SeekOriginWrites the IPdfObject object
if value
is indirect object then reference to this object will be written
otherwise Write(PdfStreamWriterBase) will be
called to write value representing an object.
If value
is null or Empty is true
then PDF NULL value will be written.
public abstract void Write(IPdfObject value)
value
IPdfObjectWrites a byte array.
public void Write(byte[] value)
value
byte[]Writes a PointF structure as 2 float values.
public void Write(PointF p)
p
PointFWrites content of specified stream.
public void Write(Stream stream)
stream
StreamWrites a Matrix3x2 structure.
public void Write(Matrix3x2 value)
value
Matrix3x2Writes a string using ASCII encoding, each char converted to byte as (byte)s[i].
public void Write(string value)
value
stringWrites 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)
Writes 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)
Writes the CRLF, resets GrapeCity.Documents.Pdf.Writer.PdfStreamWriterBase.NeedDelimiter.
public void WriteCRLF()
Writes a Color value as sequence of 3 numbers R, G, B. NOTE! alpha channel is NOT written.
public void WriteColor(Color value)
value
ColorWrites 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)
Writes a nullable float value.
public void WriteFloat(float? value, int decimalPlaces = -1)
Writes a float value.
public void WriteFloat(float value, int decimalPlaces = -1)
Writes a float array, writes a null if value is null.
public void WriteFloatArray(float[] value, int decimalPlaces = -1)
Writes 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)
Writes 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 a 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)
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)
Writes a RectangleF structure as 4 float values Left, Top, Width, Height.
public void WriteRect(RectangleF value)
value
RectangleFWrites a RectangleF structure as 4 float values Left, Top, Right, Bottom.
public void WriteRectLTRB(RectangleF value)
value
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)
Writes 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)
Writes an uint value.
public void WriteUint(uint value)
value
uint