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

Add function to set and get print profile (Output Intents) #5

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

necessarylion
Copy link

@necessarylion necessarylion commented Aug 3, 2024

What?

  • Added function to set and get print profile (OutputIntents)
  • Fix test(Jest) did not able to run, due to mismatch of ts-jest and some path issues.

Why?

For the PDF/X-4, PDF/A standard document, setting print profile is one of the requirement.

References

How?

// Create a new PDFDocument
const pdfDoc = await PDFDocument.create()

// get buffer from icc file
const iccBuffer = fs.readFileSync('path/to/profile.icc');

// example for PDF/X-4
pdfDoc.setPrintProfile({
  identifier: 'Coated_FOGRA39',
  info: 'Coated FOGRA39 (ISO 12647-2:2004)',
  subType: 'GTS_PDFX',
  iccBuffer,
});

Testing?

I have added test cases

  • To read print profile from existing document
  • To set print profile to new document
  • To get print profile from recently added document

New Dependencies?

N/A

Screenshots

N/A

Suggested Reading?

Anything Else?

N/A

Checklist

  • I read CONTRIBUTING.md.
  • I read MAINTAINERSHIP.md#pull-requests.
  • I added/updated unit tests for my changes.
  • I added/updated integration tests for my changes.
  • I ran the integration tests.
  • I tested my changes in Node, Deno, and the browser.
  • I viewed documents produced with my changes in Adobe Acrobat, Foxit Reader, Firefox, and Chrome.
  • I added/updated doc comments for any new/modified public APIs.
  • My changes work for both new and existing PDF files.
  • I ran the linter on my changes.

@hand-dot
Copy link

hand-dot commented Aug 8, 2024

Hey @necessarylion !

Excellent. Thank you as always.
This fork of pdf-lib exists to implement features necessary for pdfme's functionality, so there are no immediate plans to merge it.

However, when implementing the following issues, I'll test this PR again on my end and merge it!
pdfme/pdfme#391

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