私が LeadTools に求めているのは、QR バーコードを pdf ファイルに読み書きできることだけです。バーコードをpdfに書き込むために作成した方法は次のとおりです。
private void WriteBarcodeToPDF(string ServerPath_imageFile, string value, bool topLeft = true) { // バーコード データを作成する QRBarcodeData バーコード = BarcodeData.CreateDefaultBarcodeData(BarcodeSymbology.QR) as QRBarcodeData; BarcodeEngine エンジン = 新しい BarcodeEngine();
using (RasterCodecs codecs = new RasterCodecs())
{
using (RasterImage image = codecs.Load(ServerPath_imageFile))
{
// Save the image
barcode.SymbolModel = QRBarcodeSymbolModel.Model2AutoSize;
barcode.Value = value;
// We will use the alignment to position the barcodes, so use all of the image
barcode.Bounds = new LogicalRectangle(0, 0, image.ImageWidth, image.ImageHeight, LogicalUnit.Pixel);
// Set the write options
QRBarcodeWriteOptions options = new QRBarcodeWriteOptions();
if (topLeft)
{
options.HorizontalAlignment = BarcodeAlignment.Near;
options.VerticalAlignment = BarcodeAlignment.Near;
}
else
{
options.HorizontalAlignment = BarcodeAlignment.Far;
options.VerticalAlignment = BarcodeAlignment.Far;
}
//Options
options.GroupNumber = 0;
options.GroupTotal = 0;
options.XModule = 30; //(Value allowed: 1 - 100)
options.ECCLevel = QRBarcodeECCLevel.LevelH;
// Write it
engine.Writer.WriteBarcode(image, barcode, options);
//Save As new Image.
codecs.Save(image, ServerPath_imageFile, RasterImageFormat.RasPdf, 1);
}
}
}
ここに私の問題があります:
バーコードに保存したい値は、10 ~ 12 桁の数字です。それでおしまい。ECCレートの高いQRバーコード21x21があると聞きました。私のニーズ (10 ~ 12 桁の数字) を満たし、最高の回復率 (ECC) を持つバーコードが生成されるように、私のメソッドを修正していただけませんか?
出力 pdf の品質は非常に悪く、バーコードを配置したページだけでなく、pdf ファイルのすべてのページのテキストも大幅に劣化しています。これ。私の方法に何か問題があるはずです。直していただけませんか?
皆さんありがとう。