English 中文(简体)
页: 1
原标题:asp.net itextsharp convert the file format files to PDF

When I tried to use the code to convert the file format files to PDF using itextsharp. The problem appears when converting texts written in Arabic. The result came without the written text in Arabic. I hope you to help me overcome the problems.

非常感谢

问题回答

这一进程摘要:

  • Wrap Paragraph objects in one of the two iText IElement classes that support Arabic text: PdfPCell and ColumnText.
  • Use a font that has Arabic glyphs.
  • Set the text run direction and alignment.

与此类似:

using (Document document = new Document()) {
  PdfWriter writer = PdfWriter.GetInstance(document, STREAM);
  document.Open();
  string arabicText = @"
iText ® هي المكتبة التي تسمح لك لخلق والتلاعب وثائق PDF. فإنه يتيح للمطورين تتطلع الى تعزيز شبكة الإنترنت وغيرها من التطبيقات مع دينامية الجيل ثيقة PDF و / أو تلاعب.      
  ";
  PdfPTable table = new PdfPTable(1);
  table.WidthPercentage = 100;
  PdfPCell cell = new PdfPCell();
  cell.Border = PdfPCell.NO_BORDER;
  cell.RunDirection = PdfWriter.RUN_DIRECTION_RTL;
  Font font = new Font(BaseFont.CreateFont(
    "c:/windows/fonts/arialuni.ttf",
    BaseFont.IDENTITY_H, BaseFont.EMBEDDED
  ));
  Paragraph p = new Paragraph(arabicText, font);
  p.Alignment = Element.ALIGN_LEFT;
  cell.AddElement(p);
  table.AddCell(cell);
  document.Add(table);
}

如果上述实例文本不好、不正确,或者两者兼有,则会发生争执。 我不得不使用谷歌翻译,因为我的母语是英语。





相关问题
How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Extract everything from PDF [closed]

Looking for solution to extract content from a PDF file (using console tool or a library). It will be used on server to produce on-line e-books from uploaded PDF files. Need to extract following ...

PDF compression How does Adobe do it?

This is a bit more of a fun question than a serious one, but how does the Adobe PDF format make documents so... portable? I just created a small Word document, 235kb in size, containing multiple ...

Exporting HTML Tables

How can I export an HTML table in my page as PDF and/or XLS? (preferably using JS (+jquery))

Using Java PDFBox library to write Russian PDF

I am using a Java library called PDFBox trying to write text to a PDF. It works perfect for English text, but when i tried to write Russian text inside the PDF the letters appeared so strange. It ...

HTML --> PDF with PHP [duplicate]

Possible Duplicate: Convert HTML + CSS to PDF with PHP? How can I convert an HTML page (via $cURL or something) to a PDF file?

Free way to convert PDF to XPS with C#

Are there any free tools that I can use to convert a PDF document into an XPS document? Although a nice programmatic API would be nice, I m not opposed to shelling out to a command line tool to do ...

PDF conversion service

I need to develop a service able to convert MS Office and Open Office documents to PDF. And the PDF`s also need to be commentable when opened in ADOBE Reader. I have used a piece of software from www....

热门标签