// other methods /** * Increments the value of the <CODE>PdfNumber</CODE>-object with 1. */ virtual public void Increment() { value += 1.0; Content = ByteBuffer.FormatDouble(value); }
/** * Constructs a new REAL <CODE>PdfNumber</CODE>-object. * * @param value value of the new <CODE>PdfNumber</CODE>-object */ public PdfNumber(double value) : base(NUMBER) { this.value = value; Content = ByteBuffer.FormatDouble(value); }
// constructor /** * Constructs a <CODE>PdfContents</CODE>-object, containing text and general graphics. * * @param under the direct content that is under all others * @param content the graphics in a page * @param text the text in a page * @param secondContent the direct content that is over all others * @throws BadPdfFormatException on error */ internal PdfContents(PdfContentByte under, PdfContentByte content, PdfContentByte text, PdfContentByte secondContent, Rectangle page) : base() { Stream ostr = null; streamBytes = new MemoryStream(); if (Document.Compress) { compressed = true; ostr = new ZDeflaterOutputStream(streamBytes, text.PdfWriter.CompressionLevel); } else { ostr = streamBytes; } int rotation = page.Rotation; byte[] tmp; switch (rotation) { case 90: ostr.Write(ROTATE90, 0, ROTATE90.Length); tmp = DocWriter.GetISOBytes(ByteBuffer.FormatDouble(page.Top)); ostr.Write(tmp, 0, tmp.Length); ostr.WriteByte((byte)' '); ostr.WriteByte((byte)'0'); ostr.Write(ROTATEFINAL, 0, ROTATEFINAL.Length); break; case 180: ostr.Write(ROTATE180, 0, ROTATE180.Length); tmp = DocWriter.GetISOBytes(ByteBuffer.FormatDouble(page.Right)); ostr.Write(tmp, 0, tmp.Length); ostr.WriteByte((byte)' '); tmp = DocWriter.GetISOBytes(ByteBuffer.FormatDouble(page.Top)); ostr.Write(tmp, 0, tmp.Length); ostr.Write(ROTATEFINAL, 0, ROTATEFINAL.Length); break; case 270: ostr.Write(ROTATE270, 0, ROTATE270.Length); ostr.WriteByte((byte)'0'); ostr.WriteByte((byte)' '); tmp = DocWriter.GetISOBytes(ByteBuffer.FormatDouble(page.Right)); ostr.Write(tmp, 0, tmp.Length); ostr.Write(ROTATEFINAL, 0, ROTATEFINAL.Length); break; } if (under.Size > 0) { ostr.Write(SAVESTATE, 0, SAVESTATE.Length); under.InternalBuffer.WriteTo(ostr); ostr.Write(RESTORESTATE, 0, RESTORESTATE.Length); } if (content.Size > 0) { ostr.Write(SAVESTATE, 0, SAVESTATE.Length); content.InternalBuffer.WriteTo(ostr); ostr.Write(RESTORESTATE, 0, RESTORESTATE.Length); } if (text != null) { ostr.Write(SAVESTATE, 0, SAVESTATE.Length); text.InternalBuffer.WriteTo(ostr); ostr.Write(RESTORESTATE, 0, RESTORESTATE.Length); } if (secondContent.Size > 0) { secondContent.InternalBuffer.WriteTo(ostr); } if (ostr is ZDeflaterOutputStream) { ((ZDeflaterOutputStream)ostr).Finish(); } Put(PdfName.LENGTH, new PdfNumber(streamBytes.Length)); if (compressed) { Put(PdfName.FILTER, PdfName.FLATEDECODE); } }
/// <summary> /// other methods /// </summary> /// <summary> /// Increments the value of the PdfNumber -object with 1. /// </summary> public void Increment() { DoubleValue += 1.0; Content = ByteBuffer.FormatDouble(DoubleValue); }
/// <summary> /// Constructs a PdfContents -object, containing text and general graphics. /// @throws BadPdfFormatException on error /// </summary> /// <param name="under">the direct content that is under all others</param> /// <param name="content">the graphics in a page</param> /// <param name="text">the text in a page</param> /// <param name="secondContent">the direct content that is over all others</param> /// <param name="page"></param> internal PdfContents(PdfContentByte under, PdfContentByte content, PdfContentByte text, PdfContentByte secondContent, Rectangle page) { Stream ostr = null; StreamBytes = new MemoryStream(); if (Document.Compress) { Compressed = true; ostr = new ZDeflaterOutputStream(StreamBytes, text.PdfWriter.CompressionLevel); } else { ostr = StreamBytes; } int rotation = page.Rotation; byte[] tmp; switch (rotation) { case 90: ostr.Write(Rotate90, 0, Rotate90.Length); tmp = DocWriter.GetIsoBytes(ByteBuffer.FormatDouble(page.Top)); ostr.Write(tmp, 0, tmp.Length); ostr.WriteByte((byte)' '); ostr.WriteByte((byte)'0'); ostr.Write(Rotatefinal, 0, Rotatefinal.Length); break; case 180: ostr.Write(Rotate180, 0, Rotate180.Length); tmp = DocWriter.GetIsoBytes(ByteBuffer.FormatDouble(page.Right)); ostr.Write(tmp, 0, tmp.Length); ostr.WriteByte((byte)' '); tmp = DocWriter.GetIsoBytes(ByteBuffer.FormatDouble(page.Top)); ostr.Write(tmp, 0, tmp.Length); ostr.Write(Rotatefinal, 0, Rotatefinal.Length); break; case 270: ostr.Write(Rotate270, 0, Rotate270.Length); ostr.WriteByte((byte)'0'); ostr.WriteByte((byte)' '); tmp = DocWriter.GetIsoBytes(ByteBuffer.FormatDouble(page.Right)); ostr.Write(tmp, 0, tmp.Length); ostr.Write(Rotatefinal, 0, Rotatefinal.Length); break; } if (under.Size > 0) { ostr.Write(Savestate, 0, Savestate.Length); under.InternalBuffer.WriteTo(ostr); ostr.Write(Restorestate, 0, Restorestate.Length); } if (content.Size > 0) { ostr.Write(Savestate, 0, Savestate.Length); content.InternalBuffer.WriteTo(ostr); ostr.Write(Restorestate, 0, Restorestate.Length); } if (text != null) { ostr.Write(Savestate, 0, Savestate.Length); text.InternalBuffer.WriteTo(ostr); ostr.Write(Restorestate, 0, Restorestate.Length); } if (secondContent.Size > 0) { secondContent.InternalBuffer.WriteTo(ostr); } if (ostr is ZDeflaterOutputStream) { ((ZDeflaterOutputStream)ostr).Finish(); } Put(PdfName.LENGTH, new PdfNumber(StreamBytes.Length)); if (Compressed) { Put(PdfName.Filter, PdfName.Flatedecode); } }