PDF Code Fails on Another Machine? Share the Environment
“The same piece of code runs on my computer” is not a reproduction report. PDF rendering and document conversion are also affected by library versions, system f
Sharing code that "works on my computer" rarely helps someone else fix a PDF or document conversion problem. Rendering and conversion depend on library versions, system fonts, OCR language packs and external components, and any of these can differ between machines. This guide is for developers and support staff who need to report or reproduce a document processing issue.
You will learn what to record about your environment, how to collect it with a small reporter script, and how to tell whether a difference comes from the input, the code or the environment. You will also see why an identical environment does not always produce byte-identical output.
This paper uses synthetic samples to demonstrate the processing method. Before processing important files, keep the original copies and check the results against the boundaries and acceptance criteria in this document.
How do you reproduce a document processing bug on another machine? The short answer
Share a structured environment report together with a sample input, then compare the differences in a fixed order: input, then code, then environment.
| Your situation | What to do | Why |
|---|---|---|
| Someone else cannot reproduce your PDF output | Run the reporter and share its output with a desensitized sample | Package versions alone do not capture fonts, system libraries or OCR data |
| The rendered font looks different | Compare the font list with the rendering sample | A missing font can change typography |
| OCR results differ | Re-test with the same OCR language data | The recognition path changes with the language pack |
| Two outputs differ at the byte level | Decide whether you need byte-level or content-level match | Timestamps, random IDs and compressed metadata change hashes |
Why "it works on my machine" is not enough
"The same piece of code runs on my computer" is not a reproduction report. PDF rendering and document conversion depend on several layers at once:
- Library versions of the PDF and document tools
- System fonts installed on the machine
- OCR language packs used for text recognition
- External components the tools call on
Only when you collect all of this information can you tell whether a difference comes from the input, the code or the environment.
What to record: Python packages and system resources
Python packages
`importlib.metadata` can read the installed version of each distribution package. Be aware that the distribution name and the import name can differ. For example, you import PIL, but the matching distribution package is Pillow.
What a package list cannot show
Package versions do not cover everything. importlib.metadata cannot access:
- All installed fonts
- System dynamic libraries
- External OCR data files
Also, do not treat the output of pip freeze as the complete environment. It lists Python packages only.
Running the environment reporter
Use the following script to collect your environment details:
import json
import platform
from importlib import metadata
def package_version(name):
try:
return metadata.version(name)
except metadata.PackageNotFoundError:
return "not-installed"
def report(names):
return {"python": platform.python_version(),
"system": platform.system(),
"packages": {name: package_version(name) for name in names},
"fonts_manifest": "not-collected",
"ocr_language_data": "not-collected"}
data = report(["PyMuPDF", "Pillow", "omnidoc-synthetic-missing-package"])
assert data["packages"]["omnidoc-synthetic-missing-package"] == "not-installed"
assert data["python"]
assert data["fonts_manifest"] == "not-collected"
assert json.loads(json.dumps(data)) == data
The script has these properties:
- It only reads the current environment.
- It does not install dependencies.
- It does not connect to the internet.
- Items it cannot collect stay explicitly marked as missing. Do not fill them in with "default font" or "latest version".
The report can optionally link to container image digests, lock files and input file digests. It should not export authentication settings or all environment variables.
Comparing differences in the right order
Start with the differences that usually have the biggest effect on output:
| Difference | Common impact | How to verify |
|---|---|---|
| Font missing | Substitute font and typography changes | Compare the font list with the rendering sample |
| OCR language pack differs | Recognition path changes | Re-test with the same language data |
| PDF library versions differ | Interface or parsing behaviour changes | Check the version documentation and run the minimum sample |
| Input differs | It is not the same file at all | Use the same input first, then investigate the environment |
Checking the input first saves time. If the files are not identical, environment differences are not the cause.
Identical environments do not guarantee identical bytes
Even with the same environment, output files can differ at the byte level. Timestamps, random IDs and compressed metadata all change the file hash. Keep two goals separate:
- Byte-level reproducibility: the output file is identical, bit for bit.
- Content and layout meeting the same acceptance criteria: the text, fonts and layout match what you need.
Decide which assurance you need before you choose a comparison method. Comparing hashes when you only need matching layout will report false differences.
Communicating document translation issues
If your local preprocessing gives a different result from the OmniDoc (Product Entry) workflow, send a report with:
- A desensitized sample
- The processing stages you ran
- The environment report
A detailed report like this is far easier to act on than "the formatting is messed up". It also helps the team decide whether dependencies need updating, fonts need adding or input preparation needs adjusting.
📊 At a glance
| Assurance you need | What it means | How to compare |
|---|---|---|
| Byte-level reproducibility | The output file is identical, bit for bit | Compare file hashes, knowing timestamps and random IDs can change them |
| Content and layout | The text, fonts and layout meet the same acceptance criteria | Check against the acceptance criteria in this document |
🎯 Which approach fits you?
If you need someone else to reproduce your output
Run the environment reporter and send its output together with a desensitized sample and the processing stages.
If your fonts or typography look different
Compare the font list in your report with the rendering sample, and add any missing fonts.
If your OCR results differ
Re-test with the same OCR language data before changing your code.
If you only need the output to look right
Check the content and layout against your acceptance criteria rather than comparing file hashes.
❓ FAQ
1. Is pip freeze enough to describe my environment?
No. It lists Python packages only. It does not show installed fonts, system dynamic libraries or OCR data files.
2. Why does the package name not match the import name?
The distribution name and the import name can differ. For example, you import PIL, but the distribution package is Pillow.
3. Should the report include all my environment variables?
No. The report should not export authentication settings or all environment variables.
4. Why do two identical environments still produce different files?
Timestamps, random IDs and compressed metadata can change the file hash even when the content is the same.
📝 Summary
A reproduction report needs more than the code: record package versions, fonts, OCR data and system details, and always share a desensitized input. Compare input first, then code, then environment, and decide whether you need byte-level or content-level agreement.
Try it now: upload a document and get it translated with the layout intact


