Centering Logo and Heading

Hi,

How to Centered the Logo of the pdf document. below the logo how to set title of the pdf document.

Please suggest us how to done this. This is very urgent for us.

Thanks,
Veeru1.

Hello Veeru,

Please try using the following code snippet.

[C#]

//Instantiate PDF instance by calling empty constructor
Pdf pdfConv = new Pdf();
//Create a section in the pdf document
Aspose.Pdf.Section sec1 = pdfConv.Sections.Add();

//Instantiate a table object
Aspose.Pdf.Table tab1 = new Aspose.Pdf.Table();
//Add the table in paragraphs collection of the desired section
sec1.Paragraphs.Add(tab1);
// Set the horizontal aligment of the table as Center
tab1.Alignment = Aspose.Pdf.AlignmentType.Center;
tab1.VerticalAlignment = Aspose.Pdf.VerticalAlignmentType.Center;

// set the Top margin value
tab1.Margin.Top = 250;
//Set with column widths of the table
tab1.ColumnWidths = "300";

Aspose.Pdf.Image img = new Aspose.Pdf.Image();
img.ImageInfo.File = @"D:\pdftest\Aspose.jpg";
img.ImageInfo.ImageFileType = ImageFileType.Jpeg;

//Create rows in the table and then cells in the rows
Aspose.Pdf.Row FirstRow = tab1.Rows.Add();
// Add the cell which holds the image
Aspose.Pdf.Cell ImageCell = FirstRow.Cells.Add();
//Add the image to the table cell
ImageCell.Paragraphs.Add(img);
// set the horizontal alignment as center
ImageCell.Alignment = Aspose.Pdf.AlignmentType.Center;

//Create rows in the table and then cells in the rows
Aspose.Pdf.Row SecondRow = tab1.Rows.Add();
SecondRow.Cells.Add("Title Of Document");
SecondRow.Cells[0].Alignment = Aspose.Pdf.AlignmentType.Center;

//Save the Pdf
pdfConv.Save("d:\\pdftest\\Image_Text_InPDF.pdf");

For your reference, I have also attached the resultant PDF document. Please take a look.