如何对齐pdf文件中的文本 [英] How to Align text in pdf file

查看:122
本文介绍了如何对齐pdf文件中的文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

实际上我从表中获取数据,并且我将表值传递给pdf文件,每个东西都在工作5n。但是pdf中的文字没有正确对齐。如果需要我将粘贴我的代码...

Actually i am getting data from tables and i am passing that table values to pdf file every thing is working 5n. but the text in that pdf is not in proper alignment.if needed i will paste my code...

推荐答案

发送代码块。我不确定你如何传递值,更好的是创建一个格式化的HTML文档并查看其外观如何将该文档传递给PDF
Send you code block. I am not sure how you pass values, its better to create a formatted HTML doc & see how its look like then pass that document to PDF


Hii ..

见这一个。

Hii..
See this one.
Re sponse.ContentType = "application/pdf";
            Response.AddHeader("content-disposition", "attachment;filename=Panel.pdf");
            Response.Cache.SetCacheability(HttpCacheability.NoCache);
            StringWriter sw = new StringWriter();
            HtmlTextWriter hw = new HtmlTextWriter(sw);
            pnlPerson.RenderControl(hw);
            StringReader sr = new StringReader(sw.ToString());
            //Document pdfDoc = new Document(PageSize.A4, 10f, 10f, 100f, 0f);
            Document pdfDoc = new Document(PageSize.A3, 100f, 10f, 10f, 10f);
            HTMLWorker htmlparser = new HTMLWorker(pdfDoc);
            PdfWriter.GetInstance(pdfDoc, Response.OutputStream);
            pdfDoc.Open();
//adding Header
            string Header = @"Header Text";
            Paragraph para = new Paragraph(Header);
            para.Alignment = Element.ALIGN_CENTER;
            pdfDoc.Add(para);
//cell11
            PdfPCell cell11 = new PdfPCell();
            cell11.AddElement(new Paragraph("Lable Name:"));
            table1.AddCell(cell11);
            PdfPCell cell12 = new PdfPCell();
            cell12.AddElement(new Paragraph(lbladhar.Text));
            table1.AddCell(cell12);

喜欢将你的pdf转换为表格格式。

谢谢你。

like convert ur pdf to table format.
thank u.


这篇关于如何对齐pdf文件中的文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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