public void PrintCombinedWidget(byte[] imageBytes, IEnumerable widgetDetails, byte[] dataCentreByte)
{
int i = 0;
Aspose.Pdf.Generator.Sections sec1 = AddCombinedNewSection();
#region ForEach section code is working and printing in pdf pages
foreach (var widget in widgetDetails)
{
ExportDashboard pdfExport = new ExportDashboard(Db);
i = i + 1;
sec1[0].IsNewPage = true;
SurveyName = widget.SurveyName;
EffectiveDate = widget.EffectiveDate; // getting survey effective date
surveyId = widget.SurveyId;
pdfExport.CreateHtmlGraphChart(widget, sec1[0]);
var tblBreakPage = new Table();
sec1[0].Paragraphs.Add(tblBreakPage);
if (i < widgetDetails.Count())
{
var rowBreak = tblBreakPage.Rows.Add();
rowBreak.FixedRowHeight = 0;
rowBreak.IsInNewPage = true;
}
}
#region ForEach section code is working and printing in pdf pages
#region Below code not working when i am trying to use another section with byte array data to print in pdf document
sec1[3].IsNewPage = true;
CreateDataCentrePdf(dataCentreByte, sec1[3]);
var tblHeatmapBreakPage = new Table();
sec1[3].Paragraphs.Add(tblHeatmapBreakPage);
var heading1 = new Heading(pdPdf, sec1[3], 2);
var segment1 = new Segment(“My position to market”);
segment1.TextInfo.FontName = “Arial”;
segment1.TextInfo.FontSize = 12;
heading1.Segments.Add(segment1);
heading1.IsAutoSequence = false;
sec1[3].Paragraphs.Add(heading1);
#region Below code not working when i am trying to use another section with byte array data to print in pdf document
#region below code is printing in pdf pages
sec1[2].IsNewPage = true;
Text textPage1 = new Text(“Text content on section 3”);
textPage1.IsHtmlTagSupported = true;
sec1[2].Paragraphs.Add(textPage1);
#region below code is printing in pdf pages
}
public void CreateDataCentrePdf(byte[] imageBytes, Section section)
{
Aspose.Pdf.SvgLoadOptions loadOpt = new Aspose.Pdf.SvgLoadOptions();
loadOpt.ConversionEngine = Aspose.Pdf.SvgLoadOptions.ConversionEngines.NewEngine;
MemoryStream svgStream = new MemoryStream(imageBytes);
pdPdf1 = new Aspose.Pdf.Document(svgStream, loadOpt);
svgStream.Close();
}
private Sections AddCombinedNewSection()
{
pdCombinedPdf = new Pdf();
Section section = pdCombinedPdf.Sections.Add();
section.PageInfo.PageWidth = PageSize.A4Width;
section.PageInfo.PageHeight = PageSize.A4Height;
section.PageInfo.Margin = new MarginInfo() { Top = 80, Bottom = 72, Left = 54, Right = 54 };
// OF; 01/07/2016; Task#207708-add a new section for heatmap with landscape format
Section section1 = pdCombinedPdf.Sections.Add();
section1.PageInfo.PageWidth = PageSize.A4Width;
section1.PageInfo.PageHeight = PageSize.A4Height;
section1.PageInfo.Margin = new MarginInfo() { Top = 80, Bottom = 72, Left = 54, Right = 54 };
section1.IsLandscape = true;
Section section2 = pdCombinedPdf.Sections.Add();
section2.PageInfo.PageWidth = PageSize.A4Width;
section2.PageInfo.PageHeight = PageSize.A4Height;
section2.PageInfo.Margin = new MarginInfo() { Top = 80, Bottom = 72, Left = 54, Right = 54 };
Section section3 = pdCombinedPdf.Sections.Add();
section3.PageInfo.PageWidth = PageSize.A4Width;
section3.PageInfo.PageHeight = PageSize.A4Height;
section3.PageInfo.Margin = new MarginInfo() { Top = 80, Bottom = 72, Left = 54, Right = 54 };
Section section4 = pdCombinedPdf.Sections.Add();
section4.PageInfo.PageWidth = PageSize.A4Width;
section4.PageInfo.PageHeight = PageSize.A4Height;
section4.PageInfo.Margin = new MarginInfo() { Top = 80, Bottom = 72, Left = 54, Right = 54 };
Section section5 = pdCombinedPdf.Sections.Add();
section5.PageInfo.PageWidth = PageSize.A4Width;
section5.PageInfo.PageHeight = PageSize.A4Height;
section5.PageInfo.Margin = new MarginInfo() { Top = 80, Bottom = 72, Left = 54, Right = 54 };
return pdCombinedPdf.Sections;
}