Skip to content

Conversation

@simison
Copy link
Member

@simison simison commented Nov 21, 2025

Proposed changes:

  • Adds PDF response endpoint, Dompdf library and rendering the response with it quite similar to the email
Screen.Recording.2025-11-21.at.12.35.36.mov

Other information:

  • Have you written new tests for your changes, if applicable?
  • Have you checked the E2E test CI results, and verified that your changes do not break them?
  • Have you tested your changes on WordPress.com, if applicable (if so, you'll see a generated comment below with a script to run)?

Jetpack product discussion

Does this pull request change what data or activity we track or use?

Testing instructions:

  • I think you need to update composer deps with:
    • cd projects/plugins/jetpack
    • composer update
  • Then in Forms inbox, pick three dots menu and there's PDF option
  • If you get 500 response, you're likely missing dompdf composer dependency somewhere still
  • Otherwise you get a basic PDF downloaded, rendered with similar HTML like email
  • Check different types of responses

@simison simison requested review from a team and ilonagl November 21, 2025 10:57
@simison simison added [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it [Status] Needs Review This PR is ready for review. [Package] Forms labels Nov 21, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Nov 21, 2025

Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.

  • To test on WoA, go to the Plugins menu on a WoA dev site. Click on the "Upload" button and follow the upgrade flow to be able to upload, install, and activate the Jetpack Beta plugin. Once the plugin is active, go to Jetpack > Jetpack Beta, select your plugin (Jetpack), and enable the update/forms-pdf branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack update/forms-pdf

Interested in more tips and information?

  • In your local development environment, use the jetpack rsync command to sync your changes to a WoA dev blog.
  • Read more about our development workflow here: PCYsg-eg0-p2
  • Figure out when your changes will be shipped to customers here: PCYsg-eg5-p2

@github-actions github-actions bot added [Feature] Contact Form [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ labels Nov 21, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Nov 21, 2025

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Review, ...).
  • ✅ Add a "[Type]" label (Bug, Enhancement, Janitorial, Task).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


Follow this PR Review Process:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Make sure to test your changes on all platforms that it applies to. You're responsible for the quality of the code you ship.
  3. You can use GitHub's Reviewers functionality to request a review.
  4. When it's reviewed and merged, you will be pinged in Slack to deploy the changes to WordPress.com simple once the build is done.

If you have questions about anything, reach out in #jetpack-developers for guidance!


Jetpack plugin:

The Jetpack plugin has different release cadences depending on the platform:

  • WordPress.com Simple releases happen as soon as you deploy your changes after merging this PR (PCYsg-Jjm-p2).
  • WoA releases happen weekly.
  • Releases to self-hosted sites happen monthly:
    • Scheduled release: December 2, 2025

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.

@jp-launch-control
Copy link

jp-launch-control bot commented Nov 21, 2025

Code Coverage Summary

Coverage changed in 3 files.

File Coverage Δ% Δ Uncovered
projects/packages/forms/src/contact-form/class-contact-form-endpoint.php 790/945 (83.60%) -1.93% 24 💔
projects/packages/forms/src/dashboard/inbox/stage/actions.tsx 0/271 (0.00%) 0.00% 19 💔
projects/packages/forms/src/contact-form/class-feedback-field.php 125/172 (72.67%) -4.34% 10 💔

1 file is newly checked for coverage.

File Coverage
projects/packages/forms/src/contact-form/class-response-pdf.php 0/109 (0.00%) 💔

Full summary · PHP report · JS report

If appropriate, add one of these labels to override the failing coverage check: Covered by non-unit tests Use to ignore the Code coverage requirement check when E2Es or other non-unit tests cover the code Coverage tests to be added later Use to ignore the Code coverage requirement check when tests will be added in a follow-up PR I don't care about code coverage for this PR Use this label to ignore the check for insufficient code coveage.

ilonagl
ilonagl previously approved these changes Nov 24, 2025
] );
};

