Click here to Skip to main content
15,917,321 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
i am having a buton which is used to export to pdf file..its working perfectly the problem is have to display the currentdate on the pdf how is it possible.???
Posted

Paragraph paragraphs = new Paragraph(new Phrase(DateTime.Now.ToString()));
 pdfDoc.Add(new Paragraph(paragraphs));
 
Share this answer
 
v2
Comments
ravitv 23-Jun-21 8:10am    
Your code works great, but, how to format that date to dd/mmm/yyyy hh:mm:ss am/pm
and put it in the bottom of the pdf page just below the coordinates say...
DrawLine(writer, 25f, document.Top - 750f, document.PageSize.Width - 25f, document.Top - 750f, BaseColor.RED);
Use DateTime[^] to get todays date and draw it to the PDF. What PDF library are you using? PDFSharp?
 
Share this answer
 
Comments
ravitv 24-Jun-21 4:32am    
Sorry for the delayed reply, I am using itextsharp-5.5.13.2
The link you have given is an "ocean", All I need is to display "system date" in dd/mmm/yyyy and Page number/Total number of pages. at the bottom ot the pdf pages.
The code you have given works excellent but displays the date somewhat halfway - middle of the page.
Kindly help,
Thanks
Ravi

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900