Upgrading to 10.5 to 23.5 Aspose.PDF version. So many classes are not available

@asad.ali : We are Upgrading to 10.5 to 23.5 Aspose.PDF version. But we are facing so many issues. Please see the below code changes and let me know alternate class attributes. Pls dont give any document. we are in urge to complete the task for Mar release and help me to complete the tasks.

// Generator is not available
Aspose.pdf.Generator.pdf pdfObj = Aspose.pdf.Generator.PDF();

//Section is not available
Aspose.pdf.Generator.Section sectionObj = new Aspose.pdf.Generator.Section();

// MarginInfo is not available in Generator class
Aspose.pdf.Generator.MarginInfo marginInfo = new Aspose.pdf.Generator.MarginInfo();

//IsLandscape is not available
pdfObj.isLandscape = true;

// its not available
sectionObj = pdfObj.Sections.Add();

marginInfo.Top = 72;

sectionObj.PageInfo.Margin = marginInfo;

Second scenario:
//BindHTML is not available.we are getting htmlInput from another application and bind here. This is one scenario
pdfObj.BindHtml(htmlInput)

Third Scenario:
Page page = document.pages[1];

page.resources.Images.Add(imagestream);

//its not available GSave() method
page.Contents.Add(new Opeartor.GSave());

// DOM is not available
Aspose.pdf.DOM.Matrix matrixObj;

//its not available ConcatenateMatrix(), DO(), GRestore() methods
page.Contents.Add(new Opeartor.ConcatenateMatrix()), DO(), GRestore()

//its not available
Aspose.pdf.Generator.TextInfo headerInfo = new Aspose.pdf.Generator.TextInfo();
Below fields are not available
Aspose.pdf.Generator.Color ()
Aspose.pdf.Generator.Table()
Aspose.pdf.Generator.BorderInfo()
Aspose.pdf.Generator.Row
Aspose.pdf.Generator.Color
Aspose.pdf.Generator.VerticalAlignment
Aspose.pdf.Generator.AlignmentType.Left
Aspose.pdf.Generator.Image
Aspose.pdf.Generator.ImageFileType.Jpeg
Aspose.pdf.Generator.Text
Aspose.pdf.Generator.Segment
Aspose.pdf.Generator.HeaderFooter
Aspose.pdf.Generator.Cell
Aspose.pdf.Generator.ColumnAdjustmentType.AutoFitWindow
Aspose.pdf.Generator.FloatingBox
Aspose.pdf.Generator.BoxHorizontalPositioningTYpe.Page;
Aspose.pdf.Generator.BoxVerticalPositioningType.Page

@Amarsha

We are gathering details and will be getting back to you shortly.

Thanks for your response. If i get earliest response, i will be good.

@Amarsha

For the first scenario, below is the translated code w.r.t Aspose.Pdf DOM approach:

Aspose.Pdf.Document pdfObj = Aspose.Pdf.Document();
Aspose.Pdf.Page sectionObj = pdfObj.Pages.Add();
Aspose.Pdf.MarginInfo marginInfo = new Aspose.Pdf.MarginInfo();
marginInfo.Top = 72;
sectionObj.PageInfo.IsLandscape = true;
sectionObj = pdfObj.Pages.Add();
sectionObj.PageInfo.Margin = marginInfo;

For the second scenario:

// If you want to generate PDF directly form an input HTML
Aspose.Pdf.HtmlLoadOptions loadOptions = new HtmlLoadOptions();
Aspose.Pdf.Document doc = new Aspose.Pdf.Document("input.html", loadOptions);
doc.Save("output.pdf");

// If you have HTML String and you want to add it inside PDF Page just like text
Aspose.Pdf.Document pdfDocument = new Aspose.Pdf.Document();
Aspose.Pdf.Page page = pdfDocument.Pages.Add();
string html = @"<h1>This is Heading</h1>";
Aspose.Pdf.HtmlFragment htmlFragment = new Aspose.Pdf.HtmlFragment(html);
page.Paragraphs.Add(htmlFragment);
doc.Save("output.pdf");

For the 3rd scenario:

page.Contents.Add(new Aspose.Pdf.Operators.GSave());

// Set coordinates
int lowerLeftX = 100;
int lowerLeftY = 100;
int upperRightX = 200;
int upperRightY = 200;
Aspose.Pdf.Rectangle rectangle = new Aspose.Pdf.Rectangle(lowerLeftX, lowerLeftY, upperRightX, upperRightY);
Aspose.Pdf.Matrix matrix = new Aspose.Pdf.Matrix(new double[] { rectangle.URX - rectangle.LLX, 0, 0, rectangle.URY - rectangle.LLY, rectangle.LLX, rectangle.LLY });

