我正在尝试使用Angular将一个PDF文件读取到使用Angular到WebApi2后端的模式中的IFrame。
代码从远程服务器获取文档,然后应该将其提供服务,但我得到的是以下内容,这是我从http://www.alejandrodelasota.org/wp-content/uploads/2013/03/demoform1.pdf下载的大部分PDF文件。 我猜它是一个内容问题 - utf-8等但不确定。
返回数据的方法是:
public ActionResult GetVoidRaAllocationImage([FromUri]int ManualRANumber)
{
try
{
var data = _service.ApproveVoidRaAllocation(ManualRANumber);
var fileStream = _service.GetLinkedPDF(data.VoidAttachment);
var fsResult = new System.Web.Mvc.FileStreamResult(fileStream, "application/pdf");
return fsResult;
}
catch (Exception ex)
{
throw new FriendlyException("Unable to load the image.", "", ex);
}
}
在chrome中的开发工具中检查结果:
"%PDF-1.3
%����
1 0 obj <</Author <feff006900740065006b0073006f00660074>/CreationDate <feff0044003a00320030003000360030003300330030003100310030003700330030002b003000380027003000300027>/Creator <feff004d006900630072006f0073006f0066007400200057006f0072006400200039002e0030002d00200057006f00720064002d0041006400640069006e00200036002e00310039002e0034003200350038>/Keywords <feff>/Producer <feff00650044006f0063005000720069006e0074006500720020005000440046002000500072006f002000560065007200200036002e003200300020004200750069006c006400200034003200360038002d0034003200360038>/Subject <feff>/Title <feff005400480049005300200049005300200041002000540045005300540020>>> endobj
2 0 obj <</AcroForm 3 0 R /Names 4 0 R /Outlines 5 0 R /PageMode /UseNone /Pages 6 0 R /Type /Catalog /ViewerPreferences <<>>>> endobj
3 0 obj <</DA (/Helv 0 Tf 0 0 0 rg)/DR <</Font <</Helv 7 0 R /ZaDb 8 0 R >>>>/Fields 9 0 R /NeedAppearances true >> endobj
4 0 obj <</Dests 10 0 R >> endobj
5 0 obj <</First 11 0 R /Last 11 0 R >> endobj
6 0 obj <</Count 1 /Kids [12 0 R ]/Type /Pages >> endobj
7 0 obj <</BaseFont /Helvetica /Encoding 13 0 R /Name /Helv /Subtype /Type1 /Type /Font >> endobj
8 0 obj <</BaseFont /ZapfDingbats /Name /ZaDb /Subtype /Type1 /Type /Font >> endobj
9 0 obj [14 0 R 15 0 R 16 0 R 17 0 R 18 0 R 19 0 R 20 0 R 21 0 R 22 0 R 23 0 R ] endobj
10 0 obj <</Limits [(How to create Submit and Reset button?)(How to create Submit and Reset button?)]/Names [(How to create Submit and Reset button?)[12 0 R /XYZ null 226 null ]]>> endobj
11 0 obj <</Count 0 /Dest [12 0 R /XYZ null 226 null ]/Parent 5 0 R /Title <feff0048006f007700200074006f00200063007200650061007400650020005300750062006d0069007400200061006e006400200052006500730065007400200062007500740074006f006e003f>>> endobj
12 0 obj <</Annots [14 0 R 15 0 R 16 0 R 17 0 R 18 0 R 19 0 R 20 0 R 21 0 R 22 0 R 23 0 R ]/Contents 24 0 R /MediaBox [0 0 612 792 ]/Parent 6 0 R /Resources <</Font <</F1 25 0 R /F2 26 0 R /F3 27 0 R /F4 28 0 R >>/ProcSet [/PDF /Text /ImageB /ImageC /ImageI ]/XObject <<>>>>/Type /Page >> endobj
13 0 obj <</Differences [24 /breve /caron /circumflex /dotaccent /hungarumlaut /ogonek /ring /tilde 39 /quotesingle 96 /grave 128 /bullet /dagger /daggerdbl /ellipsis /emdash /endash /florin /fraction /guilsinglleft /guilsinglright /minus /perthousand /quotedblbase /quotedblleft /quotedblright /quoteleft /quoteright /quotesinglbase /trademark /fi /fl /Lslash /OE /Scaron /Ydieresis /Zcaron /dotlessi /lslash /oe /scaron /zcaron 164 /currency 166 /brokenbar 168 /dieresis /copyright /ordfeminine 172 /logicalnot /.notdef /registered /macron /degree /plusminus /twosuperior /threesuperior /acute /mu 183 /periodcentered /cedilla /onesuperior /ordmasculine 188 /onequarter /onehalf /threequarters 192 /Agrave /Aacute /Acircumflex /Atilde /Adieresis /Aring /AE /Ccedilla /Egrave /Eacute /Ecircumflex /Edieresis /Igrave /Iacute /Icircumflex /Idieresis /Eth /Ntilde /Ograve /Oacute /Ocircumflex /Otilde /Odieresis /multiply /Oslash /Ugrave /Uacute /Ucircumflex /Udieresis /Yacute /Thorn /germandbls /agrave /aacute /acircumflex /atilde /adieresis /aring /ae /ccedilla /egrave /eacute /ecircumflex /edieresis /igrave /iacute /icircumflex /idieresis /eth /ntilde /ograve /oacute /ocircumflex /otilde /odieresis /divide /oslash /ugrave /uacute /ucircumflex /udieresis /yacute /thorn /ydieresis ]/Type /Encoding >> endobj
14 0 obj <</BS <</S /S /W 1 >>/DA (/Helv 12 Tf 0 0 0 rg)/DV (Please enter your name in the text field ....)/F 4 /FT /Tx /MK <</BC [0 0 0 ]/BG [1 1 1 ]>>/MaxLen 45 /P 12 0 R /Rect [207.0000 512.0000 422.0000 527.0000 ]/Subtype /Widget /T (Text1)/Type /Annot /V (Please enter your name in the text field ....)>> endobj
15 0 obj <</BS <</S /S /W 1 >>/DA (/Helv 24 Tf 0 0 1 rg)/DV (This is a TEXT FIELD DEMO)/F 4 /FT /Tx /MK <</BC [0 0 0 ]/BG [1 1 1 ]>>/MaxLen 100 /P 12 0 R /Rect [138.0000 455.0000 437.0000 484.0000 ]/Subtype /Widget /T (Text2)/Type /Annot /V (This is a TEXT FIELD DEMO)>> endobj
16 0 obj <</BS <</S /S /W 1 >>/DA (/Helv 12 Tf 0 0 0 rg)/DV ()/F 4 /FT /Tx /MK <</BC [0 0 0 ]/BG [1 1 1 ]>>/P 12 0 R /Rect [148.0000 364.0000 363.0000 378.0000 ]/Subtype /Widget /T (Text3)/Type /Annot /V ()>> endobj
17 0 obj <</BS <</S /S /W 1 >>/DA (/Helv 12 Tf 0 0 0 rg)/DV ()/F 4 /FT /Tx /Ff 4096 /MK <</BC [0 0 0 ]/BG [1 1 1 ]>>/P 12 0 R /Rect [89.0000 221.0000 304.0000 281.0000 ]/Subtype /Widget /T (Text1)/Type /Annot /V ()>> endobj
18 0 obj <</A <</F <</F (http://www1.iteksoft.com/demoform1.php)/FS /URL >>/S /SubmitForm >>/BS <</S /B /W 1 >>/DA (/Helv 0 Tf 0 0 0 rg)/F 4 /FT /Btn /Ff 65536 /MK <</BC [0 0 0 ]/BG [1 1 1 ]/CA (Submit)>>/P 12 0 R /Rect [250.0000 94.0000 302.0000 116.0000 ]/Subtype /Widget /T (SubmitForm)/Type /Annot >> endobj
19 0 obj <</A <</F <</F (Reset )/FS /URL >>/S /ResetForm >>/BS <</S /B /W 1 >>/DA (/Helv 0 Tf 0 0 0 rg)/F 4 /FT /Btn /Ff 65536 /MK <</BC [0 0 0 ]/BG [0 0.5000 0 ]/CA (Reset )>>/P 12 0 R /Rect [321.0000 94.0000 375.0000 116.0000 ]/Subtype /Widget /T (ResetForm)/Type /Annot >> endobj
20 0 obj <</AS /Yes /DA (/ZaDb 20 Tf 0 0 0 rg)/DV /Yes /F 4 /FT /Btn /MK <</BC [0 0 0 ]/BG [1 1 1 ]/CA (4)>>/P 12 0 R /Rect [89.0000 418.0000 113.0000 442.0000 ]/Subtype /Widget /T (Check2)/Type /Annot /V /Yes >> endobj
21 0 obj <</AS /Yes /DA (/ZaDb 20 Tf 1 0 0 rg)/DV /Yes /F 4 /FT /Btn /MK <</BC [0 0 0 ]/BG [1 1 1 ]/CA (4)>>/P 12 0 R /Rect [439.0000 418.0000 463.0000 442.0000 ]/Subtype /Widget /T (Check1)/Type /Annot /V /Yes >> endobj
22 0 obj <</AS /Off /DA (/ZaDb 12 Tf 0 0 0 rg)/DV /Off /F 4 /FT /Btn /MK <</BC [0 0 0 ]/BG [1 1 1 ]/CA (4)>>/P 12 0 R /Rect [447.0000 364.0000 461.0000 378.0000 ]/Subtype /Widget /T (NoName1)/Type /Annot /V /Off >> endobj
23 0 obj <</DA (/Helv 12 Tf 0 0 0 rg)/DV (ITEM1)/F 4 /FT /Ch /Ff 131072 /MK <</BC [0 0 0 ]/BG [1 1 1 ]>>/Opt [(ITEM1)(ITEM2)(ITEM3)(ITEM4)]/P 12 0 R /Rect [277.0000 392.0000 332.0000 406.0000 ]/Subtype /Widget /T (Dropdown1)/Type /Annot /V (ITEM1)>> endobj
24 0 obj <</Filter /FlateDecode /Length 29 0 R >> stream
x��k�9���
��ݏ4:��XfV�&'��$�#��`���z�Տ��th�i��媲]/��d
�D���/O>%�/�J�RNr��e&UN���i� #���LR���t�$���>������RK#�EF��f4]�������%f$5���،�,�:��f�q��I"����rr�L��H� ��\%-�M�y�71��I�c��Ap��f$�'�l�(Q��$ l`Qm���u
����-3�]]Y��.2 ƺL�D�v�,�hd��#ݹ�7��.���稍,���8�W��B#�3�+�v
k��L�2�ݢ˭Ѳ���OFV���l�� ��{�:bs�^�8�{�9Ai�565#r�`�xv�QD���XL����Ь}[�ym���h܌BV��)���|����HlRl64�0�PtB������T�L�T�G_��;�u��f�k��:�~6·�?hq�Z���Β,�/Q+Cԟ��#Ľm�<Q&F<�^��'��� f��|��[�GKq���< �.����S���/<,IzP-�[��$B�C
�;��� ��a%"L_+7�@W��0���*i��^l��z� �6lL��FCH4pO���'���c���r�&���*�3k��!���6$��L�<��-�Br��
#����1�T�s�V�C�D��:��i�2��br/^i-�����
_
]����
%]}���`m��
�P�9��*���ټ��H[��1�/�H���F�V߳�W��q3-��/����l7�[�N��֛�Ȗn���>Zc�n����$�]�K�^��w[z~������edv�3���5��:��f8��1I��ZG��=m����y������o�x��Ys�.���y��uh_�7)��ԟ+�N�в4��L2�"]m��P��x��:EEjc[�0�.�������C�!+��D3�3�1£K��#�
}3'��1�#^�*��!��Z���DR����1e��6���9�c��>¹�Vg��k#>�"L�"�̢G���Yј�5����o�o���&�}�v��.��7�����e'܄��mn��}1���P�v��[#h��`\�
!��1A�C��������.ɉ6��/Q�98�ph��&�]�A�6�,[;���
�V퀆`!��r�R���]�F�3*�O��4�]Z�m#�w�E�0�Z�X�0�#ĕSD��\.��f�� �� �w5�s�3�m!<\:I��a��4!�5�$<8͠�;;��
h��e����rkk0�ă[�x�ı$O��O ���y�����3R��+Yp�������/_�]v��:k\�k�
fw�ɞ��C7�J��V�5O*5���{����9� >P���#���'��� ��Bm
�>��D�����+#M��D�'@d]Mp��q��M&p� �-"�V�K�O:5�����p�E�� ?7��2X�~�e���$��3h� ��)26���k�4Z����՟K�Q9��B��NŇ�T�9� yI?c���'��_�V(�,�Z|U&Ӊ0��◢%k�ݸnnP��Cv]���D �p6b�I�1��ѱ��� ��8�!�8��-͊�2QvKa���T�M�JelI���`w�ΦBZc��e%.�3W��a�>M|v ��?�l�{��c��w�Tcϵ����g����z'��?E����a�2�KU��r}�A��
� �^�!YVP?��(v�mZz˦eY)�2�S~k)����q5�
�9)۾Z4��n�1��)���{�����!�n���٤@MȰ8�dJA�)��(|U�f@��������
�-^%����n��.*[�*Qh�a+����
������J����U!W�����+,!����������[�k�i��ͫ�`gxK`���p��Y:��z��}�o��H�"��)�J�����JbK5X���������k�q�P��q̏u���{�`tQP~���V����68��:����?�:�*�6M��Y��Yۭ ��F�6��/u�UG�*�1i�II��Y��Hë́
�+��Q(֍J�2�ሰ±�I(qc���jT(_
�c.|������1������i���[~%(e�����tZ\+�]��V}��UH@7��^Z)tߗ�v4N���ګ��$b(��#���@�����jyHY�K�;��y\j�vɰ[��i'�횚�Dz��a��cKw÷�V@{�� �3X��� ;Y3��~q�&�=��?&����^R`\��e�q�$��-�}�X�B�^d�cۈ���J�������{B�j �����]i���7�{>�����K�S�uB��Ll[ ?Ѕ�cCןda��.�MM��C{�mN��xq�(���k`�^��/��i�uǃ��ۿw- ��[L{\o@�ش�#_(N���=a
a"��]�1�qݩ�>���Y��?>�,f�����dB��娰Z����
e-��uk�ck�q�w�DqM쎯�^�����1Wm�nxoy2�/�d2��~�E�`����2. ���覇����ol�Y�QߢZc�c6�1������W d1 H�l\����U��*����P6�W0�%��4�.�k{|�Q�.f�8�8c��>�J�$�6����`�m�f߉C�8�<ʬ�!��/d�肛Qx���b�����9
Vtt۫�!��n�R�r��;b6���7lk��T ��YK$��c�m�g�L�Y��gi�-T��iz�@|�C�nH�Ki&����/�4Z���n�i��gd�:�t�6�7��������/�BMO@���n7A4�A7���)h���0�����!�v�<ա�iR�qzQVX^�R���w�"&�����ˍ�ȳ�[�cm``�(3i
>�G� |�b-8���������5��_������sfT��k���b���0��dX��\j�V⋓'�)?��
endstream endobj
25 0 obj <</BaseFont /TimesNewRoman /Encoding /WinAnsiEncoding /FirstChar 32 /FontDescriptor 30 0 R /LastChar 255 /Subtype /TrueType /Type /Font /Widths [250 333 408 500 500 833 777 180 333 333 500 563 250 333 250 277 500 500 500 500 500 500 500 500 500 500 277 277 563 563 563 443 920 722 666 666 722 610 556 722 722 333 389 722 610 889 722 722 556 722 666 556 610 722 722 943 722 722 610 333 277 333 469 500 333 443 500 443 500 443 333 500 500 277 277 500 277 777 500 500 500 500 333 389 277 500 500 722 500 500 443 479 200 479 541 777 500 777 333 500 443 1000 500 500 333 1000 556 333 889 777 610 777 777 333 333 443 443 350 500 1000 333 979 389 333 722 777 443 722 250 333 500 500 500 500 200 500 333 759 275 500 563 333 759 500 399 548 299 299 333 576 453 250 333 299 310 500 750 750 750 443 722 722 722 722 722 722 889 666 610 610 610 610 333 333 333 333 722 722 722 722 722 722 722 563 722 722 722 722 722 722 556 500 443 443 443 443 443 443 666 443 443 443 443 443 277 277 277 277 500 500 500 500 500 500 500 548 500 500 500 500 500 500 500 500 ]>> endobj
26 0 obj <</B…"
之前有没有人遇到过这个问题?