如何判斷 PDF 是否經過修改,以及為何大多數檢查都無法真正確認
How to tell if a PDF has been edited (and why most checks can't really tell you)
判斷 PDF 是否被修改時,元資料、修訂記錄和視覺檢查只能提供線索,無法證明文件未遭篡改。可靠做法是在文件簽發時記錄 SHA-256 指紋,再與收到的檔案比對;指紋相同即代表檔案逐位元組一致。TRAMPTO 可在瀏覽器封存 PDF,並提供免費驗證連結,毋須帳戶。
Someone sends you a PDF: a quote, a certificate, a payslip, a contract. Something feels off. Has it been edited?
There are a few ways to look for clues. The problem is that most of them only give you clues, and a careful editor can remove every one.
1. Check the metadata
Open the document properties (File → Properties in most readers). Look at:
- Producer / Creator: the software that made the file. A bank statement "produced" by a free online PDF editor is a red flag.
- Created vs Modified dates: if they differ a lot, the file was saved again later.
Limit: metadata is trivially edited or stripped. A clean result proves nothing.
2. Look for incremental saves
PDFs can be saved "incrementally": new content is appended to the end of the file instead of rewriting it. Some tools show a revision history, and a signed PDF will often say "this document has been changed since it was signed".
Limit: re-saving the file as a fresh PDF ("Print to PDF", "Save as") flattens everything and erases that trail.
3. Inspect the content
Zoom in. Look for mismatched fonts, misaligned numbers, text you can't select next to text you can, or areas that look pasted on.
Limit: with modern editors and AI tools, a clean edit leaves no visible trace at all.
4. Compare with the original
If you have the original, compare both versions with a diff tool. This works, but only if you have a trustworthy original, which is usually exactly what you don't have.
The one check that gives a real answer
All the methods above look for evidence of tampering. None of them can confirm the absence of tampering. For that, you need something fixed at the moment the document was issued: a cryptographic fingerprint (SHA-256).
If the issuer registers the fingerprint when they create the PDF, anyone can later recompute the fingerprint of the file they received and compare. Same fingerprint: it's byte-for-byte the original. Different: something changed, even if you can't see what.
That's what TRAMPTO does. The issuer seals the PDF in their browser (the file is never uploaded) and sends a verification link along with it. The recipient checks it in seconds, for free, with no account.
Limit, to be fair: this only works for documents sealed when they were issued. For a random PDF that nobody sealed, you're back to looking for clues.
Quick checklist
- Metadata looks odd? Treat it as a warning, not proof.
- Revision history or "changed since signed"? Strong warning.
- Visual inconsistencies? Strong warning.
- A verification link that matches? That's actual proof it wasn't changed.
Have you ever caught an edited PDF? What gave it away?
來源:DEV Community · dev.to