I want to create a pdf document using c#.net. it is created very successfully and display english text correctly but when i changed text into URDU, then it does not display any thing.
I am using "iTextSharp" library for creating PDF.
so can any body tell me that is it possible to create a pdf with urdu text.
No brother this is not what i am lookinf for. i have created PDF document. following is the code.
using System;
using System.Collections.Generic;
using System.Text;
using iTextSharp.text;
using iTextSharp.text.pdf;
using System.IO;
namespace CreatePDF
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("iText Demo");
// step 1: creation of a document-object
Document myDocument = new Document(PageSize.A4.Rotate());
try
{
// step 2:
// Now create a writer that listens to this doucment and writes the document to desired Stream.
PdfWriter.GetInstance(myDocument, new FileStream("Salman.pdf", FileMode.Create));
Phrase footPhraseImg = new Phrase("Page: ", FontFactory.GetFont(FontFactory.TIMES_ROMAN, 8, iTextSharp.text.Font.NORMAL));
// step 3: Open the document now using
myDocument.Open();
// step 4: Now add some contents to the document
myDocument.Add(new Paragraph("dfsdf"));
//میں پاکستان سے پیار کرتا ھوں
}
catch (DocumentException de)
{
Console.Error.WriteLine(de.Message);
}
catch (IOException ioe)
{
Console.Error.WriteLine(ioe.Message);
}
// step 5: Remember to close the documnet
myDocument.Close();
}
}
}
But when i write urdu in following line
myDocument.Add(new Paragraph("dfsdf"));
It creates pdf document but did not display any thing.
Thanks for your reply. yes it works but did not fullfil my requirement. i want to show urdu text in PDF. and when i write URDU in paragraph string it displays question marks. it did not render urdu font.
So is there anyyyyyyy way to display urdu text in PDF whily using c#.net.?????????
I have created the document in same way, but when trying to open it. The file shows the error message "There was an error opening this document. This file is already open or in use by another application."
i have properly close the document as "doc.Close();"
Member
2 Points
40 Posts
How to create PDF document with urdu text using c#.net
Jul 30, 2009 07:57 AM|sh_alibz|LINK
Hi all.
I want to create a pdf document using c#.net. it is created very successfully and display english text correctly but when i changed text into URDU, then it does not display any thing.
I am using "iTextSharp" library for creating PDF.
so can any body tell me that is it possible to create a pdf with urdu text.
Your quick response is highly appriciated.
Regards,
Ali bin zubair
Member
101 Points
88 Posts
Re: How to create PDF document with urdu text using c#.net
Jul 30, 2009 08:05 AM|Md Eqbal Ansari|LINK
Refer to the following Link.
http://forums.asp.net/p/1349626/2752650.aspx#2752650
May this help you...
Thanks & Best Regards,
Eqbal.
Please mark the post as answer, if you find this useful.
Member
2 Points
40 Posts
Re: How to create PDF document with urdu text using c#.net
Jul 30, 2009 08:20 AM|sh_alibz|LINK
Hi,
No brother this is not what i am lookinf for. i have created PDF document. following is the code.
using System;
using System.Collections.Generic;
using System.Text;
using iTextSharp.text;
using iTextSharp.text.pdf;
using System.IO;
namespace CreatePDF
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("iText Demo");
// step 1: creation of a document-object
Document myDocument = new Document(PageSize.A4.Rotate());
try
{
// step 2:
// Now create a writer that listens to this doucment and writes the document to desired Stream.
PdfWriter.GetInstance(myDocument, new FileStream("Salman.pdf", FileMode.Create));
Phrase footPhraseImg = new Phrase("Page: ", FontFactory.GetFont(FontFactory.TIMES_ROMAN, 8, iTextSharp.text.Font.NORMAL));
// step 3: Open the document now using
myDocument.Open();
// step 4: Now add some contents to the document
myDocument.Add(new Paragraph("dfsdf"));
//میں پاکستان سے پیار کرتا ھوں
}
catch (DocumentException de)
{
Console.Error.WriteLine(de.Message);
}
catch (IOException ioe)
{
Console.Error.WriteLine(ioe.Message);
}
// step 5: Remember to close the documnet
myDocument.Close();
}
}
}
But when i write urdu in following line
myDocument.Add(new Paragraph("dfsdf"));
It creates pdf document but did not display any thing.
So how can i display urdu in pdf using c#.net
Member
186 Points
87 Posts
Re: How to create PDF document with urdu text using c#.net
Jul 30, 2009 11:16 PM|lszk|LINK
Maybe try to set the font with urdu letters manually. For example for polish letters:
Member
2 Points
40 Posts
Re: How to create PDF document with urdu text using c#.net
Jul 31, 2009 01:23 AM|sh_alibz|LINK
Thanks for your reply. yes it works but did not fullfil my requirement. i want to show urdu text in PDF. and when i write URDU in paragraph string it displays question marks. it did not render urdu font.
So is there anyyyyyyy way to display urdu text in PDF whily using c#.net.?????????
None
0 Points
1 Post
Re: How to create PDF document with urdu text using c#.net
Mar 25, 2010 05:42 AM|Mairy|LINK
I have created the document in same way, but when trying to open it. The file shows the error message "There was an error opening this document. This file is already open or in use by another application."
i have properly close the document as "doc.Close();"
.Net asp.net 2.0
Member
2 Points
40 Posts
Re: How to create PDF document with urdu text using c#.net
Apr 06, 2010 03:48 AM|sh_alibz|LINK
Hi..
Try to kill your process in Task manager. Might be you close properly but windows did not close process completely.