Пример #1
0
        float _y;               // y location on page

        /// <summary>
        /// Create the image Dictionary
        /// </summary>
        internal PdfOutlineEntry(PdfAnchor pa, int p, string text, float x, float y) : base(pa)
        {
            _p    = p;
            _x    = x;
            _y    = y;
            _text = text;
        }
Пример #2
0
        internal PdfContent(PdfAnchor pa) : base(pa)
        {
            CanCompress = pa.CanCompress;
            content     = null;
//			contentStream="%stream\r";
            contentStream = "";
        }
Пример #3
0
 /// <summary>
 /// Create the font Dictionary
 /// </summary>
 internal PdfFontEntry(PdfAnchor pa, string fontName, string fontFace) : base(pa)
 {
     font     = fontName;
     fontDict = string.Format("\r\n{0} 0 obj<</Type/Font/Name /{1}/BaseFont/{2}/Subtype/Type1/Encoding /WinAnsiEncoding>>\tendobj\t",
                              this.objectNum, fontName, fontFace);
     //fontDict = string.Format("\r\n{0} 0 obj<</Type/Font/Name /{1}/BaseFont/{2}/Subtype/Type1>>\tendobj\t",
     //    this.objectNum, fontName, fontFace);
 }
Пример #4
0
        /// <summary>
        /// Create the image Dictionary
        /// </summary>
        internal PdfImageEntry(PdfAnchor pa, PdfPage p, int contentRef, string nm, ImageFormat imgf, byte[] im, int width, int height) : base(pa)
        {
            name = nm;
            imf  = imgf;
            ba   = im;

            string filter;
            string colorSpace;

            if (imf == ImageFormat.Jpeg)
            {
                filter = "/DCTDecode";

                switch (JpgParser.GetColorSpace(ref im))
                {
                case 0:
                    colorSpace = "/DeviceRGB";
                    break;

                case 1:
                    colorSpace = "/DeviceGray";
                    break;

                case 3:
                    colorSpace = "/DeviceRGB";
                    break;

                case 4:
                    colorSpace = "/DeviceCMYK";
                    break;

                default:
                    colorSpace = "/DeviceRGB";
                    break;
                }
            }
            else if (imf == ImageFormat.Png)    // TODO: this still doesn't work
            {
                filter     = "/FlateDecode /DecodeParms <</Predictor 15 /Colors 3 /BitsPerComponent 8 /Columns 80>>";
                colorSpace = "/DeviceRGB";
            }
            else if (imf == ImageFormat.Gif)    // TODO: this still doesn't work
            {
                filter     = "/LZWDecode";
                colorSpace = "/DeviceRGB";
            }
            else
            {
                filter     = "";
                colorSpace = "";
            }
            imgDict = string.Format("\r\n{0} 0 obj<</Type/XObject/Subtype /Image /Width {1} /Height {2} /ColorSpace {5} /BitsPerComponent 8 /Length {3} /Filter {4} >>\nstream\n",
                                    this.objectNum, width, height, ba.Length, filter, colorSpace);

            p.AddResource(this, contentRef);
        }
Пример #5
0
        /// <summary>
        /// Create the font Dictionary
        /// </summary>
        internal PdfPatternEntry(PdfAnchor pa, String patternName, String patternType) : base(pa)
        {
            pattern = patternName;
            switch (patternType)
            {
            case "BackwardDiagonal":
                patternDict = BackwardDiagonal();
                break;

            case "DarkDownwardDiagonal":
                patternDict = DarkDownwardDiagonal();
                break;

            case "DarkHorizontal":
                patternDict = DarkHorizontal();
                break;

            case "Vertical":
                patternDict = Vertical();
                break;

            case "OutlinedDiamond":
                patternDict = OutlinedDiamond();
                break;

            case "LargeConfetti":
                patternDict = LargeConfetti();
                break;

            case "SmallConfetti":
                patternDict = SmallConfetti();
                break;

            case "HorizontalBrick":
                patternDict = HorizontalBrick();
                break;

            case "DiagonalBrick":
                patternDict = DiagonalBrick();
                break;

            case "SolidDiamond":
                patternDict = SolidDiamond();
                break;

            case "Cross":
                patternDict = Cross();
                break;

            case "CheckerBoard":
                patternDict = CheckerBoard();
                break;
            }
        }
