Closed Zappatta closed 6 years ago
It could be that the pages content applies a page rotation transformation. Try separating their graphic contexts like this:
let curPage = pdfWriter.createPage(0,0,mediaBoxSize[2],mediaBoxSize[3]);
let contentContext = pdfWriter.startPageContentContext(curPage)
contentContext.q()
pdfWriter.mergePDFPagesToPage(curPage, coverFilePath)
contentContext.Q()
contentContext.q()
copyingContext.mergePDFPageToPage(curPage,i); //second merge
contentContext.Q()
pdfWriter.writePage(curPage)
Can confirm this solution works.
I'm not sure if this a workaround for bug or was an original misuse of API. Leaving it up to @galkahana to decide if this open should be closed or not.
Also, thank you for your amazing work on this great project 😸
I'm trying to create PDF, where each page has a "cover" image which lays before the PDF content. I'm creating a new page and using merge functions twice in a row. First mergePDFPagesToPage and then mergePDFPageToPage
see example code:
in the output file, the second PDF I embed (content page) using mergePDFPageToPage is upside down! (I.E. Flipped vertically). HOWEVER, if I reverse the order of the function calls, then the cover page is upside down. So it seems that the second merge causes the flips, no matter which page is merged or what function is used.