Display only two column in a single row using Ul Li tag in html

Hi Team,


Can i render my below html string to Aspose.pdf page paragraph.
Need to display on 70 records in every page. I have 500
  • item inside
      tag.
    • 1. Aasia Pty Ltd

    • In every pdf page only two columns need to be dispaly like :

      1. Test one 2. Test two
      3. Test threee 4. Test four
      5. Test five 6. Test six

      Aspose.Pdf.Page page = pdPdf.Pages.Add();
      page.SetPageSize(PageSize.A4Width, PageSize.A4Height);
      TextFragment text = new TextFragment(“Participants List”);
      text.TextState.ApplyChangesFrom(new TextState() { FontStyle = FontStyles.Bold, FontSize = 8F });
      text.Margin = new Aspose.Pdf.MarginInfo() { Left = 0, Top = 10 };
      page.Paragraphs.Add(text);
      if (participantsInfo != null)
      {
      // participantsInfo is containing UL > Li data for pdf pages.

      String htmlData = GetHtmlParticipant(participantsInfo);
      Aspose.Pdf.HtmlFragment textPList = new Aspose.Pdf.HtmlFragment(htmlData);
      textPList.HorizontalAlignment = Aspose.Pdf.HorizontalAlignment.Left;
      page.Paragraphs.Add(textPList);
      }

      but not able to render the same html in pdf page. please suggest.
      Regards,
      Uttam Mishra

      Hi Uttam,


      Thanks for using our API’s.

      The legacy Aspose.Pdf.Generator provides the capability to create PDF documents from scratch and I am afraid it does not support the feature to manipulate existing PDF documents. In order to accomplish your requirements, please try using Document object of Aspose.Pdf namespace. For further details, please visit Concatenate PDF Files

      Hi Team,


      I am using below code:
      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;
      }

      Hi Uttam,


      Thanks for your feedback. As suggested above please use new generator(Aspose.Pdf). You may create PDF documents form each byte array and combine these documents into a single PDF document.

      Please note old generator will be obsolete in near future, so we are not fixing issues or improvement in old generator. There is no big change in terms of object naming in old generator and new generator, Document() object is alternative of Pdf() and Page() object is replacement of Section(). However if you face any issue in this course of migrating your code to new generator then please feel free to contact us.

      We are sorry for the inconvenience.

      Best Regards,

      Hi Team,


      I have resolved my query regarding merging pdf files in a single pdf file. Now only one issue is coming with my newly created pdf file using Aspose.pdf.Document. I am not able to create a background image using below code for page number one only

      MemoryStream dataCentreStream = new MemoryStream(dashBoardPDFBytes);// Reading data from memory Stream.
      pdfDocument = new Aspose.Pdf.Document(dataCentreStream);

      // Added new static pdf page for Cover image - Start
      Aspose.Pdf.Page page = pdfDocument.Pages.Insert(1);// added new page
      //create cover Image for first page (Not able to add background Image in created new page in pdf )

      Aspose.Pdf.Text.TextFragment textFragmentCover = new Aspose.Pdf.Text.TextFragment(“Page with Cover Image”);
      Aspose.Pdf.Text.TextBuilder textBuilderCoverImage = new Aspose.Pdf.Text.TextBuilder(page);
      textFragmentCover.Position = new Aspose.Pdf.Text.Position(100, 200);
      textBuilderCoverImage = new Aspose.Pdf.Text.TextBuilder(page);
      textBuilderCoverImage.AppendText(textFragmentCover);

      Hi Uttam,


      Thanks for sharing the details.

      I have tested the scenario using one of my sample PDF files and as per my observations, the Text string is properly being added. However in order to add image stamp, please try using code snippet shared over Adding Image Stamp in PDF File.

      In case you still face any issue, please share some sample project so that we can further look into this matter.