Shopware 6 生成的 PDF 无法在 Acrobat Reader 中使用

Shopware 6 生成的 PDF 无法在 Acrobat Reader 中使用

我们在 Shopware 6 商店中生成的发票在 Chrome、Firefox 和 Ubuntu 的 PDF 查看器中显示正常,但在 Acrobat Reader 中显示不正常。

file test.pdf
PDF document, version 1.7, 0 pages

PDF 应该有徽标和位置,但在 Acrobat 中它只显示一小部分:

截屏

如何调试?是否有工具可以进一步验证 PDF?

编辑:我跑了pdfcheckerhttps://www.datalogics.com/repair-pdf-files/- 我没有发现任何明显的错误?

那个部分

       Uses fonts that do not allow text to be extracted:
            SUBAAB+匀漀甀爀挀攀匀愀渀猀倀爀漀ⴀ刀攀最甀氀愀爀, SubType: Type0 (1 instance)
            SUBAAC+匀漀甀爀挀攀匀愀渀猀倀爀漀ⴀ䈀漀氀搀, SubType: Type0 (1 instance)

看起来很奇怪,因为我们在文档中没有使用中文。此外,缺少的部分不仅是字体,还有徽标。

完整输出:

$ ./pdfchecker -i example.pdf -j CheckerProfiles/everything.json 
PDF Checker 2.2.0  Copyright 2018-2021 Datalogics, Inc. All Rights Reserved

PDF Checker 2.2.0  Copyright 2018-2021 Datalogics, Inc. All Rights Reserved

Wed May 10 07:56:53 2023

JSON Profile: CheckerProfiles/everything.json

Input Document: example.pdf

Number of Pages: 1

Language: None

PDF Version: 1.7

Author: 
Creation Date: 2023-May-05 09:04:03
Creator: 
Keywords: 
Modification Date: 2023-May-05 09:04:03
Producer: dompdf 1.0.3 + CPDF
Subject: 
Title: Rechnungs-Nr. 41292
Trapped: 

File Size: 38.3 KB

<<=CHECKER_SUMMARY_START=>>
general:born-digital
userdata:contains-transparency
fonts:found-non-extractible-text
cleanup:suboptimal-compression
images:color:resolution-too-low
images:grayscale:resolution-too-low
sizeInBytes:39219
canBeOptimized
<<=CHECKER_SUMMARY_END=>>

Optimization Assessment
    Document can be optimized with PDF Optimizer - see details below

General Results
    Errors:
        None
    Information:
        Document was born digital.  It was produced from PDF authoring software and so it may contain text, images, tables, forms, and other objects.  These types of PDFs typically do not require OCR.
    Checks Completed:
        acroforms-type
        born-digital
        claims-pdfe-conformance
        claims-pdfua-conformance
        claims-pdfvt-conformance
        claims-pdfx-conformance
        contains-owner-password
        contains-signature
        damaged
        does-not-conform-to-claimed-pdfa-type
        image-only
        password-protected
        pdf-v2
        tagged-pdf
        unable-to-open
        xfa-type

Userdata Results
    Errors:
        None
    Information:
        Contains transparency:
            Total: (1 instance)
    Checks Completed:
        contains-annots
        contains-annots-not-for-printing
        contains-annots-not-for-viewing
        contains-annots-without-normal-appearances
        contains-embedded-files
        contains-metadata
        contains-optional-content
        contains-private-data
        contains-transparency
    How To Optimize:
        Transparency (which is not universally supported by PDF Viewers) can be flattened using PDF Optimizer. (1 instance)

Fonts Results
    Errors:
        None
    Information:
        Uses fonts that do not allow text to be extracted:
            SUBAAB+匀漀甀爀挀攀匀愀渀猀倀爀漀ⴀ刀攀最甀氀愀爀, SubType: Type0 (1 instance)
            SUBAAC+匀漀甀爀挀攀匀愀渀猀倀爀漀ⴀ䈀漀氀搀, SubType: Type0 (1 instance)
    Checks Completed:
        fontdescriptor-missing-capheight
        fontdescriptor-missing-fields
        found-non-extractible-text
        uses-base14fonts-not-embedded
        uses-fonts-fully-embedded
        uses-fonts-not-embedded

Objects Results
    Errors:
        None
    Information:
        None
    Checks Completed:
        contains-javascript-actions
        contains-thumbnails

Cleanup Results
    Errors:
        None
    Information:
        Contains conservatively compressed streams:
            Uncompressed: (2 instances)
    Checks Completed:
        suboptimal-compression

Image Results
    Errors:
        None
    Information:
        None
    Checks Completed:
        alternate-images

    Color Images
    Errors:
        None
    Information:
        Low resolution color image(s) present:
            Total: (1 instance)
    Checks Completed:
        image-depth
        resolution-too-high
        resolution-too-low
        uses-jpeg2000-compression

    Grayscale Images
    Errors:
        None
    Information:
        Low resolution gray image(s) present:
            Total: (1 instance)
    Checks Completed:
        resolution-too-high
        resolution-too-low
        uses-jpeg2000-compression

    Monochrome Images
    Errors:
        None
    Information:
        None
    Checks Completed:
        resolution-too-high
        resolution-too-low
        uses-jbig2-compression

EDIT2:我们仍然无法生成 PDF 来共享。这是因为这种情况只发生在生产环境中。它甚至不会发生在临时环境中,临时环境只是同一服务器中的另一个 Web 根。

我的同事发现 source_sans_pro_normal.ufm.php 文件有所不同 - 我们尝试查明为什么会发生这种情况。

DomPDF 字体差异

https://github.com/shopwareLabs/dompdf/tree/d33e0741155134ffd2bffffcc3fdec7c7b5a67ba/lib/fonts不包含这些.php文件 - 似乎是在此处生成

答案1

我建议了 3 种工具,并且您使用了其中 1 种,这对该问题有所启发。

该工具的输出显示:

...  
...  
    Color Images  
    Information:  
        Low resolution color image(s) present:  
    Grayscale Images  
    Information:  
        Low resolution gray image(s) present:  
...  
...  

由于 DPI 分辨率低,Adobe 无法正确显示这些图像(常见的在线兼容问题!)。

解决方案 :

(A)您应该在(1)生成原始图像时、(2)插入/嵌入文档时、(3)生成文档时增加 DPI 分辨率。

(B) 您应该查看有关 DPI 分辨率的 Web 视图和打印质量设置。

(C) 您也可以尝试从其他 2 个工具获取输出,这可能会对问题有更多的帮助。

答案2

vendor/shopwarelabs/dompdf我们通过从文件未损坏的系统复制到生产环境来“修复”这个问题。

相关内容