Skip to content

Sometimes drawText works, other times not? #1723

Closed Answered by dmb0058
dmb0058 asked this question in Q&A
Discussion options

You must be logged in to vote

Ths background to this is that I was trying to open a PDF file that had a version higher than 1.4, and was getting the error "This PDF document probably uses a compression technique which is not supported by the free parser shipped with FPDI."

In case it helps anyone, the answer is "Yes", pdf-lib can open and flatten documents like this:

'use strict';

const fs = require('fs');
const { PDFDocument } = require('pdf-lib');

async function copyPdfWithoutFields(inputPdfPath, outputPdfPath)
{
  const inputPdfBytes = fs.readFileSync(inputPdfPath);
  const inputPdf = await PDFDocument.load(inputPdfBytes);

  const newPdf = await PDFDocument.create();

  const pageCount = inputPdf.getPageCount();…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by dmb0058
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant