MuhammaraJS icon indicating copy to clipboard operation
MuhammaraJS copied to clipboard

Links are lost

Open pedroresende opened this issue 3 years ago • 6 comments

I'm attempting to merge two PDF files, however, when doing so, it strips the links out. The code

const appendPdf = (inputPdfPathArray, outputPath) => {
    const pdfWriter = muhammara.createWriter(outputPath)

    for (const filePath of inputPdfPathArray) {
      pdfWriter.appendPDFPagesFromPDF(filePath)
    }

    pdfWriter.end()
}

pedroresende avatar Nov 08 '22 12:11 pedroresende

Thanks for reporting i could replicate this.

julianhille avatar Nov 08 '22 20:11 julianhille

This may be relevant: https://github.com/galkahana/HummusJSSamples/blob/master/appending-pages-with-comments/appendWithComments.js

mhassan1 avatar Nov 10 '22 03:11 mhassan1

@mhassan1 Thanks for the suggestion, I've attempted to use it, however, the result is the same. I've attempted to debug a bit and apparently the params content is the following

params {
  page: PDFPage {
    rotate: 0,
    artBox: undefined,
    trimBox: undefined,
    bleedBox: undefined,
    cropBox: undefined,
    mediaBox: [ 0, 0, 594.95996, 841.91998 ]
  },
  pageDictionaryContext: DictionaryContext {},
  writer: PDFWriter {
    events: EventEmitter {
      _events: [Object: null prototype] {},
      _eventsCount: 0,
      _maxListeners: undefined,
      [Symbol(kCapture)]: false
    }
  }
}

pedroresende avatar Nov 10 '22 10:11 pedroresende

im currently investigating other muhammara related issues, will come back to this. did not forgot it.

julianhille avatar Nov 15 '22 07:11 julianhille

im currently investigating other muhammara related issues, will come back to this. did not forgot it.

Thanks @julianhille

pedroresende avatar Nov 15 '22 08:11 pedroresende

It looks like PDF Writer does not support that so far. The appendPDF or mergePages etc function do not allow to set const ObjectIDTypeList& inCopyAdditionalObjects maybe something is possible with CreateFormXObjectsFromPDF which allows setting the objectIds to be copied.

julianhille avatar Nov 16 '22 23:11 julianhille