zhao
2021-07-02 081df17b8cc4a6e7e4f4e1e1887f24810e3ec2f9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
using System;
using System.Collections;
using System.Drawing;
 
namespace Smart.Pdf
{
    /*
    public class PdfTextBlock : PdfObject
    {
        public PdfTextBlock(double startx,double starty)
        {this.textes=new ArrayList();}
        public ArrayList textes;
        public void Write(Font Font,Color Color, string Text)
        {
            PdfArea pa=new PdfArea();
 
            if (this.textes.Count==0)
            {
                pa.posx=0;
                pa.posy=0;
            }                
            else
            {
                pa.posx=((PdfText)textes[textes.Count-1]).area.TopRightVertex.X;
                pa.posy=((PdfText)textes[textes.Count-1]).area.TopRightVertex.Y;
            }
 
            pa.width=Utility.NeededArea(Font,Text).width;
            pa.height=Utility.NeededArea(Font,Text).height;
 
            this.textes.Add(new PdfText(Font,Color,Text,pa));
        }
        internal string ToLineStream()
        {
            string text="";
            text+="BT\n";
            foreach (PdfText pt in this.textes)
            {
                text+=Utility.FontToFontLine(pt.Font);
                text+=Utility.ColorrgLine(pt.Color);
                text+="1 0 0 1 "+pt.area.posx.ToString("0.##").Replace(",",".");
                text+=" "+(Settings.PH-(pt.Font.Height*0.465)).ToString("0.##").Replace(",",".");
                text+=" Tm ("+Utility.TextEncode(pt.Text)+") Tj\n";
            }
            text+="ET\n";
            return text;
        }
        
        
        internal override int StreamWrite(System.IO.Stream stream)
        {
            int num=this.id;
            string text=this.ToLineStream();
            Byte[] part2;
            if (Settings.FlateCompression) part2=Utility.Deflate(text); else
                part2=System.Text.ASCIIEncoding.ASCII.GetBytes(text);
 
            string s1="";
            s1+=num.ToString()+" 0 obj\n";
            s1+="<< /Lenght "+part2.Length;
            if (Settings.FlateCompression) s1+=" /Filter /FlateDecode";
            s1+=">>\n";
            s1+="stream\n";
 
            string s3="\nendstream\n";
            s3+="endobj\n";
                
            Byte[] part1=System.Text.ASCIIEncoding.ASCII.GetBytes(s1);
            Byte[] part3=System.Text.ASCIIEncoding.ASCII.GetBytes(s3);
                
                
            stream.Write(part1,0,part1.Length);
            stream.Write(part2,0,part2.Length);
            stream.Write(part3,0,part3.Length);
 
            return part1.Length+part2.Length+part3.Length;
        }
    }
    public class PdfText
    {
        internal Font Font;
        internal Color Color;
        internal string Text;
        public PdfArea area;
        internal PdfText(Font Font,Color Color, string Text,PdfArea area)
        {
            this.Color=Color;
            this.Font=Font;
            this.Text=Text;
            this.area=area;
        }
    }
*/
}