Example #1
0
 private void method_6(PdfBody body, List <Class65> objectPositions, long crossRefTablePosition)
 {
     this.method_7("trailer");
     this.method_7("<< /Size " + (objectPositions.Count + 1).ToString((IFormatProvider)CultureInfo.InvariantCulture));
     this.method_7("/Root " + PdfWriter.GetReferenceString((IPdfIndirectObject)body.Catalog));
     if (body.DocumentInformation != null)
     {
         this.method_7("/Info " + PdfWriter.GetReferenceString((IPdfIndirectObject)body.DocumentInformation));
     }
     this.method_7(">>");
     this.method_7("startxref");
     this.method_7(crossRefTablePosition.ToString((IFormatProvider)CultureInfo.InvariantCulture));
     this.method_7("%%EOF");
 }
Example #2
0
 private void method_2(PdfBody body)
 {
     if (body.DocumentInformation != null)
     {
         this.method_3((IPdfIndirectObject)body.DocumentInformation);
     }
     this.method_3((IPdfIndirectObject)body.Catalog);
     this.method_3((IPdfIndirectObject)body.Outlines);
     this.method_3((IPdfIndirectObject)body.Pages);
     foreach (IPdfIndirectObject indirectObject in (List <IPdfIndirectObject>)body.IndirectObjects)
     {
         this.method_3(indirectObject);
     }
     foreach (IPdfIndirectObject font in (List <PdfFont>)body.Fonts)
     {
         this.method_3(font);
     }
     this.method_3((IPdfIndirectObject)body.ProcedureSetArray);
 }
Example #3
0
        public void AddSoftMask(PdfBody body)
        {
            int width  = this.Width;
            int height = this.Height;
            PagedMemoryStream pagedMemoryStream = new PagedMemoryStream((long)(width * height));
            bool flag = false;

            this.ibitmap_0.LockBits();
            try
            {
                for (int y = 0; y < height; ++y)
                {
                    for (int x = 0; x < width; ++x)
                    {
                        byte alpha = this.GetAlpha(x, y);
                        if (alpha != byte.MaxValue)
                        {
                            flag = true;
                        }
                        pagedMemoryStream.WriteByte(alpha);
                    }
                }
            }
            finally
            {
                this.ibitmap_0.UnlockBits();
            }
            if (flag)
            {
                PdfIndirectObject pdfIndirectObject = new PdfIndirectObject((IPdfObject) new PdfSoftMaskImage()
                {
                    Width = this.Width, Height = this.Height, OpacityStream = (Stream)pagedMemoryStream
                });
                body.IndirectObjects.Add((IPdfIndirectObject)pdfIndirectObject);
                this.Dictionary["SMask"] = (IPdfObject) new PdfReference((IPdfIndirectObject)pdfIndirectObject);
            }
            else
            {
                pagedMemoryStream.Dispose();
            }
        }
Example #4
0
        private List <Class65> method_1(PdfBody body)
        {
            body.EmbedFonts();
            this.method_2(body);
            if (this.int_1 == 13)
            {
                this.method_7("%PDF-1.3");
            }
            else
            {
                if (this.int_1 != 15)
                {
                    throw new ArgumentException("Unknown pdf version requested." + (object)this.int_1);
                }
                this.method_7("%PDF-1.5");
            }
            this.stream_0.Write(PdfWriter.byte_0, 0, PdfWriter.byte_0.Length);
            Class64 bodyWriter = new Class64(this.stream_0);

            if (body.DocumentInformation != null)
            {
                this.method_4((IPdfIndirectObject)body.DocumentInformation, bodyWriter);
            }
            this.method_4((IPdfIndirectObject)body.Catalog, bodyWriter);
            this.method_4((IPdfIndirectObject)body.Outlines, bodyWriter);
            this.method_4((IPdfIndirectObject)body.Pages, bodyWriter);
            foreach (IPdfIndirectObject indirectObject in (List <IPdfIndirectObject>)body.IndirectObjects)
            {
                this.method_4(indirectObject, bodyWriter);
            }
            foreach (IPdfIndirectObject font in (List <PdfFont>)body.Fonts)
            {
                this.method_4(font, bodyWriter);
            }
            this.method_4((IPdfIndirectObject)body.ProcedureSetArray, bodyWriter);
            return(bodyWriter.ObjectPositions);
        }