Пример #6
0
 internal PdfPage(PdfAnchor pa) : base(pa)
 {
     resourceDict  = null;
     contents      = null;
     pageSize      = null;
     fontRef       = null;
     imageRef      = null;
     annotsDict    = null;
     colorSpaceRef = null;
     patternRef    = null;
 }
Пример #7
0
 internal PdfCatalog(PdfAnchor pa, string l) : base(pa)
 {
     if (l != null)
     {
         lang = String.Format("/Lang({0})", l);
     }
     else
     {
         lang = "";
     }
 }
Пример #8
0
        public void Start()
        {
            // Create the anchor for all pdf objects
            CompressionConfig cc = RdlEngineConfig.GetCompression();

            anchor = new PdfAnchor(cc != null);

            //Create a PdfCatalog
            string lang;

            if (r.ReportDefinition.Language != null)
            {
                lang = r.ReportDefinition.Language.EvaluateString(this.r, null);
            }
            else
            {
                lang = null;
            }
            catalog = new PdfCatalog(anchor, lang);

            //Create a Page Tree Dictionary
            pageTree = new PdfPageTree(anchor);

            //Create a Font Dictionary
            fonts = new PdfFonts(anchor);

            //Create a Pattern Dictionary
            patterns = new PdfPattern(anchor);

            //Create an Image Dictionary
            images = new PdfImages(anchor);

            //Create an Outline Dictionary
            outline = new PdfOutline(anchor);

            //Create the info Dictionary
            info = new PdfInfo(anchor);

            //Set the info Dictionary.
            info.SetInfo(r.Name, r.Author, r.Description, "");  // title, author, subject, company

            //Create a utility object
            pdfUtility = new PdfUtility(anchor);

            //write out the header
            int size = 0;

            tw.Write(pdfUtility.GetHeader("1.5", out size), 0, size);
            //
            filesize = size;
        }
Пример #9
0
 internal PdfUtility(PdfAnchor p)
 {
     pa = p;
     numTableEntries = 0;
 }
Пример #10
0
 internal PatternObj(PdfAnchor pa) : base(pa)
 {
     Patternobj = string.Format("\r\n{0} 0 obj\r\n [ /Pattern /DeviceRGB ]\r\n endobj", this.objectNum);
 }
Пример #11
0
 internal PdfPattern(PdfAnchor a)
 {
     pa       = a;
     patterns = new Hashtable();
 }
Пример #12
0
 internal PdfPageTree(PdfAnchor pa) : base(pa)
 {
     kids     = "[ ";
     MaxPages = 0;
 }
Пример #13
0
 internal PdfImages(PdfAnchor a)
 {
     pa     = a;
     images = new Hashtable();
 }
Пример #14
0
 /// <summary>
 /// Constructor increments the object number to
 /// reflect the currently used object number
 /// </summary>
 protected PdfBase(PdfAnchor pa)
 {
     xref = pa;
     xref.current++;
     objectNum = xref.current;
 }
Пример #15
0
 internal PdfFonts(PdfAnchor a)
 {
     pa    = a;
     fonts = new Hashtable();
 }
Пример #16
0
 internal PdfOutlineMain(PdfAnchor pa)
     : base(pa)
 {
 }
Пример #17
0
 internal PdfInfo(PdfAnchor pa) : base(pa)
 {
     info = null;
 }
Пример #18
0
 internal PdfOutline(PdfAnchor pa)
 {
     _pa       = pa;
     bookmarks = new List <PdfOutlineEntry>();
 }