Skip to content

Render to fetch request? #2365

Answered by coskuncakir
noconsulate asked this question in Q&A
Discussion options

You must be logged in to vote

hey @noconsulate, i think you could send the blob data off via a fetch req, so it could be something like this?:

const blob = pdf(<MyDocument />).toBlob();

blob.then((blob) => {
  fetch('https://endpoint', {
    method: 'POST',
    body: blob,
  })
  .then((response) => response.json())
  .then((data) => console.log(data))
  .catch((error) => console.log(error));
});

also, you can check here: https://react-pdf.org/advanced#on-the-fly-rendering

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by noconsulate
Comment options

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