本文介绍了无法使用带有文本效果的itextsharp创建PDF.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨我有一个Web Projet,它必须具有创建PDF的功能.
我正在使用(尝试...)itextsharp库.
数据源是一个Ajax控件,即来自Codeplex的Ajax控件工具包中的htmleditor.该控件为我提供了一个xhtml字符串,这是我在itextsharp中使用的字符串.问题是我没有获得包含编辑器上所有使用过的效果的PDF(例如,版式,背景色等).另外,当我在文本中使用较大的尺寸时,有时会覆盖其他句子.
谢谢您的时间和帮助.
我很抱歉,很久没有用英语写.

HiI have a web projet which has to have the functionality to create PDF.
Im using (trying...) the itextsharp library.
The data source is an ajax control, htmleditor from the ajax control toolkit by codeplex. This control gives me a xhtml string, this is the string that I use in the itextsharp. The problem is that I don''t get a PDF with all the effects used on the editor (like typography, background color, etc.) Also when I use a bigger size in the text, sometimes it overwrites on other sentence.
Thank you for your time and help.
My apologies, a long time without writing in english.

Public Sub PDFCreation()
        Dim Document As Document = New Document()
        Dim ms As MemoryStream = New MemoryStream()
        Dim writer As PdfWriter = PdfWriter.GetInstance(Document, ms)
        Dim se As StringReader = New StringReader(Editor1.Content)
        Dim obj As HTMLWorker = New HTMLWorker(Document)
        Document.Open()
        obj.Parse(se)
        Document.Close()
        Response.Clear()
        Response.AddHeader("content-disposition","attachment; filename=report.pdf"
        Response.ContentType = "application/pdf"
        Response.Buffer = True
        Response.OutputStream.Write(ms.GetBuffer(), 0, ms.GetBuffer().Length)
        Response.OutputStream.Flush()
        Response.End()
    End Sub

推荐答案


这篇关于无法使用带有文本效果的itextsharp创建PDF.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-03 07:36