// Using ConcatenateMatrix (concatenate matrix) operator: defines how image must be placed
page.Contents.Add(new Aspose.Pdf.Operators.ConcatenateMatrix(matrix));
XImage ximage = page.Resources.Images[page.Resources.Images.Count];
// Using Do operator: this operator draws image
page.Contents.Add(new Aspose.Pdf.Operators.Do(ximage.Name));
// Using GRestore operator: this operator restores graphics state
page.Contents.Add(new Aspose.Pdf.Operators.GRestore());

Aspose.Pdf.Text.TextState textInfo = new Aspose.Pdf.Text.TextState();

Please check below how other classes can be accessed:

            Aspose.Pdf.Color
Aspose.Pdf.Table()
Aspose.Pdf.BorderInfo()
Aspose.Pdf.Row
Aspose.Pdf.VerticalAlignment
Aspose.Pdf.VerticalAlignment.Top
Aspose.Pdf.Image
Aspose.Pdf.Image.FileType
Aspose.Pdf.Text.TextFragment
Aspose.Pdf.Text.TextSegment
Aspose.Pdf.HeaderFooter
Aspose.Pdf.Cell
Aspose.Pdf.Table.ColumnAdjustment
Aspose.Pdf.FloatingBox

Please note that you need to go through the API documentation as well as API References where you will be able to find almost everything related to the Classes and their usage. Some classes were completely removed and discontinued and their functionality was merge and given using other Classes. Please feel free to let us know in case you need further assistance.

Thanks for your great response. Its really helpful. I would like to get some more replace attributes. Can you please check those also ? I couldn’t find the proper attributes for each. Please check and provide your inputs. We are last week of release.
Aspose_Clarification.docx (13.4 KB)

@Amarsha

Please check below sample code snippets. We tried to cover all classes that you mentioned in the DOCX file and added comments for your better understanding.

Document doc = new Document();

Aspose.Pdf.Page page = doc.Pages.Add();

Aspose.Pdf.HeaderFooter header = new HeaderFooter();
Aspose.Pdf.HeaderFooter footer = new HeaderFooter();

page.Header = header;
page.Footer = footer;

foreach(Page pg in doc.Pages)
{
    if((pg.Number / 2) > 0)
    {
        // Odd pages
    }
    else
    {
        // even pages
    }

    // Use text stamp for watermark

    Aspose.Pdf.TextStamp textStamp = new TextStamp("Hello Watermark");
    textStamp.Opacity = 0.5;
    textStamp.Rotate = Rotation.on90;
    textStamp.Background = false;

    pg.AddStamp(textStamp);
}

Aspose.Pdf.Text.Font font = Aspose.Pdf.Text.FontRepository.FindFont("Courier");

TextFragment textFragment = new TextFragment("Sample Text");
textFragment.TextState.Font = font;
textFragment.TextState.ForegroundColor = Aspose.Pdf.Color.White;
textFragment.IsFirstParagraphInColumn = true; // Use text fragment instead of text segment e.g. TextFragment can contain different TextSegments.

Aspose.Pdf.Table table = new Aspose.Pdf.Table();
table.RepeatingRowsCount = 1; // First row will be repeated on subsequent pages
table.ColumnAdjustment = ColumnAdjustment.AutoFitToWindow; // It will auto fit to the page.
table.ColumnWidths = "60 40"; // If auto fit to window, you can set column widths. e.g. two columns with 60% and 40% widths resepctively

Aspose.Pdf.Cell cell = new Aspose.Pdf.Cell();
cell.Border = new BorderInfo(Aspose.Pdf.BorderSide.Top, 2f, Aspose.Pdf.Color.Black); // cell border

Aspose.Pdf.Row row = table.Rows.Add();
row.IsRowBroken = true; // broken row
row.DefaultCellTextState.BackgroundColor = Aspose.Pdf.Color.Gray; // Row background color

Aspose.Pdf.Image imge = new Aspose.Pdf.Image();
imge.FileType = ImageFileType.Unknown; // select unknow for undefined types because it will store as stream inside PDF.

Thanks Asad. Its great help from you. I have completed the code changes. Going to start the testing. Very Thanks.

@Amarsha

Thanks for the feedback. Please feel free to let us know in case you need further assistance.