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
Savadamuthu Saravanan
NA
442
27.7k
How Save Many PDF file in the Same Physical path
Dec 21 2017 7:41 AM
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());
}
Reply
Answers (
2
)
change back color if gridView cells has empty.
How Create Web Application Setup File With SQL,IIS?