Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

B 22288 fix pdfcpu int #14723

Merged
merged 6 commits into from
Feb 3, 2025
Merged

Conversation

cameroncaci
Copy link
Contributor

@cameroncaci cameroncaci commented Jan 31, 2025

B-22288

Summary

The pdfcpu config wasn't being passed to bookmarks, pdfcpu had hard-coded optimization, pdfcpu had another hidden config.yml file that can be fed into the app which I adjusted the defaults to set optimization to false. These have all been remedied, and now bookmarking will not be optimized (Which breaks things). The previous PR fixed the merging portion, this one fixes bookmarks, now all is dandy.

Pointed fork to the fixes.

Warning

Where are the pdfcpu code changes? Right here
https://github.com/transcom/pdfcpu/compare/83d2d75ad4cd..4b416bd62126

Setup to Run the Code

Important

You might have cached pdfcpu configs that could cause an issue during testing. You should only have to do this if you get testing issues.
Here are the two spots to delete it from:

  1. rm "/Users/${USER}/Library/Application Support/pdfcpu/config.yml
  2. Identify your golang tmp dir, easiest way is to serve in debug and put a breakpoint at pkg/paperwork/generator.go:121 to see the variable. Once you find it, rm ${tmp_dir}/pdfcpu/config.yml

How to test

  1. As a customer make a PPM while using "Testing document.pdf" as the orders
  2. Proceed through the PPM closeout flow until you're back as the customer uploading weight tickets
  3. Upload weight ticket 1 as "outlines-with-loop.pdf"
  4. Upload weight ticket 2 as "sample.pdf"
  5. Finish closeout
  6. Download payment packet, if it passes, it worked! The combination of outlines-with-loop.pdf and sample.pdf is a known crash.

sample.pdf
Testing Document.pdf
outlines-with-loop.pdf

Pdfcpu

Opened an issue with the pdfcpu maintainers pdfcpu/pdfcpu#1089

Test changes

Image extraction from PDF requires optimization to be enabled. I have verified the PDFs are still embedding properly by writing the file locally and previewing it (snippet below), as well as adjusting the test to check page count as an interim solution. The extract image from PDF is a func only used in our tests to validate file creation. This interim solution is a workaround until the pdfcpu optimization overflow error has been resolved.

image

@cameroncaci cameroncaci added Mountain Movers Movin' Mountains 1 Sprint at a time INTEGRATION Slated for Integration Testing labels Jan 31, 2025
@cameroncaci cameroncaci self-assigned this Jan 31, 2025
@cameroncaci cameroncaci requested review from a team as code owners January 31, 2025 19:05
deandreJones
deandreJones previously approved these changes Jan 31, 2025
@deandreJones
Copy link
Contributor

did you make the changes in the transcom/pdfcpu or just suggesting the pdfcpu team to make the changes?

@cameroncaci
Copy link
Contributor Author

did you make the changes in the transcom/pdfcpu or just suggesting the pdfcpu team to make the changes?

I made the changes in transcom/pdfcpu and will be suggesting them to the pdfcpu team

@deandreJones
Copy link
Contributor

did you make the changes in the transcom/pdfcpu or just suggesting the pdfcpu team to make the changes?

I made the changes in transcom/pdfcpu and will be suggesting them to the pdfcpu team

the description mentioned the pdfpcr repo - is why I asked

@cameroncaci
Copy link
Contributor Author

did you make the changes in the transcom/pdfcpu or just suggesting the pdfcpu team to make the changes?

I made the changes in transcom/pdfcpu and will be suggesting them to the pdfcpu team

the description mentioned the pdfpcr repo - is why I asked

Ah, whoops let me fix that

@cameroncaci
Copy link
Contributor Author

Got a test to fix

@cameroncaci
Copy link
Contributor Author

@deandreJones @danieljordan-caci see PR description "Test changes" for what changed since your last review

@cameroncaci cameroncaci merged commit f679990 into integrationTesting Feb 3, 2025
34 of 35 checks passed
@cameroncaci cameroncaci deleted the b-22288-fix-pdfcpu-int branch February 3, 2025 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
INTEGRATION Slated for Integration Testing Mountain Movers Movin' Mountains 1 Sprint at a time
Development

Successfully merging this pull request may close these issues.

4 participants