iTextSharp(C#)でiText(Java) http://itextpdf.com/examples/iia.php?id=297の例を次のように書き直しました。
var document = new Document(PageSize.A4);
var writer = PdfWriter.GetInstance(document,
new FileStream(Path, FileMode.Create, FileAccess.Write,
FileShare.None));
document.Open();
var cb = writer.DirectContent;
document.Add(new Paragraph("Barcode EAN.UCC-13"));
var codeEan = new BarcodeEAN {Code = "230482304"};
document.Add(new Paragraph("default:"));
document.Add(codeEan.CreateImageWithBarcode(cb, BaseColor.BLACK, BaseColor.WHITE));
codeEan.GuardBars = false;
document.Add(new Paragraph("without guard bars:"));
Image i = codeEan.CreateImageWithBarcode(cb, null, null);
document.Add(i);
codeEan.Baseline = -1f;
codeEan.GuardBars = true;
document.Add(new Paragraph("text above:"));
document.Add(codeEan.CreateImageWithBarcode(cb, null, null));
codeEan.Baseline = codeEan.Size;
document.Close();
しかし、次の例外を取得します
Index was outside the bounds of the array.
at iTextSharp.text.pdf.BarcodeEAN.GetBarsEAN13(String _code)
at iTextSharp.text.pdf.BarcodeEAN.PlaceBarcode(PdfContentByte cb, BaseColor barColor, BaseColor textColor)
at iTextSharp.text.pdf.Barcode.CreateTemplateWithBarcode(PdfContentByte cb, BaseColor barColor, BaseColor textColor)
at iTextSharp.text.pdf.Barcode.CreateImageWithBarcode(PdfContentByte cb, BaseColor barColor, BaseColor textColor)
私の間違いはどこにありますか?その1:1の例はそこにあります...私はC#用のものを見つけられませんでしたが、C#ポートとDokuがないのは少し...何もありません。