Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
2
Reply
How Save Many PDF file in the Same Physical path
Savadamuthu Saravanan
Dec 21 2017 7:41 AM
165
Reply
Here is i am generated pdf code based on the order numbers,when save time only one order pdf document is stored,remaining orders are not save.In my Invoiceorders table i have 600 rows,how to save file order by order.
protected
void
btnPDF_Click(
object
sender, EventArgs e)
{
clsDBFunctions objDBFunc =
new
clsDBFunctions();
clsError objError =
new
clsError();
using
(OracleConnection conn = objDBFunc.GetODPConnection(
ref
objError))
{
OracleDataAdapter thisAdapter =
new
OracleDataAdapter(
"select * from ORD_NUMBER "
, conn);
DataSet DataSet =
new
DataSet();
thisAdapter.Fill(DataSet,
"ORD_NUMBER"
);
//foreach (DataRow theRow in DataSet.Tables["ORD_NUMBER"].Rows)
//{
for
(
int
i = 0; i <= DataSet.Tables[
"ORD_NUMBER"
].Rows.Count - 1; i++)
{
mStream =
new
MemoryStream();
pdfDoc =
new
Document(PageSize.A4);
// public Document(Rectangle pageSize, float marginLeft, float marginRight, float marginTop, float marginBottom);
writerPdf = PdfWriter.GetInstance(pdfDoc, mStream);
pdfDoc.SetPageSize(
new
iTextSharp.text.Rectangle(800f, 560f));
writerPdf.ViewerPreferences = PdfWriter.PageModeUseOutlines;
HeaderFooter PageEventFooter =
new
HeaderFooter();
PageEventFooter.StrCompid = strCompId;
PageEventFooter.StrSiteid = strSiteId;
PageEventFooter.StrOrderno = DataSet.Tables[0].Rows[i][
"ORDERNO"
].ToString();
//theRow["ORDERNO"].ToString();
writerPdf.PageEvent = PageEventFooter;
ClsPageNumberCh PageEventHandler =
new
ClsPageNumberCh();
writerPdf.PageEvent = PageEventHandler;
pdfDoc.Open();
string
OrdNo = DataSet.Tables[0].Rows[i][
"ORDERNO"
].ToString();
BindPDFDetail(OrdNo);
BindPDFCarrier(OrdNo);
BindPDFItem(OrdNo);
BindPDFRemarksDetail(OrdNo);
BindPageParagraph();
pdfDoc.Close();
byte
[] bytes = mStream.ToArray();
mStream.Close();
string
pdfPath = ConfigurationManager.AppSettings[
"pdfPath"
].ToString() +
"Invoice_Orders.pdf"
;
File.WriteAllBytes(pdfPath, mStream.ToArray());
}
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
2
)
Next Recommended Forum
change back color if gridView cells has empty.
How Create Web Application Setup File With SQL,IIS?