示例#1
0
        public Program(string res_dir, string style_path, string graphics_path, string output_path)
        {
            m_font_factory  = new FontFactory(res_dir);
            m_page_property = new PageProperty();

            m_style_root    = JObject.Parse(File.ReadAllText(style_path));
            m_graphics_root = JObject.Parse(File.ReadAllText(graphics_path));

            m_page_width  = m_page_property.A4_SHORT;
            m_page_height = m_page_property.A4_LONG;

            m_page_count    = 1;
            m_show_page_num = false;

            if (m_style_root["main"] != null)
            {
                if (m_style_root["main"]["width"] != null)
                {
                    m_page_width = (Int64)m_style_root["main"]["width"];
                }

                if (m_style_root["main"]["height"] != null)
                {
                    m_page_height = (Int64)m_style_root["main"]["height"];
                }

                if (m_style_root["main"]["pages"] != null)
                {
                    m_page_count = (int)m_style_root["main"]["pages"];
                }

                if (m_style_root["main"]["show_page"] != null)
                {
                    m_show_page_num = (int)m_style_root["main"]["show_page"] != 0;
                }
            }

            m_page_property.reset(m_page_width, m_page_height);
            m_document = new Document(new RectangleReadOnly(m_page_width, m_page_height));
            m_writer   = PdfWriter.GetInstance(m_document, new FileStream(output_path, FileMode.Create));

            m_document.Open();

            m_direct_content       = m_writer.DirectContent;
            m_direct_content_under = m_writer.DirectContentUnder;
            m_direct_op            = new DirectOperator(
                m_direct_content_under, m_direct_content, m_page_property, m_font_factory);

            m_op_page_map = new Dictionary <int, List <string> >();
            m_custom_oprs = new Dictionary <string, List <string> >();
        }
示例#2
0
        public DKOperators(
            PdfContentByte direct_content,
            PageProperty page_property,
            FontFactory font_factory,
            DirectOperator direct_op)
        {
            m_direct_content = direct_content;
            m_page_property  = page_property;
            m_font_factory   = font_factory;
            m_direct_op      = direct_op;

            m_width  = m_page_property.RESOLUTION;
            m_height = m_page_property.RESOLUTION;
        }
示例#3
0
        public DirectOperator(
            PdfContentByte under_canvas,
            PdfContentByte canvas,
            PageProperty page_property,
            FontFactory font_factory
            )
        {
            m_under_canvas  = under_canvas;
            m_canvas        = canvas;
            m_page_property = page_property;
            m_font_factory  = font_factory;

            m_last_td_x = 0;
            m_last_td_y = 0;
        }
示例#4
0
        public TextBox(
            PdfContentByte direct_content,
            PageProperty page_property,
            FontFactory font_factory
            )
        {
            m_page_property  = page_property;
            m_direct_content = direct_content;
            m_font_factory   = font_factory;

            m_content     = new Paragraph();
            m_column_text = new ColumnText(m_direct_content);

            m_leading   = dkh(100);
            m_alignment = Element.ALIGN_LEFT;

            m_content.Font = m_font_factory.getFont("songti", dkh(100));
        }