Last post Jan 31, 2012 09:23 AM by srinanthuram
Member
4 Points
113 Posts
Jan 31, 2012 06:58 AM|ashish_ksharma1227|LINK
Dear Frds
I am trying to create PDF file from Existing File using ItextSharp.dll
I am trying to find a string "@subject" and replace this string to "00000"
My code is as but its not working..................................... also help me to find exact location(index ) of that string
string fileNameExisting = @"C:\Biddocument.pdf";
string fileNameNew = @"C:\new.pdf";
using (var existingFileStream = new FileStream(fileNameExisting, FileMode.Open))
using (var newFileStream = new FileStream(fileNameNew, FileMode.Create))
{
var pdfReader = new PdfReader(existingFileStream); PdfStamper pdfStamper = new PdfStamper(pdfReader,newFileStream);
pdfStamper.FormFlattening = true; // generate a flat PDF
AcroFields pdfForm = pdfStamper.AcroFields;
pdfForm.SetField("@subject", "00000");
pdfStamper.Close();
}
All-Star
78951 Points
16373 Posts
Jan 31, 2012 09:12 AM|ramiramilu|LINK
ashish_ksharma1227 I am trying to find a string "@subject" and replace this string to "00000"
if you want to find a string in a string, then there are many ways, you can use String.Replace() or else you can sue Regex to find the match and then replace...
http://www.dotnetperls.com/regex-replace
PS - if you question is related to specifically about ITextSharp please post your question in their forums...
Thanks,
Contributor
3925 Points
1420 Posts
Jan 31, 2012 09:23 AM|srinanthuram|LINK
hi
see this url
http://asp-net-example.blogspot.in/2009/01/how-to-replace-specified-substring-with.html
http://www.ezineasp.net/post/ASP-Net-C-sharp-Replace-String-Function.aspx
http://stackoverflow.com/questions/3726267/how-to-replace-special-character-from-string-in-asp-net
thank u
Member
4 Points
113 Posts
Find and Replace String using ItextSharp in asp.net C#
Jan 31, 2012 06:58 AM|ashish_ksharma1227|LINK
Dear Frds
I am trying to create PDF file from Existing File using ItextSharp.dll
I am trying to find a string "@subject" and replace this string to "00000"
My code is as but its not working..................................... also help me to find exact location(index ) of that string
string fileNameExisting = @"C:\Biddocument.pdf";
string fileNameNew = @"C:\new.pdf";
using (var existingFileStream = new FileStream(fileNameExisting, FileMode.Open))
using (var newFileStream = new FileStream(fileNameNew, FileMode.Create))
{
var pdfReader = new PdfReader(existingFileStream);
PdfStamper pdfStamper = new PdfStamper(pdfReader,newFileStream);
pdfStamper.FormFlattening = true; // generate a flat PDF
AcroFields pdfForm = pdfStamper.AcroFields;
pdfForm.SetField("@subject", "00000");
pdfStamper.Close();
}
All-Star
78951 Points
16373 Posts
Re: Find and Replace String using ItextSharp in asp.net C#
Jan 31, 2012 09:12 AM|ramiramilu|LINK
if you want to find a string in a string, then there are many ways, you can use String.Replace() or else you can sue Regex to find the match and then replace...
http://www.dotnetperls.com/regex-replace
PS - if you question is related to specifically about ITextSharp please post your question in their forums...
Thanks,
JumpStart
Contributor
3925 Points
1420 Posts
Re: Find and Replace String using ItextSharp in asp.net C#
Jan 31, 2012 09:23 AM|srinanthuram|LINK
hi
see this url
http://asp-net-example.blogspot.in/2009/01/how-to-replace-specified-substring-with.html
http://www.ezineasp.net/post/ASP-Net-C-sharp-Replace-String-Function.aspx
http://stackoverflow.com/questions/3726267/how-to-replace-special-character-from-string-in-asp-net
thank u