Preparation to switch to ITextSharp library
Corrected logic to process window size/movement adjustments
This commit is contained in:
@@ -91,8 +91,8 @@ namespace VG
|
||||
public void UpdatePageInfo(Page pa)
|
||||
{
|
||||
pg.LeftMargin=pa.LeftMargin;
|
||||
pg.portrait=pg.portrait;
|
||||
pg.VertOffset=pg.VertOffset;
|
||||
pg.portrait=pa.portrait; // RHM 20081003 - This had been pg.portrait=pg.portrait
|
||||
pg.VertOffset=pa.VertOffset; // RHM 20081003 - This had been pg.VertOffset=pg.VertOffset
|
||||
}
|
||||
|
||||
public string AddRTFBUI(string origStr, string bold, string underline, string italics)
|
||||
@@ -134,14 +134,14 @@ namespace VG
|
||||
pg = ipg;
|
||||
}
|
||||
|
||||
public void ToPdf(C1PdfDocument c1pdf)
|
||||
public void ToPdf(C1PdfDocument pdf)
|
||||
{
|
||||
float startx = pg.portrait ? (cx + pg.LeftMargin): (pg.VertOffset + cy);
|
||||
float starty = pg.portrait ? (cy + pg.VertOffset): (pg.LeftMargin - cx);
|
||||
float endx = pg.portrait ? (dx + pg.LeftMargin): (pg.VertOffset + dy);
|
||||
float endy = pg.portrait ? (dy + pg.VertOffset): (pg.LeftMargin - dx);
|
||||
Pen pn = new Pen(Brushes.Black,ToPoints(lnwid));
|
||||
c1pdf.DrawLine(pn, ToPoints(startx), ToPoints(starty), ToPoints(endx), ToPoints(endy));
|
||||
pdf.DrawLine(pn, ToPoints(startx), ToPoints(starty), ToPoints(endx), ToPoints(endy));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -169,7 +169,7 @@ namespace VG
|
||||
pg = ipg;
|
||||
}
|
||||
|
||||
public void ToPdf(C1PdfDocument c1pdf)
|
||||
public void ToPdf(C1PdfDocument pdf)
|
||||
{
|
||||
Pen pn = new Pen(Brushes.Black,ToPoints(lnwid));
|
||||
|
||||
@@ -178,7 +178,7 @@ namespace VG
|
||||
float endx = pg.portrait ? dx: dy;
|
||||
float endy = pg.portrait ? dy: dx;
|
||||
RectangleF rc = new RectangleF(ToPoints(startx), ToPoints(starty), ToPoints(endx), ToPoints(endy));
|
||||
c1pdf.DrawRectangle(pn,rc);
|
||||
pdf.DrawRectangle(pn,rc);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -206,7 +206,7 @@ namespace VG
|
||||
pg = ipg;
|
||||
}
|
||||
|
||||
public void ToPdf(C1PdfDocument c1pdf)
|
||||
public void ToPdf(C1PdfDocument pdf)
|
||||
{
|
||||
Pen pn = new Pen(Brushes.Black,lnwid);
|
||||
Bitmap bm = new Bitmap(FileName);
|
||||
@@ -215,7 +215,7 @@ namespace VG
|
||||
rc.Width = ToPoints((bm.Width*Scale)*4.8f);
|
||||
rc.X = ToPoints(pg.LeftMargin+cx);
|
||||
rc.Y = ToPoints(pg.VertOffset+cy);
|
||||
c1pdf.DrawImage(bm, rc, ContentAlignment.MiddleCenter, ImageSizeModeEnum.Scale);
|
||||
pdf.DrawImage(bm, rc, ContentAlignment.MiddleCenter, ImageSizeModeEnum.Scale);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -242,10 +242,10 @@ namespace VG
|
||||
pg = ipg;
|
||||
}
|
||||
|
||||
public void ToPdf(C1PdfDocument c1pdf)
|
||||
public void ToPdf(C1PdfDocument pdf)
|
||||
{
|
||||
Pen pn = new Pen(Brushes.Black,ToPoints(lnwid));
|
||||
c1pdf.DrawEllipse(pn,ToPoints(pg.LeftMargin+cx), ToPoints(pg.VertOffset+cy), ToPoints(dx), ToPoints(dy));
|
||||
pdf.DrawEllipse(pn,ToPoints(pg.LeftMargin+cx), ToPoints(pg.VertOffset+cy), ToPoints(dx), ToPoints(dy));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -290,18 +290,18 @@ namespace VG
|
||||
pg = ipg;
|
||||
}
|
||||
|
||||
public void ToPdf(C1PdfDocument c1pdf)
|
||||
public void ToPdf(C1PdfDocument pdf)
|
||||
{
|
||||
Font myfont = new Font(FontName,FontSize);
|
||||
RectangleF rc = new RectangleF();
|
||||
// the returned value from c1 pdf code is already in points,
|
||||
// so need to convert the size.
|
||||
rc.Size = c1pdf.MeasureStringRtf(Text,myfont,500); // TODO: 500 or pagewidth, or what
|
||||
rc.Size = pdf.MeasureStringRtf(Text,myfont,500); // TODO: 500 or pagewidth, or what
|
||||
rc.X = ToPoints(pg.LeftMargin+cx);
|
||||
rc.Y = ToPoints(pg.VertOffset+cy)-FontSize;
|
||||
// add bold, underline & italics for entire object.
|
||||
string rtfout = AddRTFBUI(Text,Bold,Underline,Italics);
|
||||
c1pdf.DrawStringRtf(rtfout,myfont,Brushes.Black,rc);
|
||||
pdf.DrawStringRtf(rtfout,myfont,Brushes.Black,rc);
|
||||
}
|
||||
}
|
||||
public class VG_Arc : VG
|
||||
@@ -339,7 +339,7 @@ public class VG_Arc : VG
|
||||
// pg = ipg;
|
||||
// }
|
||||
|
||||
public void ToPdf(C1PdfDocument c1pdf)
|
||||
public void ToPdf(C1PdfDocument pdf)
|
||||
{
|
||||
// Pen pn = new Pen(Brushes.Black,ToPoints(lnwid));
|
||||
#if DEBUG
|
||||
@@ -357,7 +357,7 @@ public class VG_Arc : VG
|
||||
// c1pdf.DrawRectangle(pn,rc); //debug
|
||||
|
||||
// c1pdf.DrawArc(new Pen(Color.Black,ToPoints(lnwid)),new RectangleF(stX,stY,rWid,rHgt),startAngle,sweepAngle);
|
||||
c1pdf.DrawArc(pn,rc,startAngle,sweepAngle);
|
||||
pdf.DrawArc(pn,rc,startAngle,sweepAngle);
|
||||
// c1pdf.DrawArc(new Pen(Color.Black, 4),rc,startAngle,sweepAngle);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user