pdfjs icon indicating copy to clipboard operation
pdfjs copied to clipboard

Pagenumbers not working with external documents

Open crsten opened this issue 3 years ago • 4 comments

Hi,

I am trying to merge multiple pdfs into one and add pagenumbers after.

See implementation:

let doc = new pdf.Document()
let ext = new pdf.ExternalDocument(src)

doc.addPagesOf(ext)
let footer = doc.footer()
footer.pageNumber((curr, total) => `Page ${curr} / ${total}`)

let result = await doc.asBuffer()

Merging works fine but i cannot se any pagenumbers.

What am I doing wrong?

crsten avatar Jan 09 '21 16:01 crsten

The same problem bothers me.

Red-Asuka avatar Jan 16 '21 08:01 Red-Asuka

Thanks for the report. You aren't doing anything wrong. Page numbers are just not added to external pages right now. They are mostly copy and pasted in your new documented but not modified in any kind.

rkusa avatar Mar 09 '21 12:03 rkusa

The problem seems to still exist for us. We recently started using this package and works fine on merging multiple PDFs but doesn't add the footer for page numbers.

@rkusa do we have a workaround or is that something in your roadmap to implement?

vivekkeswaran avatar Jul 22 '22 19:07 vivekkeswaran

@vivekkeswaran This is not on my roadmap. The only workaround I can think of is to add the external page as an image that spans the whole page. It's quite an ugly workaround and doesn't work well with multiple pages though.

rkusa avatar Jul 25 '22 09:07 rkusa