Beispiel #1
0
        //------------------------------------------------------------------------------------------xx.02.2006
        /// <summary>Registers the specified font properties for this page.</summary>
        /// <param name="fontProp">Font properties</param>
        /// <seealso cref="PdfPageData.ht_FontProp"/>
        /// <seealso cref="PdfFontPropData.pdfPageData_Registered"/>
        internal void RegisterFontData(FontData fontData)
        {
            PdfIndirectObject_Font pdfIndirectObject_Font = (PdfIndirectObject_Font)fontData.oFontDataX;

            if (pdfIndirectObject_Font.pdfIndirectObject_Page != this)
            {
                dict_FontData.Add(pdfIndirectObject_Font.sKey, fontData);
                pdfIndirectObject_Font.pdfIndirectObject_Page = this;
            }
        }
 //------------------------------------------------------------------------------------------07.02.2005
 /// <summary>Creates a new font properties data object.</summary>
 internal FontPropData(FontProp fontProp)
 {
     FontDef.Style style;
     if (fontProp.bBold)
     {
         style = (fontProp.bItalic ? FontDef.Style.BoldItalic : FontDef.Style.Bold);
     }
     else
     {
         style = (fontProp.bItalic ? FontDef.Style.Italic : FontDef.Style.Standard);
     }
     fontData = fontProp.fontDef.aFontData[style];
 }
Beispiel #3
0
        //------------------------------------------------------------------------------------------29.07.2006
        /// <summary>Creates a font indirect object.</summary>
        /// <param name="pdfFormatter">PDF formatter</param>
        /// <param name="fontProp">Font property</param>
        internal PdfIndirectObject_Font(PdfFormatter pdfFormatter, FontData fontData) : base(pdfFormatter)
        {
            this.fontData = fontData;

            sKey = fontData.fontDef.sFontName;
            if ((fontData.fontStyle & FontStyle.Bold) > 0)
            {
                sKey += ";B";
            }
            if ((fontData.fontStyle & FontStyle.Italic) > 0)
            {
                sKey += ";I";
            }
        }
Beispiel #4
0
 //------------------------------------------------------------------------------------------06.03.2005
 /// <summary>Gets the font data object that is identified by the specified style.</summary>
 /// <param name="fontStyle">Style value that identifies the font data object</param>
 /// <value>Font data object that is identified by the specified style</value>
 /// <remarks>If there is no font data object with the specified style, <see langword="null"/> will be returned.</remarks>
 internal FontData this[FontStyle fontStyle] {
     get {
         Int32    i        = (Int32)fontStyle;
         FontData fontData = aFontData[i];
         if (fontData == null)
         {
             if (fontDef.fontType == FontType.InternalAFM)
             {
                 fontData = new Type1FontData(fontDef, fontDef.sFontName, fontStyle);
             }
             else
             {
                 fontData = new OpenTypeFontData(fontDef, fontStyle);
             }
             aFontData[i] = fontData;
         }
         return(fontData);
     }
 }
Beispiel #5
0
 //------------------------------------------------------------------------------------------02.05.2006
 /// <summary>This method will disconnect this font from the registered font and its font data.</summary>
 /// <remarks>This operation is required if properties of the font change.</remarks>
 private void ResetRegisteredFontAndFontData()
 {
     ResetRegisteredFont();
     _fontData = null;
 }
Beispiel #6
0
        //----------------------------------------------------------------------------------------------------x
        /// <summary>Prepares the PDF-object structure for a container.</summary>
        /// <param name="pdfPageData"></param>
        /// <param name="iObjId"></param>
        /// <param name="container"></param>
        private void PrepareObjIdsForContainer(PdfIndirectObject_Page pdfPageData, Container container)
        {
            foreach (RepObj repObj in container)
            {
                if (repObj is Container)
                {
                    PrepareObjIdsForContainer(pdfPageData, (Container)repObj);
                }
                else if (repObj is RepArcBase)
                {
                    pdfPageData.bProcSet_PDF = true;
                }
                else if (repObj is RepImage)
                {
//          RepImage repImage = (RepImage)repObj;
//          ImageFormat imageFormat = repImage.imageData.image.RawFormat;
//          if (Object.Equals(imageFormat, ImageFormat.Jpeg)) {
//            pdfPageData.bProcSet_ImageC = true;
//          }
//          else if (Object.Equals(imageFormat, ImageFormat.Tiff)) {
//            pdfPageData.bProcSet_ImageB = true;
//          }
//          else {
//            Debug.Fail("unknown image type: send image to [email protected]");
//          }
                    RepImage repImage = repObj as RepImage;
                    repImage.imageData.stream.Position = 0;

                    //Added By TechnoGuru - [email protected] - http://www.borie.org/
                    //To support tiff file
                    //I reload Image from stream to be more scalable
                    //(Dont't have like that lots of image object on memeory
    #if !WindowsCE
                    using (Image image = Image.FromStream(repImage.imageData.stream)) {
                        if (image.RawFormat.Equals(ImageFormat.Tiff) && image.PixelFormat.Equals(PixelFormat.Format1bppIndexed))
                        {
                            pdfPageData.bProcSet_ImageI = true; // CHANGED
                        }
                        else if (image.RawFormat.Equals(ImageFormat.Tiff) || image.RawFormat.Equals(ImageFormat.Jpeg))
                        {
                            pdfPageData.bProcSet_ImageC = true;
                        }
                        else
                        {
                            Debug.Fail("unknown image type: send image to [email protected]");
                        }
                    }
#endif
                }
                else if (repObj is RepLine)
                {
                    pdfPageData.bProcSet_PDF = true;
                }
                else if (repObj is RepRect)
                {
                    pdfPageData.bProcSet_PDF = true;
                }
                else if (repObj is RepString)
                {
                    FontData fontData_String = ((RepString)repObj).fontProp.fontData;
                    PdfIndirectObject_Font pdfIndirectObject_Font = (PdfIndirectObject_Font)fontData_String.oFontDataX;
                    if (fontData_String.oFontDataX == null) // extended font data for PDF must be created and registered
                    {
                        if (fontData_String is Type1FontData)
                        {
                            pdfIndirectObject_Font = new PdfIndirectObject_Font_Type1(this, (Type1FontData)fontData_String);
                        }
                        else if (fontData_String is OpenTypeFontData)
                        {
                            pdfIndirectObject_Font = new PdfIndirectObject_Font_OpenType(this, (OpenTypeFontData)fontData_String);
                        }
                        else
                        {
                            Debug.Fail("unknown type of FontData");
                        }
                        fontData_String.oFontDataX = pdfIndirectObject_Font;
                    }
                    RepString repString = (RepString)repObj;
                    foreach (Char ch in repString.sText)
                    {
                        fontData_String.bitArray_UsedChar[(Int32)ch] = true;
                    }
                    pdfPageData.RegisterFontData(fontData_String);
                    pdfPageData.bProcSet_Text = true;
                }
                else
                {
                    throw new ReportException("unknown report object type [" + repObj.GetType().FullName + "]");
                }
            }
        }