Added Page Count to Status
Fixed Hanging Indent logic for vlnParagraphs
This commit is contained in:
parent
cb355b71aa
commit
f7e805a745
@ -96,6 +96,10 @@ namespace Volian.Print.Library
|
|||||||
{
|
{
|
||||||
OnStatusChanged(this, new PromsPrintStatusArgs(myStatus, type));
|
OnStatusChanged(this, new PromsPrintStatusArgs(myStatus, type));
|
||||||
}
|
}
|
||||||
|
public void OnStatusChanged(string msg)
|
||||||
|
{
|
||||||
|
OnStatusChanged(this, new PromsPrintStatusArgs(msg, PromsPrinterStatusType.General));
|
||||||
|
}
|
||||||
private void OnStatusChanged(string myStatus, PromsPrinterStatusType type, int progress)
|
private void OnStatusChanged(string myStatus, PromsPrinterStatusType type, int progress)
|
||||||
{
|
{
|
||||||
OnStatusChanged(this, new PromsPrintStatusArgs(myStatus, type, progress));
|
OnStatusChanged(this, new PromsPrintStatusArgs(myStatus, type, progress));
|
||||||
@ -513,7 +517,7 @@ namespace Volian.Print.Library
|
|||||||
}
|
}
|
||||||
if (!mySection.IsStepSection) _MyHelper.PageBookmarks.Add((ItemInfo)mySection, ((mySection.DisplayNumber ?? "") == "" ? "" : mySection.DisplayNumber + " - ") + mySection.DisplayText, null);
|
if (!mySection.IsStepSection) _MyHelper.PageBookmarks.Add((ItemInfo)mySection, ((mySection.DisplayNumber ?? "") == "" ? "" : mySection.DisplayNumber + " - ") + mySection.DisplayText, null);
|
||||||
_MyHelper.MySection = mySection;
|
_MyHelper.MySection = mySection;
|
||||||
OnStatusChanged("After Set Svg", PromsPrinterStatusType.SetSVG);
|
//OnStatusChanged("After Set Svg", PromsPrinterStatusType.SetSVG);
|
||||||
}
|
}
|
||||||
// if this format uses phonelists, see if this section has one. We need to know the number
|
// if this format uses phonelists, see if this section has one. We need to know the number
|
||||||
//of lines to adjust the pagelength for pagination and printing.
|
//of lines to adjust the pagelength for pagination and printing.
|
||||||
|
@ -182,6 +182,7 @@ namespace Volian.Print.Library
|
|||||||
//}
|
//}
|
||||||
public override void OnEndPage(PdfWriter writer, iTextSharp.text.Document document)
|
public override void OnEndPage(PdfWriter writer, iTextSharp.text.Document document)
|
||||||
{
|
{
|
||||||
|
MyPromsPrinter.OnStatusChanged(string.Format("Page {0}", CurrentPageNumber+1));
|
||||||
bool onBlankPage = OnBlankPage;
|
bool onBlankPage = OnBlankPage;
|
||||||
if (OnBlankPage)
|
if (OnBlankPage)
|
||||||
{
|
{
|
||||||
|
@ -349,21 +349,33 @@ namespace Volian.Print.Library
|
|||||||
// Notes:
|
// Notes:
|
||||||
// A hard return will reset the chkW (indent width) back to zero.
|
// A hard return will reset the chkW (indent width) back to zero.
|
||||||
// We jump out of the processing loop after the first indent token is found and ignor any other ones
|
// We jump out of the processing loop after the first indent token is found and ignor any other ones
|
||||||
IRtfDocument rtfDoc2 = RtfInterpreterTool.BuildDoc(rtf.Replace("\x05", @"\f1 \u9999? \f0 "));
|
float chkW = CalculateHangingIndent(rtf);
|
||||||
Rtf2iTextSharp rtf2IText2 = new Rtf2iTextSharp(rtfDoc2);
|
|
||||||
iTextSharp.text.Paragraph para2 = rtf2IText2.Convert();
|
|
||||||
float chkW = 0;
|
|
||||||
foreach (Chunk chk in para2.Chunks)
|
|
||||||
{
|
|
||||||
if (chk.Content[0] == 9999) break;
|
|
||||||
if (chk.Content.Contains("\n")) chkW = 0; //hard return - reset chkW (indent start)
|
|
||||||
chkW += chk.GetWidthPoint();
|
|
||||||
}
|
|
||||||
para.IndentationLeft = chkW;
|
para.IndentationLeft = chkW;
|
||||||
para.FirstLineIndent = -chkW;
|
para.FirstLineIndent = -chkW;
|
||||||
}
|
}
|
||||||
return para;
|
return para;
|
||||||
}
|
}
|
||||||
|
public static float CalculateHangingIndent(string rtf)
|
||||||
|
{
|
||||||
|
float chkW=0;
|
||||||
|
IRtfDocument rtfDoc2 = RtfInterpreterTool.BuildDoc(rtf.Replace("\x05", @"\f1 \u9999? \f0 "));
|
||||||
|
Rtf2iTextSharp rtf2IText2 = new Rtf2iTextSharp(rtfDoc2);
|
||||||
|
iTextSharp.text.Paragraph para2 = rtf2IText2.Convert();
|
||||||
|
foreach (Chunk chk in para2.Chunks)
|
||||||
|
{
|
||||||
|
if (chk.Content[0] == 9999) break;
|
||||||
|
if (chk.Content.Contains("\u270f"))
|
||||||
|
{
|
||||||
|
int i = chk.Content.IndexOf('\u270F');
|
||||||
|
int n = chk.Content.Length;
|
||||||
|
chkW += chk.GetWidthPoint() * i / (n - i);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (chk.Content.Contains("\n")) chkW = 0; //hard return - reset chkW (indent start)
|
||||||
|
chkW += chk.GetWidthPoint();
|
||||||
|
}
|
||||||
|
return chkW;
|
||||||
|
}
|
||||||
public abstract float ToPdf(PdfContentByte cb, float yPageStart, ref float yTopMargin, ref float yBottomMargin);
|
public abstract float ToPdf(PdfContentByte cb, float yPageStart, ref float yTopMargin, ref float yBottomMargin);
|
||||||
protected float CalculateYOffset(float yPageStart, float yTopMargin)
|
protected float CalculateYOffset(float yPageStart, float yTopMargin)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user