Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to display pdf data received from the server in the fomat starting with %PDF-1.3 %Äåòåë§ó ÐÄÆ #842

Closed
3 tasks done
ArunKadariCS opened this issue Sep 7, 2021 · 11 comments
Labels
question Further information is requested stale

Comments

@ArunKadariCS
Copy link

Before you start - checklist

  • I have read documentation in README
  • I have checked sample and test suites to see real life basic implementation
  • I have checked if this question is not already asked

What are you trying to achieve? Please describe.
trying to display pdf file.

I'm getting the pdf data from the server in the below format. But it's not it's displaying the data.

%PDF-1.3
%Äåòåë§ó ÐÄÆ
3 0 obj
<< /Filter /FlateDecode /Length 83 >>
stream
x�+T�T(T0B3C#�sK#�¢T�p�<�ý�Ô¢äÔ��ÒÄ��¢L°��¬®¡�¡�¡���P�±���©��	���Ë¥ï�k¨à��4/��ö��
endstream
endobj
1 0 obj
<< /Type /Page /Parent 2 0 R /Resources 4 0 R /Contents 3 0 R /MediaBox [0 0 612 792]
>>
endobj
4 0 obj
<< /ProcSet [ /PDF /ImageB /ImageC /ImageI ] /XObject << /Im1 5 0 R >> >>
endobj
5 0 obj
<< /Type /XObject /Subtype /Image /Width 1219 /Height 248 /Interpolate true
/ColorSpace 6 0 R /Intent /Perceptual /SMask 7 0 R /BitsPerComponent 8 /Length
67142 /Filter /FlateDecode >>
stream
x�ì½e�$7Ò�ûWÌÌÌÌLkffffffff�5333­aÍö�ÞûìÆõ¹qS¡¬¬êîñLOÔ���R

Describe what are you trying to achieve Ex. I'd like to display multiple pages of my PDF.

Describe solutions you've tried
<Document file={data:application/pdf;base64,${pdfFileData}} onLoadSuccess={onDocumentLoadSuccess}>

Describe solutions you've already tried, if any. Make sure to include code samples if you're stuck on implementation.

Additional information

If applicable, add screenshots (preferably with browser console open) and files you have an issue with to help explain your problem.

Environment

  • Browser (if applicable) [e.g. Chrome 57, Firefox 59]:
  • React-PDF version [e.g. 3.0.4]:
  • React version [e.g. 16.3.0]:
  • Webpack version (if applicable) [e.g. 4.16.2]:
@github-actions
Copy link
Contributor

This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this issue will be closed in 14 days.

@github-actions github-actions bot added the stale label Dec 13, 2021
@GarmaSong
Copy link

Did you figured it out? I have a same issue with yours :_-( I couldn't find clear solutions..

@wojtekmaj
Copy link
Owner

Try <Document file={file} /> where file is a memoized object: { data: '%PDF-1.3…' }.

@wojtekmaj wojtekmaj added question Further information is requested and removed stale labels Dec 23, 2021
@GarmaSong
Copy link

GarmaSong commented Feb 4, 2022

Try <Document file={file} /> where file is a memoized object: { data: '%PDF-1.3…' }.

Thank you for your reply! We were receiving base64 type of data from the server. There was a problem in the process of converting data from the server, so it was not visible on the screen. If the data comes only in the form of base 64, there was no problem in displaying it on the screen.

I figured out like below

<Document
        error={''}
        loading={<Loading />}
        file={`data:application/pdf;base64,${prescription}`}
        onLoadSuccess={onDocumentLoadSuccess}
      >

Thank you again :)

@github-actions
Copy link
Contributor

github-actions bot commented May 9, 2022

This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this issue will be closed in 14 days.

@github-actions github-actions bot added the stale label May 9, 2022
@github-actions
Copy link
Contributor

This issue was closed because it has been stalled for 14 days with no activity.

@ahujapiyush
Copy link

i am facing same problem how to solve it

@Parmar-Bansi
Copy link

i am facing same problem how to solve it

any solution found..??
i have facing same problem too.

@cancancann
Copy link

i am facing same problem how to solve it

any solution found..?? i have facing same problem too.

any solution found..??

@ahujapiyush
Copy link

i am facing same problem how to solve it

any solution found..?? i have facing same problem too.

any solution found..??

I Told the backed team they fixed it

@cancancann
Copy link

i am facing same problem how to solve it

any solution found..?? i have facing same problem too.

any solution found..??

I Told the backed team they fixed it

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested stale
Projects
None yet
Development

No branches or pull requests

6 participants