我想從LeadTools中唯一能夠讀/寫QR條形碼爲pdf文件。下面是我創建寫條形碼爲pdf的方法:使用LeadTools將QR條碼寫入PDF文件。但輸出PDF的質量看起來非常糟糕
私人無效WriteBarcodeToPDF(串ServerPath_imageFile,字符串值,布爾左上=真){ //創建條形碼數據 QRBarcodeData條形碼= BarcodeData.CreateDefaultBarcodeData( BarcodeSymbology.QR)作爲QRBarcodeData; BarcodeEngine engine = new 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位數字。而已。我聽說有QR碼21x21具有很高的ECC碼率。請您修理我的方法,以便它能生成滿足我需求(10-12位數字)並具有最高恢復率(ECC)的條形碼?
輸出pdf質量非常差,不僅在我放條形碼的頁面上,而且PDF文件中的每個頁面都有其文本也會顯着降低,我不認爲它應該是這樣的。我的方法有問題。你能解決它嗎?
謝謝ALL。