我必须创建一个圆角的桌子,类似于:
我可以用iTextSharp做到吗?
我现在试过这个,但它不起作用.form.GenerateAppearances = true;
我合并了我的2个文件然后保存.然后我再次打开它以填充所有字段.它说所有的Acrofields钥匙都不见了,但是当我在Nitro pro中打开它的时候.为什么我不能在代码中看到它们?在保存之前我是否必须添加一些东西?
private static void CombineAndSavePdf1(string savePath, List<string> lstPdfFiles)
{
using (Stream outputPdfStream = new FileStream(savePath, FileMode.Create, FileAccess.Write, FileShare.None))
{
Document document = new Document();
PdfSmartCopy copy = new PdfSmartCopy(document, outputPdfStream);
document.Open();
PdfReader reader;
int totalPageCnt;
PdfStamper stamper;
string[] fieldNames;
foreach (string file in lstPdfFiles)
{
reader = new PdfReader(file);
totalPageCnt = reader.NumberOfPages;
for (int pageCnt = 0; pageCnt < totalPageCnt; )
{
//have to create new reader for each page or PdfStamper will throw error …
Run Code Online (Sandbox Code Playgroud) 我正在尝试执行以下代码来隐藏字段
\n\n fields.SetFieldProperty("numberOfPages","setfflags", PdfAnnotation.FLAGS_INVISIBLE, null );\n or \n fields.SetFieldProperty("slash", "setfflags", PdfAnnotation.FLAGS_HIDDEN, null);\n
Run Code Online (Sandbox Code Playgroud)\n\n我从《Itext in Action》书中获取了代码。我正在使用 Itextsharp 4.1.6 但没有得到任何结果,也没有抛出错误。我做错了什么?顺便说一句,“setfflags”来自这本书。
\n我有一个pdf文档,里面是两种类型的注释列表:1.矩形2.文本框
我想用c#和itextsharp从文本框中获取值.
我像这样启动mediaplayer:
if (mp != null) {
mp.stop();
mp.reset();
mp.release();
}
mp = MediaPlayer.create(this, R.raw.background);
mp.start();
Run Code Online (Sandbox Code Playgroud)
如何停止其他活动?它继续在另一个活动中播放。如何onDestroy
在其他活动中使用?
我试图在左侧获得一些文本行,在右侧获取一些文本.出于某种原因,iText似乎完全忽略了对齐.
例:
// create 200x100 column
ct = new ColumnText(writer.DirectContent);
ct.SetSimpleColumn(0, 0, 200, 100);
ct.AddElement(new Paragraph("entry1"));
ct.AddElement(new Paragraph("entry2"));
ct.AddElement(new Paragraph("entry3"));
ret = ct.Go();
ct.SetSimpleColumn(0, 0, 200, 100);
ct.Alignment = Element.ALIGN_RIGHT;
ct.AddElement(new Paragraph("entry4"));
ct.AddElement(new Paragraph("entry5"));
ct.AddElement(new Paragraph("entry6"));
ret = ct.Go();
Run Code Online (Sandbox Code Playgroud)
我已将第二列的对齐方式设置为Element.ALIGN_RIGHT,但文本显示在第一列的顶部,从而呈现不可读的文本.对齐仍然设置为左.
有任何想法吗?
我第一次给出打印命令。
“此页面存在错误。Acrobat 可能无法正确显示该页面。请联系创建 pdf 文档的人员以更正问题”。
打印输出非常好。第二次打印命令没有给出任何错误。
请帮助我为什么第一次打印时会出现此错误。
这是我创建 PDF 的代码的一部分
PdfContentByte cb = writer.DirectContent;
cb.BeginText();
Font NormalFont = FontFactory.GetFont("Arial", 12, Font.NORMAL, Color.BLACK);
// Add an image to a fixed position
iTextSharp.text.Image img = iTextSharp.text.Image.GetInstance(Server.MapPath("~/images/images/banner.tiff"));
img.SetAbsolutePosition(35, 760);
img.ScalePercent(50);
cb.AddImage(img);
// Draw a line by setting the line width and position
cb.SetLineWidth(2);
cb.MoveTo(20, 740);
cb.LineTo(570, 740);
cb.Stroke();
//Header Details
cb.BeginText();
writeText(cb, drHead["EmpName"].ToString(), 25, 745, f_cb, 14);
writeText(cb, "Employee ID:", 450, 745, f_cn, 12);
writeText(cb, drHead["EmployeeID"].ToString(), 515, 745, f_cb, 12);
cb.EndText();
cb.BeginText();
writeText(cb, …
Run Code Online (Sandbox Code Playgroud) 我使用以下代码填充我的PdfPTable:
public PdfPTable GetTable(List<hsp_Narudzbe_IzdavanjeFakture4_Result> proizvodi)
{
PdfPTable table = new PdfPTable(5);
table.WidthPercentage = 100F;
table.DefaultCell.UseAscender = true;
table.DefaultCell.UseDescender = true;
Font f = new Font(Font.FontFamily.HELVETICA, 13);
f.Color = BaseColor.WHITE;
PdfPCell cell = new PdfPCell(new Phrase("Stavke narudžbe: ", f));
cell.BackgroundColor = BaseColor.BLACK;
cell.HorizontalAlignment = Element.ALIGN_CENTER;
cell.Colspan = 5;
table.AddCell(cell);
for (int i = 0; i < 2; i++)
{
table.AddCell("Redni broj");
table.AddCell("Proizvod");
table.AddCell("Cijena");
table.AddCell("Šifra proizvoda");
table.AddCell("Kolicina");
}
table.DefaultCell.BackgroundColor = BaseColor.LIGHT_GRAY;
table.HeaderRows = 3;
table.FooterRows = 1;
int broj = 0;
table.DeleteLastRow(); …
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用以下方法创建类似的东西iText PdfPTable
:
--------------------------------------------------------------
| Content 1 |
--------------------------------------------------------------
| Content 2 | Content 3 | Content 4 |
--------------------------------------------------------------
| Content 5 |
--------------------------------------------------------------
| Content 7 | Content 7 |
--------------------------------------------------------------
Run Code Online (Sandbox Code Playgroud)
更新:
我曾尝试创建类似的东西但失败了,这表明我肯定需要学习更多。有人可以建议我如何构建相同的东西并帮助我学习。任何建议表示赞赏。
谢谢