react-to-pdf icon indicating copy to clipboard operation
react-to-pdf copied to clipboard

Page Orientation does not work in toPDF Hook

Open fsuk opened this issue 1 year ago • 1 comments

Firstly great package, thanks.

Using the hook the following does not work:

const { toPDF, targetRef: pdfTargetRef } = usePDF(
    filename: 'fileName.pdf'
  })

  const downloadAsPdf = () => {
    toPDF({
      page: {
        orientation: 'landscape'
      }
    })
  }

The downloaded PDF is in portrait

The following does work:

  const { toPDF, targetRef: pdfTargetRef } = usePDF({
    page: {
      orientation: 'landscape'
    },
     filename: 'fileName.pdf'
  })

  const downloadAsPdf = () => {
    toPDF()
  }

fsuk avatar Feb 23 '24 11:02 fsuk