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
Obadiah Williams
NA
4
5.9k
Itext sharp error New file Path does not exist
Mar 5 2012 4:55 PM
Salutations,
I am new to itextsharp and encountered some issues that did not make much sense when I was tryin to trouble shoot.
First let me begin by saying I am taking over a project from a previous programmer, I cleaned up several errors and was able to narrow it down to this one. I am not sure why I am getting it. I called it using the proper name spaces
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.IO;
using System.Net.Mail;
using System.Text;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.XPath;
using iTextSharp;
using iTextSharp.text;
using iTextSharp.text.pdf;
using iTextSharp.text.xml;
private static string AppRelativePath = "~/path/2get.pdf";
private static string AppAbsolutePath = HttpContext.Current.Server.MapPath(AppRelativePath);
private Ektron.Cms.API.Content.Content cAPI = new Ektron.Cms.API.Content.Content();
private string GUID = string.Empty;
public string myGUID { get { return GUID; } set { GUID = value; } }
protected void ProcessApp(object sender, System.Web.UI.WebControls.WizardNavigationEventArgs e)
{
Page.Validate();
if (Page.IsValid)
{
string NewFileName = string.Empty;
char[] charLastName = txtLastName.Text.ToLower().ToCharArray();
foreach (char c in charLastName)
{
if (char.IsLetterOrDigit(c))
{
NewFileName = string.Concat(NewFileName, c);
}
}
int fileMatchCount = 0;
while (File.Exists(Server.MapPath("~/path/2outputpdf/" + NewFileName + ".pdf")))
{
if (NewFileName.EndsWith("(" + fileMatchCount.ToString() + ")"))
{
NewFileName = NewFileName.Substring(0, NewFileName.Length - 3);
fileMatchCount++;
}
NewFileName += "(" + fileMatchCount.ToString() + ")";
}
NewFileName += ".pdf";
string NewFilePath = Server.MapPath("~/path/2outputpdf/" + NewFileName);
}
try
{
PdfReader reader = new PdfReader(AppAbsolutePath);
PdfStamper stamper = new PdfStamper(reader, new FileStream(NewFilePath, FileMode.Create));
AcroFields fields = stamper.AcroFields;
yet i get the error CS0103: The name 'NewFilePath' does not exist in the current context...what is the deal?
Reply
Answers (
2
)
seesion code doubt
how to validate text box