//------------------------------------------------------------------------------------------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; } }
//----------------------------------------------------------------------------------------------------x /// <summary></summary> internal void Init() { pdfIndirectObject_Font = null; // ??? }
//------------------------------------------------------------------------------------------xx.02.2006 /// <summary>Writes the object to the buffer.</summary> internal override void Write() { StartObj(); Dictionary_Start(); Dictionary_Key("Type"); Name("Page"); Dictionary_Key("Parent"); IndirectReference(pdfFormatter.pdfIndirectObject_Pages); Dictionary_Key("Resources"); Dictionary_Start(); Dictionary_Key("ProcSet"); ArrayStart(); if (bProcSet_Text) { Name("Text"); } if (bProcSet_PDF) { Space(); Name("PDF"); } if (bProcSet_ImageB) { Space(); Name("ImageB"); } if (bProcSet_ImageC) { Space(); Name("ImageC"); } if (bProcSet_ImageI) { Space(); Name("ImageI"); } ArrayEnd(); Dictionary_Key("Font"); Dictionary_Start(); foreach (FontData fontData in dict_FontData.Values) { PdfIndirectObject_Font pdfIndirectObject_Font = (PdfIndirectObject_Font)fontData.oFontDataX; Dictionary_Key("F" + pdfIndirectObject_Font.iObjectNumber); IndirectReference(pdfIndirectObject_Font); } Dictionary_End(); if (report.ht_ImageData.Count > 0) { Dictionary_Key("XObject"); Dictionary_Start(); foreach (ImageData imageData in report.ht_ImageData.Values) { PdfIndirectObject_ImageJpeg pdfIndirectObject_ImageJpeg = (PdfIndirectObject_ImageJpeg)imageData.oImageResourceX; Dictionary_Key("I" + pdfIndirectObject_ImageJpeg.iObjectNumber); IndirectReference(pdfIndirectObject_ImageJpeg); } Dictionary_End(); } Dictionary_End(); Dictionary_Key("MediaBox"); ArrayStart(); Number(0); Space(); Number(0); Space(); Number(page.rWidth); Space(); Number(page.rHeight); ArrayEnd(); Dictionary_Key("CropBox"); ArrayStart(); Number(0); Space(); Number(0); Space(); Number(page.rWidth); Space(); Number(page.rHeight); ArrayEnd(); //Dictionary_Key("Rotate"); Number(0); // !!! Dictionary_Key("Contents"); IndirectReference(pdfIndirectObject_PageContents); Dictionary_End(); EndObj(); }
//----------------------------------------------------------------------------------------------------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 + "]"); } } }