TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Adhikar Patil
NA
481
128.4k
How to Get As it is Certificate in C#
May 4 2018 6:02 AM
Hi,
This is My Aspx code and below is my c# code i am getting certificate but it comes with design issues. the images in certificate not coming in proper formats.
<
asp:Panel
ID
=
"pnlCertificate"
runat
=
"server"
>
<
div
style
=
"width: 1170px; padding-right:15px; padding-left:15px; margin-right:auto; margin-left:auto"
>
<
div
class
=
"col-lg-12 margintop10"
style
=
"margin-top: 10px; width: 100%; height:auto"
>
<
div
class
=
"col-lg-3"
style
=
"width: 25%"
>
</
div
>
<
div
id
=
"divPanel"
runat
=
"server"
class
=
"col-lg-5"
style
="font-family: Times New Roman;
font-style: italic; font-size: 17px; width: 41.66666667%;"
>
<
%--
<
div
class
=
""
>
--%
>
<
div
class
=
"bg-white margintop10 fulldiv"
style
=
"background-color: White; margin-top: 10px; width: 100%"
>
<
div
class
=
"text-center"
style
=
"text-align: center;width: 100%; "
>
<
center
>
<
img
src
=
"http://tallyelearning.com/Student/Images/1.jpg"
width
=
"100%"
alt
=
"img"
/>
</
center
>
</
div
>
<
div
class
=
"text-center"
style
=
"text-align: center;width: 100%"
>
This certificate is proudly presented to
</
div
>
<
div
class
=
"text-center margin-bottom10"
style
=
"text-align: center; margin-bottom: 10px;width: 100%"
>
<
asp:Label
ID
=
"lblName"
runat
=
"server"
Font-Bold
=
"true"
Font-Size
=
"22px"
CssClass
=
"firebricktext text-capitalize"
style
=
"text-transform:capitalize; color:firebrick;"
>
</
asp:Label
>
</
div
>
<
div
class
=
"text-center margin-bottom10 margintop10"
style
=
"text-align: center; margin-bottom: 10px; margin-top:10px;width: 100%"
>
Successfully completed in
<
br
/>
<
asp:Label
ID
=
"lblCourseName"
CssClass
=
"text-capitalize"
runat
=
"server"
Font-Bold
=
"true"
style
=
"text-transform:capitalize"
Font-Size
=
"22px"
>
</
asp:Label
>
</
div
>
<
div
class
=
"text-center margintop10"
style
=
"text-align: center; margin-top: 10px; width: 100%"
>
<
span
>
At Authorized training center
</
span
>
</
div
>
<
div
class
=
"text-center margin-bottom10"
style
=
"text-align: center; margin-bottom: 10px; width: 100%"
>
<
asp:Label
ID
=
"lblTrainingCenter"
CssClass
=
"text-capitalize"
style
=
"text-transform:capitalize"
runat
=
"server"
Font-Bold
=
"true"
>
</
asp:Label
>
</
div
>
<
div
class
=
"text-center margin-bottom10 margintop10"
style
=
"text-align: center; margin-bottom: 10px; margin-top:10px;width: 100%"
>
<
label
>
He/She has awarded this certificate for distinctive
<
br
/>
performance in this programme
</
label
>
</
div
>
<
div
style
=
"margin-top: 30px; margin-bottom: -71px; float: left; width: 100%"
>
<
div
class
=
"margin-bottom10 margintop10"
style
=
"margin-bottom: 10px; margin-top:10px;width: 100%"
>
<
div
class
=
"col-lg-6"
style
=
"width:50%"
>
Grade :
<
asp:Label
ID
=
"lblGrade"
runat
=
"server"
>
</
asp:Label
>
</
div
>
<
div
class
=
"col-lg-6 pull-right"
style
=
"width:50%; float:right"
>
Date of Issue :
<
asp:Label
ID
=
"lblDateofIssue"
runat
=
"server"
>
</
asp:Label
>
</
div
>
</
div
>
<
div
class
=
"margin-bottom10 margintop10 fulldiv pull-left"
style
=
"margin-bottom: 10px; margin-top:10px; width:100%; float:left"
>
<
div
class
=
"col-lg-10"
style
=
"width: 83.33333333%"
>
Certificate No :
<
asp:Label
ID
=
"lblCertificateNo"
runat
=
"server"
Font-Size
=
"18px"
>
</
asp:Label
>
</
div
>
<
div
class
=
"col-lg-1"
style
=
"width: 8.33333333%"
>
</
div
>
</
div
>
</
div
>
<
div
class
=
"text-center"
style
=
"text-align:center"
>
<
img
src
=
"http://tallyelearning.com/Student/Images/21.jpg"
width
=
"100%"
alt
=
"img1"
/>
</
div
>
</
div
>
<
%--
</
div
>
--%
>
<
%--
</
asp:Panel
>
--%
>
</
div
>
<
div
class
=
"col-lg-4"
style
=
"width: 33.33333333%"
>
</
div
>
<
div
class
=
"col-lg-12 margintop10"
>
<
div
class
=
"col-lg-2"
>
</
div
>
<
div
class
=
"col-lg-7 text-center"
>
<
asp:LinkButton
ID
=
"lnkPrintPDF"
OnClick
=
"lnkPrintPDF_Click"
runat
=
"server"
CssClass
=
"btn btn-theme"
Visible
=
"false"
>
Print PDF
</
asp:LinkButton
>
<
%--
<
asp:LinkButton
ID
=
"lnkPrintPDF"
OnClick
=
"lnkPrintPDF_Click"
runat
=
"server"
CssClass
=
"btn btn-theme"
Visible
=
"false"
OnClientClick
=
"printDiv('divPanel')"
>
Print PDF
</
asp:LinkButton
>
--%
>
</
div
>
<
div
class
=
"col-lg-3"
>
</
div
>
</
div
>
</
div
>
</
div
>
</
asp:Panel
>
public
void
DisplayCertificate()
{
int
year = Convert.ToInt32(DateTime.Now.Year.ToString().Substring(2, 2));
int
nextyear = year + 1;
string
CertificateNo =
"PMT"
+
"/"
+ 000 +
"/"
+ year +
"-"
+ nextyear;
lblName.Text =
"Adhikar"
+
" "
+
"Patil"
;
lblCourseName.Text =
"Tally.ERP 9 With GST"
;
lblTrainingCenter.Text =
"Prompt Computer, Dhule"
;
lblDateofIssue.Text = System.DateTime.Now.ToString(
"dd/MM/yyyy"
);
lblCertificateNo.Text = CertificateNo;
lblGrade.Text =
"A"
;
}
protected
void
lnkPrintPDF_Click(Object sender, EventArgs e)
{
//SendHTMLAttachment();
Response.ContentType =
"application/pdf"
;
Response.AddHeader(
"content-disposition"
,
"attachment;filename=TallyCertificate.pdf"
);
Response.Cache.SetCacheability(HttpCacheability.NoCache);
divPanel.Visible =
true
;
StringWriter stringWriter =
new
StringWriter();
HtmlTextWriter htmlTextWriter =
new
HtmlTextWriter(stringWriter);
divPanel.RenderControl(htmlTextWriter);
using
(MemoryStream ms =
new
MemoryStream())
{
StringReader stringReader =
new
StringReader(stringWriter.ToString());
Document Doc =
new
Document(PageSize.A4, 25, 25, 30, 30);
//Document Doc = new Document(PageSize.A4, 10f, 10f, 100f, 0f);
HTMLWorker htmlparser =
new
HTMLWorker(Doc);
PdfWriter.GetInstance(Doc, Response.OutputStream);
Doc.Open();
htmlparser.Parse(stringReader);
Doc.Close();
Response.Write(Doc);
Response.OutputStream.Write(ms.GetBuffer(), 0, ms.GetBuffer().Length);
Response.End();
}
Reply
Answers (
1
)
[C#] How to select to report by day, month and year ???
How to get the least value in a row (Table row).