We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Migration from Aspose.Pdf 3.4.0.0 to Aspose.Pdf 17.7

Hello,

i’m working on a migration of a legacy application that uses Aspose.Pdf 3.4.0.0.
We want to migrate to .Net 4.6.2 and so need to update the Aspose.Pdf api.

My problem is that some namespace have diesappeared and i don’t know how i can achieve having the same result.

Exemple :
Aspose.Pdf.Pdf m_pdf = new Aspose.Pdf.Pdf();
Aspose.Pdf.Section section1 = m_pdf.Sections.Add();
Table tab = new Table();
tab.RepeatingRows = 2;

Aspose.Pdf.Row row9;
for (int i = 0; i < BAPCompteData.NbCrit ; i++)
{
row9 = new Aspose.Pdf.Row(tab1); // contsuctort with this parameter does not existe in Aspose.Pdf V17.7
row9.Cells.Add(BAPCompteData.Crit[i].CritWording,t1);
row9.FixedRowHeight = 12f;
tab.Rows.Add(row9);
tab.Rows[i+7].Cells[0].ColumnsSpan = 3;
}

TextInfo tinfo = new TextInfo();
tinfo.FontName = “Arial”;
tinfo.FontSize = 8f;

tinfo.Alignment = AlignmentType.Center;
tab.SetColumnTextInfo(0, tinfo0);
tab.SetColumnTextInfo(4, tinfo0);
tab.SetColumnTextInfo(7, tinfo0);
tab.DefaultCellTextInfo = tinfo;

HeaderFooter hf1 = new HeaderFooter(section1);
section1.OddHeader = section1.EvenHeader = hf1;
hf1.DistanceFromEdge = 35f;
hf1.Paragraphs.Add(tab1); // where tab1 is an Aspose.Pdf.Table

In this sample, I can’t find :

  • the types Aspose.Pdf.Pdf, Section, TextInfo
  • the constructor HeaderFooter and Aspose.Pdf.Row with a parameter
  • the properties DistanceFromEdge, RepeatingRows, DefaultCellTextInfo
  • the method SetColumnTextInfo

Please, can you help (save)) me ? Is it possible to “translate” this sample in a compatible code with Aspose.Pdf V17.7 ?

@didier.jacquart,
The old version 3.4.0.0 of Aspose.Pdf for .NET API has support of the old legacy approach, which has been removed from the Aspose.Pdf for .NET API. In order to better understand the difference between the new DOM approach and old legacy approach, please refer to these help topics:

  1. Introduction to the DOM API
  2. Introduction to DOM (legacy)

There is no section in the DOM (Document Object Model) approach, as the structure of a PDF file is hierarchical, Aspose.Pdf for .NET API also accesses the elements in the same way. You can insert text with TextFragment class and in order to insert a table, we have added the same Table, Cell and Row classes under the DOM approach. Please refer to the following help topics:

  1. Add Text in an Existing PDF File
  2. Add Table in Existing PDF Document
  3. Manage Header and Footer of PDF File

Please let us know in case of any further assistance or questions.

Best Regards,
Imran Rafique

Thanks you for this answer.
I will try to identify the correspondence between old and new Pdf elements, but it’s really hard.

@didier.jacquart,
The new DOM approach is simpler than the old legacy approach. Please do not be sticky to find the same API in the new DOM approach because only the API of common features could be same, and you can easily get the help of the new DOM approach from the Developer’s guide. We regularly enhance Aspose.Pdf for .NET API docs, so mostly you can search our docs, and let us know when the docs are not helpful in some scenario.

Best Regards,
Imran Rafique