Exemplo n.º 1
0
        /// <summary>
        /// Writes PDF image element into file stream
        /// </summary>
        /// <param name="image">PDF image element</param>
        internal void Write(ImageElement image)
        {
            var imageContent = new StringBuilder();

            imageContent.AppendLine("q");
            imageContent.AppendFormatLine("{0} 0 0 {1} {2} {3} cm", image.Width, image.Height, image.X, image.Y);
            imageContent.AppendFormatLine("{0} Do", image.GetXReference());
            imageContent.Append("Q");

            writeStreamedObject(image.ObjectId, imageContent.ToString());
        }
Exemplo n.º 2
0
        /// <summary>
        /// Writes PDF image xObject element into file stream
        /// </summary>
        /// <param name="image">PDF image xObject element</param>
        internal void WriteXObject(ImageElement image)
        {
            writeBeginObject(image.XObjectId);

            writeBeginDictionary();
            writeDictionaryEntry("/Type", "/XObject");
            writeDictionaryEntry("/Subtype", "/Image");
            writeDictionaryEntry("/Name", image.GetXReference());
            writeDictionaryEntry("/Filter", "/DCTDecode");
            writeDictionaryEntry("/Width", image.OwnWidth);
            writeDictionaryEntry("/Height", image.OwnHeight);
            writeDictionaryEntry("/BitsPerComponent", 8);
            writeDictionaryEntry("/ColorSpace", "/DeviceRGB");
            writeDictionaryEntry("/Length", image.Content.Length);
            writeEndDictionary();

            writeBeginStream();
            writeLineRaw(image.Content);
            writeEndStream();

            writeEndObject();
        }