我正在打印使用iTextSharp生成的Avery标签。三栏工作表的最后一栏必须移动一点,所以我增加了一些空格:
case 3:
case 6:
case 9:
case 12:
case 15:
//fmp first
iTextSharp.text.Chunk chunkFmp1 = new iTextSharp.text.Chunk(string.Format(" {0}\n", patient.FmpSsn));
chunkFmp1.Font.SetFamily("Arial");
chunkFmp1.Font.Size = fontsize;
contents.Add(chunkFmp1);
//name
iTextSharp.text.Chunk chunkName1 = new iTextSharp.text.Chunk(string.Format(" {0}\n", patient.PatientName));
chunkName1.Font.SetFamily("Arial");
chunkName1.Font.Size = fontsize;
contents.Add(chunkName1);
//data
iTextSharp.text.Chunk chunkData1 = new iTextSharp.text.Chunk(string.Format(" {0} {1} {2}\n", "SEX:" + patient.PatientSex.Substring(0, 1), "DOB:" + patient.PatientDobString, "AGE:" + patient.PatientAge));
chunkData1.Font.SetFamily("Arial");
chunkData1.Font.Size = fontsize;
contents.Add(chunkData1);
//data2
iTextSharp.text.Chunk chunkBranch1 = new iTextSharp.text.Chunk(string.Format(" {0} {1} {2} {3}\n", patient.BranchOfService, patient.BillingCode, patient.Rank, patient.ReligionName));
chunkBranch1.Font.SetFamily("Arial");
chunkBranch1.Font.Size = fontsize;
contents.Add(chunkBranch1);
break;其结果如下:

您可以看到所有文本是如何移动的,但不是条形码。如何使条形码与文本对齐?
发布于 2017-05-16 11:26:47
我想我没有意识到条形码的放置设置是这样的:
contents.Add(new iTextSharp.text.Chunk(image39, 28, 0));这使得代码超过28个像素(?)我认为。
https://stackoverflow.com/questions/43978089
复制相似问题