使用iTextSharp的建立PDF时,生成PDF酒吧code [英] generate barcode in pdf when using itextsharp to build the pdf

查看:147
本文介绍了使用iTextSharp的建立PDF时,生成PDF酒吧code的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在麻烦的PDF生成酒吧code。我使用iTextSharp的生成PDF和我有一些从数据库togenerate这一点,我不熟悉吧$ C $ ... CS请帮我产生了吧code .....

i am in trouble with generating a barcode in pdf. i am using itextsharp to generate pdf and i have number from database togenerate this and i am not familiar with barcodes...please help me to generate the barcode.....

我用以下几部件code ..
     HttpContext.Current.Response.ContentType =应用程序/ PDF
    HttpContext.Current.Response.AddHeader(内容处置,附件;文件名= GridViewExport.pdf)
    HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache)

i used thefollowing code.. HttpContext.Current.Response.ContentType = "application/pdf" HttpContext.Current.Response.AddHeader("content-disposition", "attachment;filename=GridViewExport.pdf") HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache)

Dim pdfDoc As New Document()
PdfWriter.GetInstance(pdfDoc, HttpContext.Current.Response.OutputStream)

pdfDoc.Open()
'WRITE PDF <<<<<<

pdfDoc.Add(New Paragraph("My first PDF"))

'END WRITE PDF >>>>>
pdfDoc.Close()

HttpContext.Current.Response.Write(pdfDoc)
HttpContext.Current.Response.End()

问候,

Sivajith秒。

Sivajith S.

推荐答案

当你已经与iText的工作,为什么不使用iText的创建栏code。转到我的书的第10章的例子,看看<一个href=\"http://sourceforge.net/p/itextsharp/$c$c/HEAD/tree/book/iTextExamplesWeb/iTextExamplesWeb/iTextInAction2Ed/Chapter10/Bar$c$cs.cs\"相对=nofollow>酒吧codes.cs 的。这code的结果可以发现这里

As you're already working with iText, why not use iText to create the barcode. Go to the examples of chapter 10 of my book and look at Barcodes.cs. The result of this code can be found here.

这篇关于使用iTextSharp的建立PDF时,生成PDF酒吧code的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