const triggerFileDownload = ( blob: Blob, filename: string ): void => {
Copy link
Member Author

@simison simison Nov 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's couple places in Forms where we do something similar — might be worth moving to shared utility later on in a follow up.

@anomiex
Copy link
Contributor

anomiex commented Nov 24, 2025

dompdf/php-svg-lib#129 may be a blocker here. Hopefully they don't drop php 7.2 support when adding 8.5 support.

@simison simison force-pushed the update/forms-pdf branch 2 times, most recently from 26e3a77 to 99920c9 Compare November 25, 2025 13:12
@simison
Copy link
Member Author

simison commented Nov 25, 2025

dompdf/php-svg-lib/issues/129 may be a blocker here. Hopefully they don't drop php 7.2 support when adding 8.5 support.

@anomiex, can you elaborate on what you meant?

Do you know what this is about:

---
Error: Non-dev composer dependency dompdf/dompdf is not being production-included. Either make it a dev dependency, or add a line like
/vendor/dompdf/dompdf/**    production-include
in `.gitattributes`.
---
---
Error: Non-dev composer dependency dompdf/php-font-lib is not being production-included. Either make it a dev dependency, or add a line like
/vendor/dompdf/php-font-lib/**    production-include
in `.gitattributes`.
---
---
Error: Non-dev composer dependency dompdf/php-svg-lib is not being production-included. Either make it a dev dependency, or add a line like
/vendor/dompdf/php-svg-lib/**    production-include
in `.gitattributes`.
---
---
Error: Non-dev composer dependency masterminds/html5 is not being production-included. Either make it a dev dependency, or add a line like
/vendor/masterminds/html5/**    production-include
in `.gitattributes`.
---
---
Error: Non-dev composer dependency sabberworm/php-css-parser is not being production-included. Either make it a dev dependency, or add a line like
/vendor/sabberworm/php-css-parser/**    production-include
in `.gitattributes`.
---

@tbradsha
Copy link
Contributor

As for the not being production-included messages, you'll need to include the relevant paths in here:
https://github.com/Automattic/jetpack/blob/fa1d003e1e9c8609d6720c6bba1ebf60d7d48eb8/projects/packages/forms/.gitattributes

Otherwise, they won't be included as part of the built package.

@anomiex
Copy link
Contributor

anomiex commented Nov 25, 2025

dompdf/php-svg-lib/issues/129 may be a blocker here. Hopefully they don't drop php 7.2 support when adding 8.5 support.

@anomiex, can you elaborate on what you meant?

The current version of dompdf/php-svg-lib depending on a version of sabberworm/php-css-parser that doesn't support PHP 8.5 is what's causing the fail at https://github.com/Automattic/jetpack/actions/runs/19670703209/job/56338573825?pr=46045#step:10:773

Hopefully when dompdf/php-svg-lib updates that dep, they don't also decide to do "other potential updates" that involve dropping support for PHP 7.2, because WordPress core still supports that version of PHP and Jetpack follows Core in that.

Do you know what this is about:

---
Error: Non-dev composer dependency dompdf/dompdf is not being production-included. Either make it a dev dependency, or add a line like
/vendor/dompdf/dompdf/**    production-include
in `.gitattributes`.
---
---
Error: Non-dev composer dependency dompdf/php-font-lib is not being production-included. Either make it a dev dependency, or add a line like
/vendor/dompdf/php-font-lib/**    production-include
in `.gitattributes`.
---
---
Error: Non-dev composer dependency dompdf/php-svg-lib is not being production-included. Either make it a dev dependency, or add a line like
/vendor/dompdf/php-svg-lib/**    production-include
in `.gitattributes`.
---
---
Error: Non-dev composer dependency masterminds/html5 is not being production-included. Either make it a dev dependency, or add a line like
/vendor/masterminds/html5/**    production-include
in `.gitattributes`.
---
---
Error: Non-dev composer dependency sabberworm/php-css-parser is not being production-included. Either make it a dev dependency, or add a line like
/vendor/sabberworm/php-css-parser/**    production-include
in `.gitattributes`.
---

It's telling you that the new vendor packages aren't being included in the built version of Jetpack-the-plugin. It wants you to add the appropriate lines into projects/plugins/jetpack/.gitattributes to tell it to include them.

@anomiex
Copy link
Contributor

anomiex commented Nov 25, 2025

As for the not being production-included messages, you'll need to include the relevant paths in here: https://github.com/Automattic/jetpack/blob/fa1d003e1e9c8609d6720c6bba1ebf60d7d48eb8/projects/packages/forms/.gitattributes

Wrong file. 😀

@simison
Copy link
Member Author

simison commented Nov 27, 2025

Thanks! I added the files to .gitattributes.

We don't use SVGs in the PDF, so I wonder if it would still be safe to include regardless of lacking PHP 8.5 support 🤔

@simison
Copy link
Member Author

simison commented Nov 27, 2025

It's also not a critical feature so perfectly fine if we would add PHP version check before loading the feature.

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

Labels

[Feature] Contact Form [Package] Forms [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Status] Needs Review This PR is ready for review. [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants