Answer the question
In order to leave comments, you need to log in
How to extract a pdf attachment from an email?
I'm trying to extract a pdf file from an email inbox.
As a result of previous efforts with the help of php and imap, I got to the body of the letter.
An attached pdf attachment is considered part of the email body.
This is what the printout of the body of the letter looks like, as I see it now:
------=_NextPart_5e6a81c0_4ffa_4e54_9290_949cb861e79d
Content-Type: multipart/alternative;
boundary="----=_NextPart_b6aeb3cd_9d64_455d_8f6b_6c74fe663367"
------=_NextPart_b6aeb3cd_9d64_455d_8f6b_6c74fe663367
Content-Transfer-Encoding: base64
Content-Type: text/plain;
charset="utf-8"
DQoJCSAgINCX0LDQutCw0LfQsNC90L3QsNGPINCS0LDQvNC4INC60L7RgNGA0LXRgdC/0L7QvdC0
0LXQvdGG0LjRjyDQvdCw0YXQvtC00LjRgtGB0Y8g0LIg0L/RgNC40LrRgNC10L/Qu9C10L3QvdC+
0Lwg0YTQsNC50LvQtS4NCgkJICAgVGhlIGNvcnJlc3BvbmRlbmNlIG9yZGVyZWQgYnkgeW91IGlz
IGluIHRoZSBhdHRhY2htZW50Lg0KCQ==
------=_NextPart_b6aeb3cd_9d64_455d_8f6b_6c74fe663367--
------=_NextPart_5e6a81c0_4ffa_4e54_9290_949cb861e79d
Content-Type: application/octet;
name="Doc_d347a247fdd04e50a2fbc22cb6cc5eec.pdf"
Content-Disposition: attachment;
filename="Doc_d347a247fdd04e50a2fbc22cb6cc5eec.pdf"
Content-Transfer-Encoding: base64
JVBERi0xLjQKJcOIw4HDhMOXDQo5IDAgb2JqCjw8Ci9MZW5ndGggNTE3NCAKL0ZpbHRlciAvRmxh
dGVEZWNvZGUgCj4+CnN0cmVhbQp4nM2dy27kPnbG9/+nqBewRryLwKABu20HCLJJ0sAsgiyCIJdF
O8FkM6+fwzspiSWKqjIPGtVVKsvFn77Dc8iPslS3v97IbYZ/7v9///rT+z/8m/oPcnv/39s//pH9
VMhJLhqe5LRoDjve3n7ZH823//uv258+X2Cn+fbrP7OPe9ETU+L26+tf/jzPM4EHhQeDB/fbIntP
/ri9UDHf/ux/ruCx+J9reLyafeDx5n/+M9v/3e9Ds/eU35/4Z7PNV79jPvsDHp9uNwL/EfrjX2+/
/v6P2+3j1x/7EggeJHDH/09/Zw52njRTt6+bkmJiswxv/L7NE7397fbP+5/F9CQo3ZVzWamppqgl
HA8BzQjoQEBDIv2zqrITvkBDorfBEIj3TEDhARb/DAIT7V+/ZvvB75E3D2l+/hMe7x74w/x+tm84
qDf/bH7+6Zo2z7GtV/8+OQwW1ZM+f7zUc/JM6NBm1...
%PDF-1.4
%ÈÁÄ×
9 0 obj
<<
/Length 5174
/Filter /FlateDecode
>>
stream
x�͝�n�>v������F�����m�I��,�,� �E;�d3���;)�%��2�U*�ş��sȏ�T����m�������?���r{���?���T�I.��h;��~�ͷ���۟>_`����?��{�S����_�<�3�����"{O���P1�������kx��}����3����C���ߟ�g��W�c>��n7���_o���������$p��Ogv�4S����bb�o������������$(ݕsY����%��@@C"�����@C�����[email protected]���_�f���7i~�����~�o8�7�l~��6ϱ�W�>9Փ>��s�L��f��,�}h�y�ǁ��vg
BR�.~[��W����{;g��yq�� x�!hlq�A�l��� LT<��¿�v]��֛�������1%�W�w����G��I�����������?�#(�+ӗH�^z�<���D�m�t�Y�竌����Y~�HW���>
ѭ*l�2J��}��N��ߵ�*��kI��'�3��!e��ټ?�q-&.�I�Oz٩����
�W�ui�Z,>�?S�߿�P�:a�NyV���������狘��w������8�lq7բ(]@V�Pl�@�=X�3�(
d}�(~�L����{����cq��"��
Answer the question
In order to leave comments, you need to log in
$pdf=base64_decode( ... );
and save the $pdf variable to a file, for example, or do whatever you want with this variable, the contents of the pdf will be in it.
If it's about how to parse this pdf, then I have bad news for you. There is no universal reliable way to convert pdf to something familiar to us, for example, to html/docx/etc
Read
this article for self-development
give title before giving content:
'Content-Type: application/pdf');
header(
help you
:nth-child(even) {}
position: relative;
position: absolute;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question