smalot / smalot/pdfparser

Duplicate images in PDF > Find which pages it occurs on

Open
#718 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

question
Dominant language
PHP
Stars
2.7k
Forks
579
Avg merge
2m
Merged PRs (30d)
1

Description

Hi!

I've got a document which contains several duplicates of images, getObjectsByType('XObject', 'Image') gets all the images but seems to "skip" or combine duplicates. Usually this wouldn't be a problem but I am relying on the specific order of the images.

Is one of the following solutions possible?;

  1. Loop through each page and get the Xobjects from the specific page (getObjectsByType doesn't work in the getPages() loop)

  2. Check the getDetails() (or something similar) of the object to see which pages it occurs on?

  3. Disable the skip/combine function and obtain all images

Many thanks in advance! :)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the duplicate-image behavior with getObjectsByType('XObject', 'Image') and compare it with access through getPages(). Review the available getDetails() behavior and how image XObjects are collected, then define which page association and ordering should be preserved. Done means the selected behavior is documented by a regression case and works for PDFs containing duplicate images.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.