Added Page Count to Status
Fixed Hanging Indent logic for vlnParagraphs
This commit is contained in:
@@ -349,21 +349,33 @@ namespace Volian.Print.Library
|
||||
// Notes:
|
||||
// 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
|
||||
IRtfDocument rtfDoc2 = RtfInterpreterTool.BuildDoc(rtf.Replace("\x05", @"\f1 \u9999? \f0 "));
|
||||
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();
|
||||
}
|
||||
float chkW = CalculateHangingIndent(rtf);
|
||||
para.IndentationLeft = chkW;
|
||||
para.FirstLineIndent = -chkW;
|
||||
}
|
||||
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);
|
||||
protected float CalculateYOffset(float yPageStart, float yTopMargin)
|
||||
{
|
||||
|
Reference in New Issue
Block a user