Hopding / pdf-lib

Create and modify PDF documents in any JavaScript environment
https://pdf-lib.js.org
MIT License
6.89k stars 656 forks source link

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

Closed necessarylion closed 5 months ago

necessarylion commented 1 year ago

What?

Add function to set and get print profile (OutputIntents)

Why?

For the PDF/X-4 standard, the document need to set print profile

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

New Dependencies?

N/A

Screenshots

N/A

Suggested Reading?

Anything Else?

N/A

Checklist