本文整理匯總了C#中iTextSharp.text.pdf.PdfDocument.IsMarginMirroring方法的典型用法代碼示例。如果您正苦於以下問題:C# PdfDocument.IsMarginMirroring方法的具體用法?C# PdfDocument.IsMarginMirroring怎麽用?C# PdfDocument.IsMarginMirroring使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類iTextSharp.text.pdf.PdfDocument
的用法示例。
在下文中一共展示了PdfDocument.IsMarginMirroring方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Write
/**
* Write out the columns. After writing, use
* {@link #isOverflow()} to see if all text was written.
* @param canvas PdfContentByte to write with
* @param document document to write to (only used to get page limit info)
* @param documentY starting y position to begin writing at
* @return the current height (y position) after writing the columns
* @throws DocumentException on error
*/
public float Write(PdfContentByte canvas, PdfDocument document, float documentY)
{
this.document = document;
columnText.Canvas = canvas;
if (columnDefs.Count == 0) {
throw new DocumentException(MessageLocalization.GetComposedMessage("multicolumntext.has.no.columns"));
}
overflow = false;
float currentHeight = 0;
bool done = false;
while (!done) {
if (top == AUTOMATIC) {
top = document.GetVerticalPosition(true);
}
else if (nextY == AUTOMATIC) {
nextY = document.GetVerticalPosition(true); // RS - 07/07/2005 - - Get current doc writing position for top of columns on new page.
}
ColumnDef currentDef = columnDefs[CurrentColumn];
columnText.YLine = top;
float[] left = currentDef.ResolvePositions(Rectangle.LEFT_BORDER);
float[] right = currentDef.ResolvePositions(Rectangle.RIGHT_BORDER);
if (document.IsMarginMirroring() && document.PageNumber % 2 == 0){
float delta = document.RightMargin - document.Left;
left = (float[])left.Clone();
right = (float[])right.Clone();
for (int i = 0; i < left.Length; i += 2) {
left[i] -= delta;
}
for (int i = 0; i < right.Length; i += 2) {
right[i] -= delta;
}
}
currentHeight = Math.Max(currentHeight, GetHeight(left, right));
if (currentDef.IsSimple()) {
columnText.SetSimpleColumn(left[2], left[3], right[0], right[1]);
} else {
columnText.SetColumns(left, right);
}
int result = columnText.Go();
if ((result & ColumnText.NO_MORE_TEXT) != 0) {
done = true;
top = columnText.YLine;
} else if (ShiftCurrentColumn()) {
top = nextY;
} else { // check if we are done because of height
totalHeight += currentHeight;
if ((desiredHeight != AUTOMATIC) && (totalHeight >= desiredHeight)) {
overflow = true;
break;
} else { // need to start new page and reset the columns
documentY = nextY;
NewPage();
currentHeight = 0;
}
}
}
if (desiredHeight == AUTOMATIC && columnDefs.Count == 1) {
currentHeight = documentY - columnText.YLine;
}
return currentHeight;
}