秋·风

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
  278 随笔 :: 0 文章 :: 308 评论 :: 20万 阅读
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
网友在linux使用fr时发现不能在报表插入QRCode和PDF417等条码,经跟踪发现只需将frxBarcodePDF417.pas第1592行

A := TInt(ERROR_LEVEL[errorLevel]);

改为:

A := @(ERROR_LEVEL[errorLevel]);

就可以正常插入QRCode等二维码了,如果你使用过程也遇到同样问题可参考一下。
使用环境:
lazarus 2.3
FPC 3.3.1
CPU:Loongarch64,华为麒麟990
OS:统信专业版,银河麒麟

复制代码
procedure TfrxBarcodePDF417.CalculateErrorCorrection( dest : integer);
var
    A : TInt;
    ALength,e,k,t1,t2,t3, LastE : integer;
begin
    if (errorLevel < 0) or ( errorLevel > 8) then
        errorLevel := 0;
    {$ifdef linux}
    A := @(ERROR_LEVEL[errorLevel]); //2023.05.21 LBZ修正QRCode等不能使用的Bug
    {$else}
    A := TInt(ERROR_LEVEL[errorLevel]);
    {$endif}
    Alength := 2 shl errorLevel;
    for k := 0 to Alength-1 do
        codewords[dest + k] := 0;
    lastE := Alength - 1;
    for k := 0 to lenCodewords-1 do
    begin
        t1 := codewords[k] + codewords[dest];
        for e := 0 to lastE do
        begin
            t2 := (t1 * A[lastE - e]) mod _MOD;
            t3 := _MOD - t2;
            if e = LastE then
                codewords[dest + e] := t3 mod _MOD
            else
                codewords[dest + e] := ((codewords[dest + e + 1]) + t3) mod _MOD;
        end;
    end;
    for k := 0 to Alength- 1 do
        codewords[dest + k] := (_MOD - codewords[dest + k]) mod _MOD;

end;
复制代码

 

posted on   秋·风  阅读(272)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· AI 智能体引爆开源社区「GitHub 热点速览」
· 从HTTP原因短语缺失研究HTTP/2和HTTP/3的设计差异
· 三行代码完成国际化适配,妙~啊~
点击右上角即可分享
微信分享提示