/// <summary> /// Adjusts the y position to the next row based on the current layout /// respecting the horizontal centering option /// </summary> /// <param name="zRowExporter"></param> /// <param name="nNextExportIndex">The next index of the item to be exported (0-X counter)</param> private void MoveToNextRow(PdfRowExporter zRowExporter, int nNextExportIndex) { zRowExporter.SetupNewRowXPosition(nNextExportIndex); m_zExportData.DrawY += m_zExportData.NextRowYAdjust; // reset the row adjust to be that of the current layout #warning (this likely happens more often than needed, should only apply on layout changes) m_zExportData.NextRowYAdjust = m_zExportData.LayoutPointHeight + m_zExportData.BufferY; }
/// <summary> /// Adds a new page to the PDF based on the current configuration /// </summary> /// <param name="zRowExporter">The row exporter to setup the x position with</param> /// <param name="nNextExportIndex">Will be used to setup the x position</param> private void AddPage(PdfRowExporter zRowExporter, int nNextExportIndex) { m_zCurrentPage = m_zDocument.AddPage(); UpdatePageSize(); m_zCurrentPage.Orientation = m_ePageOrientation; m_zPageGfx = XGraphics.FromPdfPage(m_zCurrentPage); m_zExportData.DrawY = m_zExportData.PageMarginY; zRowExporter.SetupNewRowXPosition(nNextExportIndex); m_zExportData.NextRowYAdjust = m_zExportData.LayoutPointHeight + m_zExportData.BufferY; }
/// <summary> /// Evaluates the position based on the next layout draw to determine if the draw point should be moved /// to the next row/page. This respects the horizontal centering option when adding a new page. /// </summary> /// <param name="nNextExportIndex">The next index of the item to be exported (0-X counter)</param> private void EvaluateDrawLocation(int nNextExportIndex, PdfRowExporter zRowExporter) { #warning TODO this should probably error or at least warn on truncation (if the object simply won't fit horizontally) if (zRowExporter.IsRowFull()) { MoveToNextRow(zRowExporter, nNextExportIndex); } // if the draw will extend beyond the bottom margin start a new page if (m_zExportData.DrawY + m_zExportData.LayoutPointHeight > m_zExportData.PageMarginEndY) { AddPage(zRowExporter, nNextExportIndex); } }