Exemplo n.º 1
0
 /// <summary>
 /// Writes the dictionary entries usign the PDFWriter
 /// </summary>
 /// <param name="writer">The PDFWriter to use</param>
 public void WriteData(PDFWriter writer)
 {
     writer.BeginDictionaryS();
     foreach (KeyValuePair <PDFName, IFileObject> kvp in this)
     {
         writer.BeginDictionaryEntry(kvp.Key);
         kvp.Value.WriteData(writer);
         writer.EndDictionaryEntry();
     }
     writer.EndDictionary();
 }
        private void WriteAPageLabel(PDFRenderContext context, PDFWriter writer, PDFPageNumberRegistration entry)
        {
            writer.WriteLine();
            writer.BeginArrayEntry();
            writer.WriteNumberS(entry.FirstPageIndex);
            writer.BeginDictionaryS();
            string type;

            switch (entry.Group.NumberStyle)
            {
            case PageNumberStyle.Decimals:
                type = "D";
                break;

            case PageNumberStyle.UppercaseRoman:
                type = "R";
                break;

            case PageNumberStyle.LowercaseRoman:
                type = "r";
                break;

            case PageNumberStyle.UppercaseLetters:
                type = "A";
                break;

            case PageNumberStyle.LowercaseLetters:
                type = "a";
                break;

            default:
                type = "";
                break;
            }
            if (!string.IsNullOrEmpty(type))
            {
                writer.WriteDictionaryNameEntry("S", type);
            }
            if (entry.Group.NumberStart > 0)
            {
                writer.WriteDictionaryNumberEntry("St", entry.Group.NumberStart + entry.PreviousLinkedRegistrationPageCount);
            }
            writer.EndDictionary();
            writer.EndArrayEntry();

            if (context.ShouldLogVerbose)
            {
                context.TraceLog.Add(TraceLevel.Verbose, "Page Labels", "Output the page label entry starting at page index " + entry.FirstPageIndex + " with style " + entry.Group.NumberStyle + ", starting at " + entry.Group.NumberStart);
            }
        }
Exemplo n.º 3
0
        protected override PDFObjectRef DoRenderToPDF(PDFContextBase context, PDFWriter writer)
        {
            PDFObjectRef oref = writer.BeginObject();

            writer.BeginDictionaryS();
            writer.WriteDictionaryNameEntry("Type", "ExtGState");
            foreach (PDFName name in this.States.Keys)
            {
                writer.BeginDictionaryEntry(name);
                this.States[name].WriteData(writer);
                writer.EndDictionaryEntry();
            }
            writer.EndDictionary();
            writer.EndObject();
            return(oref);
        }
        private void OutputDefaultResources(PDFRenderContext context, PDFWriter writer)
        {
            writer.BeginDictionaryEntry("DR");
            writer.BeginDictionaryS();

            writer.BeginDictionaryEntry("Font");

            writer.BeginDictionary();
            writer.WriteDictionaryObjectRefEntry("frsc1", new PDFObjectRef(7, 0));
            writer.EndDictionary();

            writer.EndDictionaryEntry();

            writer.EndDictionary();

            writer.EndDictionaryEntry();
        }
Exemplo n.º 5
0
        internal PDFObjectRef Render(PDFName name, PDFContextBase context, PDFWriter writer)
        {
            if (context.ShouldLogDebug)
            {
                context.TraceLog.Begin(TraceLevel.Message, "Image Data", "Rendering image data for '" + name.ToString() + "'");
            }

            PDFObjectRef renderref = writer.BeginObject(name.Value);

            writer.BeginDictionaryS();
            writer.WriteDictionaryNameEntry("Name", name.Value);
            writer.WriteDictionaryNameEntry("Type", "XObject");
            writer.WriteDictionaryNameEntry("Subtype", "Image");

            RenderImageInformation(context, writer);

            //writer.EndDictionary(); //- commented for data length fix

            writer.BeginStream(renderref);

            int length = this.RenderImageStreamData(context, writer);

            writer.EndStream();

            //Added for Data Length fix HRB 15/01/2015
            writer.WriteDictionaryNumberEntry("Length", length);
            writer.EndDictionary();
            //End of add

            writer.EndObject();

            if (context.ShouldLogDebug)
            {
                context.TraceLog.End(TraceLevel.Message, "Image Data", "Completed render of the image data for '" + name + "' with source " + this.SourcePath);
            }
            else
            {
                context.TraceLog.Add(TraceLevel.Message, "Image Data", "Rendered the image data for '" + name.ToString() + "' with source " + this.SourcePath);
            }


            return(renderref);
        }
        internal PDFObjectRef Render(PDFName name, PDFContextBase context, PDFWriter writer)
        {
            if (context.ShouldLogDebug)
            {
                context.TraceLog.Begin(TraceLevel.Message, "Path Data", "Rendering path data for '" + name.ToString() + "'");
            }

            PDFObjectRef renderref = writer.BeginObject(name.Value);

            writer.BeginDictionaryS();
            writer.WriteDictionaryNameEntry("Name", name.Value);
            writer.WriteDictionaryNameEntry("Type", "XObject");
            writer.WriteDictionaryNameEntry("Subtype", "Image");

            RenderPathInformation(context, writer, renderref);

            int length = this.RenderPathData(context, writer, renderref);

            writer.WriteDictionaryNumberEntry("Length", length);
            writer.EndDictionary();
            //End of add

            writer.EndObject();

            if (context.ShouldLogDebug)
            {
                context.TraceLog.End(TraceLevel.Message, "Path Data", "Completed render of the path data for '" + name.ToString());
            }
            else
            {
                context.TraceLog.Add(TraceLevel.Message, "Path Data", "Rendered the path data for '" + name.ToString());
            }


            return(renderref);
        }