Skip to content

Implement 'Do' command and support Form referenced by 'Do' commands#820

Draft
DominikDostal wants to merge 1 commit into
smalot:masterfrom
DominikDostal:Do-command-implementation
Draft

Implement 'Do' command and support Form referenced by 'Do' commands#820
DominikDostal wants to merge 1 commit into
smalot:masterfrom
DominikDostal:Do-command-implementation

Conversation

@DominikDostal
Copy link
Copy Markdown
Contributor

Type of pull request

  • Bug fix (involves code and configuration changes)
  • New feature (involves code and configuration changes)
  • Documentation update
  • Something else

About

Added support for Do command for Issue #802

Checklist for code / configuration changes

See CONTRIBUTING.md for all essential information about contributing.

Discuss the draft

Opened as Draft for now to show how I managed to make it work with my test pdf from #802

I think it's best to discuss the changes I had to make first, to find out if there is maybe a better way to do it:

  1. $extractedTexts can be empty if all Text is inside the object referenced by Do command
    -> Added a check to only skip all next commands if extracted text wasnt empty to begin with
  2. extractRawData and getTextArray takes content from the wrong property for Form objects
    Page object gets it with $content = $this->get('Contents'); which takes it from the elements array defined in the Header object
    Form object content can be access with:
$header = new Header([], $this->document);
$content = new PDFObject($this->document, $header, $this->content, $this->config);

I copied this part from another location and found that it worked. Im pretty sure we can create this object somewhere in the constructor of form or the factory, but sadly i didnt manage to find the place where i should do that.

@k00ni
Copy link
Copy Markdown
Collaborator

k00ni commented May 4, 2026

@DominikDostal Thank you for taking the time. I am currently very busy, but try to get back to you in more detail in the next weeks.

In the meantime, would you be so kind and check #795, if it covers code you also changed? If that is the case I would see that we further discuss implementation details.

@DominikDostal
Copy link
Copy Markdown
Contributor Author

@DominikDostal Thank you for taking the time. I am currently very busy, but try to get back to you in more detail in the next weeks.

Dont worry about it, take your time. I managed to make it work for my project, just wanted to share my findings with the community :)

In the meantime, would you be so kind and check #795, if it covers code you also changed? If that is the case I would see that we further discuss implementation details.

I looked through it, but my PR doesnt seem to have any overlapping code with #795

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants