Display imformation as a signature in PDF footer

Hello support,

I am generating PDF from HTML with dynamic content in which our requirenment is to display some important information which can be act as a stamp in dynamically generated PDF. currently we are using below code to achive the same.

FormattedText formattedText = new FormattedText("", System.Drawing.Color.Black, FontStyle.Unknown, EncodingType.Identity_h, false, 11);
formattedText.AddNewLineText(String.Format(“Initials:{0,-39} Name:{1,-60}”, myConfirmationFooterViewModel.Initials, myConfirmationFooterViewModel.Name));
formattedText.AddNewLineText(String.Format(“IP Address:{0,-30} Email Address:{1,-60}”, myConfirmationFooterViewModel.IPAddress, myConfirmationFooterViewModel.Email));
formattedText.AddNewLineText(String.Format(“Signed On:{0,-26} Document Id:{1,-60}”, Convert.ToDateTime(myConfirmationFooterViewModel.SignedOn).ToString(Constants.Constants.DefaultDatetimeFormat), myConfirmationFooterViewModel.DocumentId));
textStamp = new TextStamp(formattedText);

and then

foreach (var item in pageCollection)
{
item.SetPageSize(PageSize.PageLegal.Width, PageSize.PageLegal.Height);
item.AddStamp(textStamp);
}

It is working fine but we are not able to format properly as per our client’s requirment. we have attached image(client need.jpg)ClientNeed.jpg (15.8 KB) and current output is currentOutput.jpg (39.5 KB)

. can you please guide us how to achive output mentioned in clientneed screenshot.

Thanks in advance.

@vbhattsynoptek

The information in such formatting can be shown using tables. You can add a table in page footer using the below sample code snippet:

// Instantiate Document instance by calling empty constructor
Aspose.Pdf.Document pdfDocument = new Aspose.Pdf.Document();
// Create a page in the pdf document
Aspose.Pdf.Page page = pdfDocument.Pages.Add();

// Create a Header Section of the PDF file
Aspose.Pdf.HeaderFooter footer = new Aspose.Pdf.HeaderFooter();
// Set the Odd Header for the PDF file
page.Footer = footer;
// Set the top margin for the header section
footer.Margin.Top = 20;

// Instantiate a table object
Aspose.Pdf.Table tab1 = new Aspose.Pdf.Table();
// Add the table in paragraphs collection of the desired section
footer.Paragraphs.Add(tab1);
// Set default cell border using BorderInfo object
tab1.DefaultCellBorder = new Aspose.Pdf.BorderInfo(Aspose.Pdf.BorderSide.All, 0.1F);
tab1.HorizontalAlignment = HorizontalAlignment.Center;
// Set with column widths of the table
tab1.ColumnWidths = "100%";

// Create rows in the table and then cells in the rows
Aspose.Pdf.Row row1 = tab1.Rows.Add();

row1.Cells.Add("Table in Footer Section");
row1.BackgroundColor = Color.Gray;
// Set the row span value for first row as 2
tab1.Rows[0].Cells[0].Alignment = HorizontalAlignment.Center;
tab1.Rows[0].Cells[0].DefaultCellTextState.ForegroundColor = Color.Cyan;
tab1.Rows[0].Cells[0].DefaultCellTextState.Font = FontRepository.FindFont("Helvetica");

// Save the Pdf file
pdfDocument.Save(dataDir + "TableInFooterSection_out.pdf");

Thanks for quick response,

We have implemented above solution and it looks good except one issue. while implementing this solution we have obsrve that it is adding blank space on the top of each page. it looks like it is adding header in each and every page. we have also tried to set footer.Margin.Top =0 but it is not working.

Here we do not want to add any header in the pdf. just footer as a table. can you please guide us on the same?

thanks in advance.

@vbhattsynoptek

Can you please share complete sample code snippet for our reference? We will test the scenario in our environment and address it accordingly.

Hello @asad.ali,

thanks for quick response. please find working sample here with attachmentConsoleApp1.zip (1.3 MB)

We need your assistence for bello points.

  1. Make text italic in every page footer.
  2. Fonts should same used in other text.
  3. Increase/decreasing line spacing.
  4. increase/decrease width of 1st and 3rd column which is label for dynamuc text(Name,IP Address etc.)
  5. Remove blank spacing at the top of each pages.(as mentioned in ticket).

PDF is available for below location: ConsoleApp1\bin\Debug\net6.0\PageBorder.pdf)

Please let me know in case of futher details required.

Thanks in advance.

Can

@vbhattsynoptek

Sure, we will look into these requirements and investigate accordingly. Can you please share an expected output PDF for our reference as well?

Thanks for quick response. currently we dont have any excepted PDF available with us. for now we are sharing pdf with client and implement improvement suggested with client.

Kindly let us know in case of any other informatin required from our end.

Thanks

@vbhattsynoptek

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): PDFNET-55686

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

@asad.ali - Just wanted to know are you able to reproduce the issue with sample application provided?

it would be helpful if you can provide estimated ETA for the same.

Thanks,
Vishal

@vbhattsynoptek

We were able to notice the issue that you mentioned. However, this particular behavior of the API as well as your requirements need to be investigated in details. Therefore, a ticket has been logged in our internal issue tracking system. We will look into its details on a first come first serve basis and as soon as we have some updates about its resolution or fix ETA, we will share with you within this forum thread. Please be patient and spare us some time.

We apologize for the inconvenience.

Hello,

Any updates on above mentioned issue. It would be helpfull if you can provide estimated ETA so that we can communicate the same with our stakeholders.

Thanks in advance.

@vbhattsynoptek

We are afraid that the earlier logged ticket has not been yet resolved due to other pending issues in the queue. Nevertheless, we have recorded your concerns and as soon as we make certain progress towards ticket resolution, we will update you in this forum thread. Please be patient and spare us some time.

We are sorry for the inconvenience.

Hello @asad.ali ,

We understand that ticket is still open and awaiting action from your end. it would be helpful if you can provide tentitative plan to address the issue as it’s impacting our delivery schedule.

Thanks in advance.

@vbhattsynoptek

The ticket is currently under the phase of the investigation. Sadly, the analysis is not yet completed which is why we are unable to share any ETA or timeline for the issue fix. Nevertheless, as soon as we have some updates, we will share with you in this very forum thread. Please spare us some time. We are sorry for the inconvenience.