Added logic to eliminate WordWrap differences that occur due to 16-Bit issues where the last line in a paragraph wraps at one character wider than the rest of the paragraph. For 32-bit this is only done when printing in Debug mode.
Add PromsPrinter to constructor for VlnPageHelper
This commit is contained in:
parent
b0a8ee1625
commit
3b54c091c9
@ -408,9 +408,16 @@ namespace Volian.Print.Library
|
||||
vcb.YChangeBarBottomExtend >= (cb.YChangeBarBottomExtend - vlnPrintObject.SixLinesPerInch)) return true;
|
||||
return false;
|
||||
}
|
||||
public VlnSvgPageHelper(VEPROMS.CSLA.Library.SectionInfo mySection) : base()
|
||||
private PromsPrinter _MyPromsPrinter;
|
||||
public PromsPrinter MyPromsPrinter
|
||||
{
|
||||
get { return _MyPromsPrinter; }
|
||||
set { _MyPromsPrinter = value; }
|
||||
}
|
||||
public VlnSvgPageHelper(VEPROMS.CSLA.Library.SectionInfo mySection,PromsPrinter myPromsPrinter) : base()
|
||||
{
|
||||
MySection = mySection;
|
||||
MyPromsPrinter = myPromsPrinter;
|
||||
}
|
||||
private Volian.Svg.Library.Svg BuildSvg(VEPROMS.CSLA.Library.SectionInfo mySection)
|
||||
{
|
||||
|
@ -112,6 +112,41 @@ namespace Volian.Print.Library
|
||||
return GetParagraphHeight(cb, iParagraph, width, true);
|
||||
}
|
||||
public static float GetParagraphHeight(PdfContentByte cb, Paragraph iParagraph, float width, bool throwException)
|
||||
{
|
||||
VlnSvgPageHelper ph = null;
|
||||
if(cb != null) ph = cb.PdfWriter.PageEvent as VlnSvgPageHelper;
|
||||
float heightAll = GetHeight(cb, iParagraph, width, throwException);
|
||||
if (ph != null && ph.MyPromsPrinter.DebugOutput)
|
||||
{
|
||||
Chunk chk = RemoveLastCharacter(iParagraph);
|
||||
float heightAllButOne = GetHeight(cb, iParagraph, width, throwException);
|
||||
if (heightAll != heightAllButOne)
|
||||
return heightAllButOne;
|
||||
if (chk != null)
|
||||
RestoreLastCharacter(iParagraph, chk);
|
||||
}
|
||||
return heightAll;
|
||||
}
|
||||
private static void RestoreLastCharacter(Paragraph iParagraph, Chunk chk)
|
||||
{
|
||||
iParagraph.RemoveAt(iParagraph.Count - 1);
|
||||
iParagraph.Add(chk);
|
||||
}
|
||||
private static Chunk RemoveLastCharacter(Paragraph iParagraph)
|
||||
{
|
||||
if (iParagraph.Count == 0)
|
||||
return null;
|
||||
object obj = iParagraph[iParagraph.Count-1];
|
||||
Chunk chk = obj as Chunk;
|
||||
if (chk == null)
|
||||
Console.WriteLine("Here");
|
||||
iParagraph.RemoveAt(iParagraph.Count - 1);
|
||||
string s = chk.Content;
|
||||
s = s.Substring(0,s.Length - 1);
|
||||
iParagraph.Add(new Chunk(s,chk.Font));
|
||||
return chk;
|
||||
}
|
||||
private static float GetHeight(PdfContentByte cb, Paragraph iParagraph, float width, bool throwException)
|
||||
{
|
||||
ColumnText myColumnText = new ColumnText(cb);
|
||||
myColumnText.SetSimpleColumn(0, 792F, width, 0); // Bottom margin
|
||||
|
Loading…
x
Reference in New Issue
Block a user