0

Good afternoon,

A while ago I made a post on this topic to see how to send blob variables from a visualforce to the controller. Finally I did not find any solution that was useful to me, so I chose to make the http calls to the manager from the visual itself.

My new problem is the following:

I have a service with SAP in which they return a PDF encoded in Blob as follows:

%PDF-1.3
%âãÏÓ
%RSTXPDF3 Parameters:
2 0 obj
<<
/Type /FontDescriptor
/Ascent 720
/CapHeight 660
/Descent -270
/Flags 32
/FontBBox [-177 -269 1123 866]
/FontName /Helvetica
/ItalicAngle 0
/StemV 105
>>
endobj
3 0 obj
/WinAnsiEncoding
endobj
4 0 obj
<<
%Devtype HPLJ4    Font HELVE    normal Lang ES
/Type /Font
/Subtype /Type1
/BaseFont /Helvetica
/Name /F001
/Encoding 3 0 R
/FirstChar 32
/LastChar 255
%Charwidth values from HPLJ4 HELVE 080 normal
/Widths
[ 278 331 500 631 631 1000 756 331 331 331 631 1000 331 331 331 331 631 631 631 631 631 631 631 631 631 631 331 331 1000 1000 1000 519 1000 744 631 706 725 575 556 744 725 275 556 669 538 906 725 756 594 775 650 650 631 725 725 1000 725 688 613 331 331
 331 500 500 331 538 575 538 575 538 369 575 575 244 244 538 244 869 575 575 575 575 350 500 369 575 556 869 556 556 481 444 500 444 1000 0 631 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 331 631 631 631 631 500 631 225 500 406 556
 1000 0 500 225 225 1000 388 388 225 556 631 331 225 388 406 556 1000 1000 1000 519 744 744 744 744 744 744 981 706 575 575 575 575 275 275 275 275 725 725 756 756 756 756 756 1000 756 725 725 725 725 688 594 613 538 538 538 538 538 538 850 538 538 538
 538 538 244 244 244 244 575 575 575 575 575 575 575 1000 575 575 575 575 575 556 575 556]
/FontDescriptor 2 0 R
>>
endobj
5 0 obj
<<
/Type /XObject
/Subtype /Image
/Filter 6 0 R
/Length 7 0 R
/Name /00005
/Width 709
/Height 335
/BitsPerComponent 1
/ImageMask true
>>
stream
xœíÚ½ŽÜ6 pÎÉ€R§”)¡Á¥
ÃDª{ò{
ÃÔb‹IœÁ¯¢`‚¨ô#DÂi©¸a ‚<’â—DJ#7UøÇ&Ø•5¿áPü’8BäääääääääääääääääääääääääääääääääääüÍBúK\ÀóÉ5 ÐþÞJøäÛ”ú

™v`s«æ„Òìmê­˜'   ŸÜé§%L¿¾,†=çߢñÄXoW7ŠáÚ¾Ÿ¯í þ<lÃÔ@UÆ.—p:î
TÄpk?½ ¶Ö)†{
û‰ŽÀNÂIZZ˜BA°h…x´Z‡™“P»‚º¢+¸/Ƕâ ý
p_¬ÃÔIUS
·!ܞƺd þP{Z‡ûPJÀ¥…±…ÏÃ/W-Cg²·N*"Ø5_uXX‚*šŸ9„töÔ)‚Ý`f0%xEw›°—Ô‡aõvÁ QƒJ‚H¸“0[…y £%lKs
DÐ  Fë%f#ØÔm007êGÂòJX¬Ãt6­Á÷h?ŠQ¥‚×[Ù¬Šv:êÚóÔŽá(˜¨LÀ*Üo]<ÛãÈ&…„ø·„ë«pÀ"‚ÍÑÛ³§Aè$a
ÕÅ+Ö[E}®Â¡Bý¬c¢ZÅwÍ-âb¯Z;‡éƒ ƒ†Ñ:¬Bƒq—¶3G
Üäߎ˜„¯77nšƒ{pªÄ>¯Â¿™WÚ¢ÆæíËÀõh=V° <8nÇ2-¬Ä~ªš<‘|Ó 4ªƒ¬À
¢À\ššAÌ`z<&^F®`ØâDõ:O:ëËò@Qƒ”|/Û1xc˜ªcøµNÀª¡á`¨Pp_È9‚Aõ¼%`bá©0mÜí
Œ‚­KTqýª>Q¢Wpï
ÓÇó¢ùwè'“1uª/Œ…§ÂÐx&f°èÁµ:·u¯aeê$]
=X¬ø·a×nÍkâE0ƒE
ËùM˜;ؼæcê,ÝÒêC0s°9ð[úí%üI;`¢á ³&£{stÒ&Üï‚í²cû¤YZ
'›™‹éŠÛ'-^§OšlfKxû¤YÀ>¸=
s 'Û¯K?ÁÛ'…af{a¸¦Þ~
9
÷;a³¶C»á6
»Þ^-ãmí2àô²Ya"Ø,sƒâEçÿ ;a¾wn+Á¾GÏîLS0Þ„ílæAávÃõmXðÀ˜`rnç=:  ‡9ûÞù|pŸ‚åšD.)þ¼¹Äz”m²R?Kxö~1Læ=ZÂ{Ý–r’ÿÜ öUÜ£nØ»º ü\ƒ·@®µly:
Ó>SZ
>}®:uÿ/oÕŸ/‡£°îÓ8„/„¢‘áë¨c¸Dö¡"wÁ"„‡"JÅHpGÅõ*ù[÷`7.çõ   Õx¥XÃ"€Ñ3À¤£˜ýW? p'>}‡‚ÛœCð¼*hI…e…Ëÿîƒã‹Ç*óân˜F0‡®‹O÷Âq 10“0 ?|Wª‚V×uoÃ}Ó Æ×õ:¾·ê¯ÙèF}sų~¼Ìáî>¸Ž`Ù¥uÏÓðå’ìywM¦jòpºKßžþ'x6ýw&rt“0Oƒ€jt;/,j §ïšÁ‹¬`ú¡Pã±”Ãñ«SS]pPŽ¢
^š$Ã=0ö'üòoõœ'á7àAÍy¤XÂw.cé4K
ŠdåŸÄìQý^˜$áxxûV!¹¢¸ŸàùI·áÝ·cÏ׋þr ¾ã–÷6|û^Üß|¬ n´Ûîúi
Ž„ì€kß]Ï©ÓÜ£›{`4IÖuúaÓ¸u0OV£ÞOð'ƒ¡>À’Ÿ6ýÜm Ü»^E’ŸVý{ür'\"U(]ØÅCÓ]pø˜Šôc^>æUÙ¼%
``$žÑû ÓGawëÂ’»
Ó“Äð‰÷!¸šŠžØ ñÏèÃƸ vÛmrç&Þ®Ø
Oƒv7    ¸˜(¼Ì®¦(†ã-¡½p¸›Ø(6±ŽÂ¤,`Ó5Zàú´ZB4BeCþ¯Q,…ú!H=àö&g…j·¿ù¼GìÀÿ« ì(_Ñ–lúP)¸JnmÂðË
¢•åj~ùæ-bï¿‚?ýóEÕ‘WèÇÿàÇ‚~ƒB8ÜŒKlê ØŒU»ýMËå
žâêÇ÷èÜÉ…ç“ü} ®ÁñÅ3W-Ü>¦X4?«Íy"šGy÷¯vêÏA2Nû÷¥qrÇ_aIø"*¨nAžäò»ëDuV+úqj-wÒE›£Áòr
7p¼Šî¬à³hšìý'º4ˆ¾T€8M'- ÿ.aÑ5ò‡¿Q÷Q³æôxr )¹<Â׆!?à9ÜF•êÿŒ¿¸áá«‚yéáwp÷NŠ zwÑÌE4•
î®=(°xšÃ¾½¡Ž¿ãáß5ÜVÆ`ÖA‚ö†#8þ:~îªàkwUƒ+mU˜-M»f‘øf“ëʽýe ‹'óY ñVâ»X® ®èþ4ÁWÏÛ±o‰o¹ª¥6­blT« bp£[ÅÓ,åa{õ`»Æà 
há²çIxœzÞöSã4ìΙú´+$ü§¼1ít‰åXaºôÁµ[ÀÀÂ~°Ð£›„)$âܨ±â¡„Õ趨cSÉU§¾¬¨Çc#9Ë.}‘ã1j8ª‚­Â´d”†—_¯Tî
fˆ}%Kú¢ìÈK,a9ƒ¸ÙÙÂx`/¾ªÑsž†9@²KWjΫ8Rs‹°aÜè«©ÚÌÒºÛ=Æg· 6srrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrþ¢üœÞ³
endstream
endobj
7 0 obj
2186
endobj
6 0 obj

[/FlateDecode]
endobj
8 0 obj
æqÇOÆîÿ#ºØUÊCÓñÀ2E{3å/åµÝSX=ߣHʬ*I»è¼ÎXµ­¨uW²ò#Šú'/ÿcß}…žuWahV?åîÚ/n˜“{²|Ÿú
±º£ž<"Uñÿ3õ!÷X¼ŠÙ¢ãEÎðèÍ(®é½ôCzÑô¥*¯<î»]~òO¹@G…Ü,¶í;wU}­3Ç;ãbã{Ò4Ç ¾jßùBÕ{Xý`\…ÒŠÿïÈGtÆÞø"{¸wlêø6°VŠd<‹Ëîƃì¿ö®ÛúŽ_nyù=å—k^þó Ù—“ëö-,ŸçÛ%¹Í_JÝ¡°úŸôåô-ûÖçDÞûlHXƒ—¯–¿š¾åÞúÜ*‰„È“[¡1ÀT/RÒ ï¤.=Â"7°E&à=‘²hÚòs0'gX­P@qð…S>¾«„ÑÇðÂO†µâÙë¨à‡íÙGÏu¶ÿÏÏÏI|ûǘüÿ º$¦
endstream
endobj
10 0 obj
4916
endobj
9 0 obj

[/FlateDecode/RunLengthDecode]
endobj
11 0 obj
<<
/Type /FontDescriptor
/Ascent 720
/CapHeight 660
/Descent -270
/Flags 96
/FontBBox [-177 -269 1123 866]
/FontName /Helvetica-Oblique
/ItalicAngle -20
/StemV 105
>>
endobj
12 0 obj
<<
%Devtype HPLJ4    Font HELVE    italic Lang ES
/Type /Font
/Subtype /Type1
/BaseFont /Helvetica-Oblique
/Name /F002
/Encoding 3 0 R
/FirstChar 32
/LastChar 255
%Charwidth values from HPLJ4 HELVE 080 italic
/Widths
[ 278 331 500 631 631 1000 756 331 331 331 631 1000 331 331 331 331 631 631 631 631 631 631 631 631 631 631 331 331 1000 1000 1000 519 1000 744 631 706 725 575 556 744 725 275 556 669 538 906 725 756 594 775 650 650 631 725 725 1000 725 688 613 331 331
 331 500 500 331 538 575 538 575 538 369 575 575 244 244 538 244 869 575 575 575 575 350 500 369 575 556 869 556 556 481 444 500 444 1000 0 631 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 331 631 631 631 631 500 631 225 500 406 556
 1000 0 500 225 225 1000 388 388 225 556 631 331 225 388 406 556 1000 1000 1000 519 744 744 744 744 744 744 981 706 575 575 575 575 275 275 275 275 725 725 756 756 756 756 756 1000 756 725 725 725 725 688 594 613 538 538 538 538 538 538 850 538 538 538
 538 538 244 244 244 244 575 575 575 575 575 575 575 1000 575 575 575 575 575 556 575 556]
/FontDescriptor 11 0 R
>>
endobj
13 0 obj
<<
/Type /FontDescriptor
/Ascent 720
/CapHeight 660
/Descent -270
/Flags 32
/FontBBox [-177 -269 1123 866]
/FontName /Helvetica-Bold
/ItalicAngle 0
/StemV 105
>>
endobj
14 0 obj
<<
%Devtype HPLJ4    Font HELVE    bold Lang ES
/Type /Font
/Subtype /Type1
/BaseFont /Helvetica-Bold
/Name /F003
/Encoding 3 0 R
/FirstChar 32
/LastChar 255
%Charwidth values from HPLJ4 HELVE 100 bold
/Widths
[ 278 335 520 630 630 1000 760 335 335 335 630 1000 335 335 335 335 630 630 630 630 630 630 630 630 630 630 335 335 1000 1000 1000 520 1000 740 630 705 720 575 555 740 720 280 555 665 535 905 720 760 595 780 650 650 630 720 720 1000 720 685 610 335 335
 335 500 500 335 535 575 535 575 535 370 575 575 240 240 535 240 870 575 575 575 575 350 500 370 575 555 870 555 555 480 500 500 500 1000 0 630 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 335 630 630 630 630 500 630 220 500 405 555
 1000 0 500 220 220 1000 390 390 220 595 630 335 220 390 405 555 1000 1000 1000 520 740 740 740 740 740 740 980 705 575 575 575 575 280 280 280 280 720 720 760 760 760 760 760 1000 760 720 720 720 720 685 595 610 535 535 535 535 535 535 850 535 535 535
 535 535 240 240 240 240 575 575 575 575 575 575 575 1000 575 575 575 575 575 555 575 555]
/FontDescriptor 13 0 R
>>
endobj
15 0 obj
<<
/Length 16 0 R
>>
stream
 q 1 g 0 g 0.50 w 5.65 76.55 547.10 408.20 re S Q q 1 g 0 g 0.50 w 62.35 399.70 0.00 85.05 re S Q q 1 g 0 g 0.50 w 277.80 399.70 0.00 85.05 re S Q q 1 g 0 g 0.50 w 368.50 399.70 0.00 85.05 re S Q q 1 g 0 g 0.50 w 462.05 399.70 0.00 85.05 re S Q q 1 g 0 g
 0.50 w 277.80 649.15 274.95 141.75 re S Q q 1 g 0 g 0.50 w 5.65 564.15 547.10 51.00 re S Q q 0.90 g 6.40 597.40 545.95 17.00 re f Q q 0.90 g 6.40 564.10 545.95 17.00 re f Q q 1 g 0 g 0.50 w 5.65 530.10 547.10 34.00 re S Q q 1 g 0 g 0.50 w
 5.65 501.75 547.10 28.35 re S Q q 1 g 0 g 0.50 w 277.80 501.75 0.00 28.35 re S Q q 0.90 g 5.65 484.75 547.10 17.00 re f 0 g 0.50 w 5.65 484.75 547.10 17.00 re S Q q 1 g 0 g 0.50 w 62.35 484.75 0.00 17.00 re S Q q 1 g 0 g 0.50 w
 277.80 484.75 0.00 17.00 re S Q q 1 g 0 g 0.50 w 368.50 484.75 0.00 17.00 re S Q q 1 g 0 g 0.50 w 462.05 484.75 0.00 17.00 re S Q q 0.90 g 187.10 399.70 365.65 17.00 re f 0 g 0.50 w 187.10 399.70 365.65 17.00 re S Q q 1 g 0 g 0.50 w
 413.85 331.65 0.00 85.05 re S Q q 1 g 0 g 0.50 w 462.05 331.65 0.00 85.05 re S Q q 1 g 0 g 0.50 w 552.75 331.65 0.00 85.05 re S Q q 1 g 0 g 0.50 w 187.10 382.70 365.65 17.00 re S Q q 1 g 0 g 0.50 w 187.10 365.70 365.65 17.00 re S Q q 1 g 0 g 0.50 w
 187.10 348.70 365.65 17.00 re S Q q 1 g 0 g 0.50 w 187.10 331.65 365.65 17.00 re S Q q 0.90 g 5.65 331.65 181.40 85.05 re f 0 g 0.50 w 5.65 331.65 181.40 85.05 re S Q q 0.90 g 5.65 314.65 547.10 17.00 re f 0 g 0.50 w 5.65 314.65 547.10 17.00 re S Q q
 1 g 0 g 0.50 w 462.05 314.65 0.00 17.00 re S Q q 1 g 0 g 0.50 w 5.65 161.60 547.10 153.05 re S Q q 0.90 g 277.80 144.60 274.95 17.00 re f 0 g 0.50 w 277.80 144.60 274.95 17.00 re S Q q 0.90 g 277.80 110.55 274.95 17.00 re f 0 g 0.50 w
 277.80 110.55 274.95 17.00 re S Q q 0.90 g 277.80 110.55 274.95 17.00 re f 0 g 0.50 w 277.80 110.55 274.95 17.00 re S Q q 0.90 g 277.80 76.55 274.95 17.00 re f 0 g 0.50 w 277.80 76.55 274.95 17.00 re S Q q 1 g 0 g 0.50 w 5.65 76.55 547.10 85.05 re S Q q
 1 g 0 g 0.50 w 277.80 76.55 0.00 85.05 re S Q q 1 g 0 g 0.50 w 462.05 76.55 0.00 85.05 re S Q /F001 8.00 Tf 1.80 Tw 0 g BT 17.00 472.75 Td <363030303030>Tj ET 0 g BT 73.70 472.75 Td
 <4147454E44412020202020202020202020202020202020202020202020202020202020>Tj ET 0 g BT 272.10 472.75 Td <20202020202020202020202020203735302C303020>Tj ET 0 g BT 377.65 472.75 Td <20202020202020202020203232352C303020>Tj ET 0 g BT 465.55 472.75 Td
 <20202020202020202020203532352C303020>Tj ET q 0 0 0 rg 170.15 0 0 80.40 6 722 cm /00005 Do Q q 0 0 0 rg 198.70 0 0 86.15 6 625 cm /00008 Do Q /F002 8.00 Tf 1.80 Tw 0 g BT 5.65 64.55 Td <50E167696E613A20312020646520>Tj ET 0 g BT 62.75 64.55 Td
 <20202032>Tj ET /F002 8.00 Tf 1.80 Tw 0 g BT 430.85 64.55 Td <454A454D504C4152205041524120454C20434C49454E5445>Tj ET /F002 6.00 Tf 1.35 Tw 0 g BT 5.65 52.55 Td
 <4943455820636F6E20646F6D6963696C696F20656E20506173656F206465206C612043617374656C6C616E6120323738206465204D61647269642C20646520>Tj ET 0 g BT 198.65 52.55 Td
 <6163756572646F20636F6E206C6F2064697370756573746F20656E206C61206E6F726D617469766120766967656E746520656E206D61746572696120646520>Tj ET 0 g BT 388.40 52.55 Td
 <70726F7465636369F36E206465206461746F7320646520636172E16374657220706572736F6E616C2C206C6520696E666F726D61206465>Tj ET 0 g BT 5.65 40.55 Td
 <71756520737573206461746F7320706572736F6E616C657320736572E16E20696E636F72706F7261646F73206120756E206669636865726F20646520737520>Tj ET 0 g BT 195.95 40.55 Td
 <746974756C617269646164207920736572E16E207472617461646F7320706F7220E97374652C20636F6E206C612066696E616C6964616420646520>Tj ET 0 g BT 361.95 40.55 Td
 <67657374696F6E6172206C6F7320636F62726F7320636F72726573706F6E6469656E7465732E20557374656420706F6472E120656A6572636974617220>Tj ET 0 g BT 538.30 40.55 Td <737573>Tj ET 0 g BT 5.65 28.55 Td
 <6465726563686F732064652061636365736F2C207265637469666963616369F36E2C2063616E63656C616369F36E2075206F706F73696369F36E20646520>Tj ET 0 g BT 187.25 28.55 Td
 <737573206461746F7320646972696769656E646F20756E61206E6F7469666963616369F36E206120494345582061206C612064697265636369F36E20>Tj ET 0 g BT 360.80 28.55 Td <696E64696361646120616E746572696F726D656E74652E>Tj ET /F001 10.00 Tf 2.20 Tw 0 g BT 283.45 773.20 Td
 <434F4445524C414E442045535041D14120534F434945444144204C494D49544144412E>Tj ET /F001 10.00 Tf 2.20 Tw 0 g BT 283.45 749.20 Td <505A41>Tj ET /F001 8.00 Tf 1.80 Tw 0 g BT 302.90 749.20 Td <20>Tj ET /F001 10.00 Tf 2.20 Tw 0 g BT 306.90 749.20 Td
 <50494F204241524F4A412C2033>Tj ET /F001 8.00 Tf 1.80 Tw 0 g BT 283.45 737.20 Td <31AA20504C414E5441>Tj ET /F001 10.00 Tf 2.20 Tw 0 g BT 283.45 725.20 Td <3438303031>Tj ET /F001 8.00 Tf 1.80 Tw 0 g BT 314.95 725.20 Td <2C20>Tj ET /F001 10.00 Tf 2.20 Tw
 0 g BT 321.60 725.20 Td <42696C62616F>Tj ET /F001 10.00 Tf 2.20 Tw 0 g BT 283.45 713.20 Td <56495A43415941>Tj ET /F003 10.00 Tf 2.20 Tw 0 g BT 11.30 603.15 Td <4EBA20505245535550554553544F>Tj ET 0 g BT 161.55 603.15 Td <3739303834313936>Tj ET 0 g BT
 277.80 603.15 Td <4EBA2046414354555241>Tj ET 0 g BT 428.00 603.15 Td <32343731323030373137>Tj ET 0 g BT 11.30 586.90 Td <464543484120444520505245535550554553544F>Tj ET 0 g BT 161.55 586.90 Td <30372E30362E32303234>Tj ET 0 g BT 277.80 586.90 Td
 <46454348412046414354555241>Tj ET 0 g BT 428.00 586.90 Td <31332E30362E32303234>Tj ET 0 g BT 11.30 570.65 Td <43D34449474F20434C49454E5445>Tj ET 0 g BT 161.55 570.65 Td <313831373030>Tj ET 0 g BT 277.80 570.65 Td <4E4946>Tj ET 0 g BT 428.00 570.65 Td
 <423732363431373732>Tj ET /F003 8.00 Tf 1.80 Tw 0 g BT 14.15 549.45 Td <464F524D41204445205041474F3A>Tj ET /F003 10.00 Tf 2.20 Tw 0 g BT 86.80 549.45 Td <20202020>Tj ET /F003 8.00 Tf 1.80 Tw 0 g BT 106.80 549.45 Td
 <4943422020436F627261646F207472616E73666572656E636961>Tj ET /F003 10.00 Tf 2.20 Tw 0 g BT 14.15 512.40 Td <202020204F666963696E612064652056656E7461733A204F747461776120202020202020202020202020202020202020>Tj ET 0 g BT 277.80 512.40 Td
 <2020202020202020202020204EBA20534552564943494F3A202053502D30303030303634383338>Tj ET /F003 10.00 Tf 2.20 Tw 0 g BT 11.30 489.75 Td <20434F4449474F>Tj ET 0 g BT 62.35 489.75 Td <2020202020202020202020202020434F4E434550544F>Tj ET 0 g BT 277.80 489.75 Td
 <20202020202050524543494F>Tj ET 0 g BT 368.50 489.75 Td <2020494D504F5254452044544F53>Tj ET 0 g BT 462.05 489.75 Td <2020202020494D504F525445>Tj ET /F001 8.00 Tf 1.80 Tw 0 g BT 187.05 405.55 Td <2020202020202020202020202020202020202020202020>Tj ET
 /F003 10.00 Tf 2.20 Tw 0 g BT 279.05 405.55 Td <434F4E434550544F>Tj ET /F001 8.00 Tf 1.80 Tw 0 g BT 333.55 405.55 Td <20202020202020202020202020202020202020202020202020>Tj ET /F003 10.00 Tf 2.20 Tw 0 g BT 433.55 405.55 Td <25>Tj ET /F001 8.00 Tf 1.80 Tw
 0 g BT 443.55 405.55 Td <2020202020202020202020>Tj ET /F003 10.00 Tf 2.20 Tw 0 g BT 487.55 405.55 Td <494D504F525445>Tj ET /F001 8.00 Tf 1.80 Tw 0 g BT 187.05 388.75 Td <204463746F2067656E6572616C>Tj ET 0 g BT 386.65 388.75 Td
 <2020202020202020202033302C303020>Tj ET 0 g BT 465.50 388.75 Td <20202020202020202020203232352C303020>Tj ET 0 g BT 187.05 371.95 Td <20>Tj ET 0 g BT 187.05 355.15 Td <20>Tj ET 0 g BT 187.05 338.35 Td <20>Tj ET /F003 10.00 Tf 2.20 Tw 0 g BT
 5.65 368.70 Td <2020202020444553474C4F5345204445204445534355454E544F53>Tj ET /F003 10.00 Tf 2.20 Tw 0 g BT 5.65 319.65 Td <20202020202020202020202020202020202020202020202020202020202020202020202020544F54414C204445534355454E544F>Tj ET 0 g BT
 446.55 319.65 Td <20202020202020202020203232352C303020>Tj ET /F003 10.00 Tf 2.20 Tw q 0.00 w 0 g 14.15 299.30 84.15 1.00 re f Q 0 g BT 14.15 299.80 Td <4F42534552564143494F4E4553>Tj ET /F001 8.00 Tf 1.80 Tw 0 g BT 14.15 271.55 Td
 <4C6120646573637269706369F36E2064656C20736572766963696F2073652061646A756E746120616C20646F72736F2064656C20646F63756D656E746F2E>Tj ET /F003 8.00 Tf 1.80 Tw 0 g BT 283.50 150.25 Td <544F54414C2053494E20495641>Tj ET /F001 8.00 Tf 1.80 Tw 0 g BT
 465.55 150.25 Td <20202020202020202020203532352C303020>Tj ET /F003 8.00 Tf 1.80 Tw 0 g BT 283.50 133.25 Td <49564120726570657263757469646F20323125>Tj ET /F001 8.00 Tf 1.80 Tw 0 g BT 465.55 133.25 Td <20202020202020202020203131302C323520>Tj ET
 /F003 8.00 Tf 1.80 Tw 0 g BT 283.50 116.25 Td <535542544F54414C>Tj ET /F001 8.00 Tf 1.80 Tw 0 g BT 465.55 116.25 Td <20202020202020202020203633352C323520>Tj ET /F003 8.00 Tf 1.80 Tw 0 g BT 283.50 99.25 Td <5355504C49444F53>Tj ET /F001 8.00 Tf 1.80 Tw
 0 g BT 467.65 99.25 Td <20202020202020202020202020302C303020>Tj ET /F003 12.00 Tf 2.65 Tw 0 g BT 283.50 82.25 Td <544F54414C204575726F>Tj ET /F003 12.00 Tf 2.65 Tw 0 g BT 412.55 82.25 Td <20202020202020202020202020203633352C323520>Tj ET
endstream
endobj
16 0 obj
8555
endobj
17 0 obj
<<
/Type /Page
/MediaBox
[0 0 595 842]
/Parent 1 0 R
/Resources
<<
/ProcSet
[/PDF /Text /ImageB]
/Font
<<
/F001 4 0 R
/F002 12 0 R
/F003 14 0 R
>>
/XObject
<<
/00005 5 0 R
/00008 8 0 R
>>
>>
/Contents 15 0 R
>>
endobj
18 0 obj
<<
/Type /XObject
/Subtype /Image
/Filter 19 0 R
/Length 20 0 R
/Name /00018
/Width 709
/Height 335
/BitsPerComponent 1
/ImageMask true
>>
stream
xœíÚ½ŽÜ6 pÎÉ€R§”)¡Á¥
ÃDª{ò{
ÃÔb‹IœÁ¯¢`‚¨ô#DÂi©¸a ‚<’â—DJ#7UøÇ&Ø•5¿áPü’8BäääääääääääääääääääääääääääääääääääüÍBúK\ÀóÉ5 ÐþÞJøäÛ”ú

™v`s«æ„Òìmê­˜'   ŸÜé§%L¿¾,†=çߢñÄXoW7ŠáÚ¾Ÿ¯í þ<lÃÔ@UÆ.—p:î
JX¬Ãt6­Á÷h?ŠQ¥‚×[Ù¬Šv:êÚóÔŽá(˜¨LÀ*Üo]<ÛãÈ&…„ø·„ë«pÀ"‚ÍÑÛ³§Aè$a
ÕÅ+Ö[E}®Â¡Bý¬c¢ZÅwÍ-âb¯Z;‡éƒ ƒ†Ñ:¬Bƒq—¶3G
eCþ¯Q,…ú!H=àö&g…j·¿ù¼GìÀÿ« ì(_Ñ–¹ª¥6­blT« bp£[ÅÓ,åa{õ`»Æà 
há²çIxœzÞöSã4ìΙú´+$ü§¼1ít‰åXaºôÁµ[ÀÀÂ~°Ð£›„)$âܨ±â¡„Õ趨cSÉU§¾¬¨Çc#9Ë.}‘ã1j8ª‚­Â´d”†—_¯Tî
fˆ}%Kú¢ìÈK,a9ƒ¸ÙÙÂx`/¾ªÑsž†9@²KWjΫ8Rs‹°aÜè«©ÚÌÒºÛ=Æg· 6srrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrþ¢üœÞ³
endstream
endobj
20 0 obj
2186
endobj
19 0 obj

[/FlateDecode]
endobj
21 0 obj
<<
/Type /XObject
/Subtype /Image
/Filter 22 0 R
/Length 23 0 R
/Name /00021
/Width 828
/Height 359
/BitsPerComponent 1
/ImageMask true
>>
stream
xœšÏÇuÇ«·w·—"¹MŠ”DÚë-)
’Cœ@B.4°ØJ ¼Ð¿`ÿ    ]h`0Ý‹5Ô<läf‚yK¾IJ€”^ÃŽra;@·:È9ÄÕ¢~ÔÚÅzù¾ªîÙ™!i 
ÎÎv}^½éWïgߧ÷—~Ö
™”Hlþ-µdDlHdŽÖ´H¾¢µ’f'$äwÙì[ŽDBV¤”
õ5K61K¾M3–ü¨'§¢õ3D“¹h.Xôæ\Ôˆ 
ý¥eñòâ1‹CBŸ5”èL’É
ƒj8ƒl\Ók8ä38 Ç¥‡ÊÞ¶fAEMrPq›ºR« ïÜxð“…SŽóàGö«M:ö
¬š+

*’—z{Ù£4ñ @ÄÕi4 Oy
p
AƒŽ¡!¿
âõ
zí¹œ˜Œôè©‘³ò1ÒQìCŽµì(¾¥s”Ä8‰}Ó²šés•P³7*¡hYÉRâ^E’U¨ ‚O;¨èø´“ñ(à"2îÝpógJ²;AÌÞ¬ªs˜OÐ`xÞ}Ókx¹/F
5¶®Aïs²š“› [ËÏj·$*KúÚœ¢8;íxäEEà'JepdOž  $ùo_7\Š(
.¥ÏM†ððèŸbâ(::žoDì‡#oHB˜sfÎ!K9ùÉ.†°·ó‹¤‹¸I¿ùc?+Eþ+¡*³IØS#Gý’_Ÿüò™Ù'ô„ñŒì•ï€ž â¨?¯Cãx]Èg\ÿ÷ãé¸ÀU %Ú+éb¾óÊÿr¿ôøþÊ¥ŽNV/·fõÒ£êïïÓé°FqÅÔxÍð#¢¾Ê*Ñ‘ÛËb*ó°pq+g(3Vºø!ýÐ?~
ðèÍ(®é½ôCzÑô¥*¯<î»]~òO¹@G…Ü,¶í;wU}­3Ç;ãbã{Ò4Ç ¾jßùBÕ{Xý`\…ÒŠÿïÈGtÆÞø"{¸wlêø6°VŠd<‹Ëîƃì¿ö®ÛúŽ_nyù=å—k^þó Ù—“ëö-,ŸçÛ%¹Í_JÝ¡°úŸôåô-ûÖçDÞûlHXƒ—¯–¿š¾åÞúÜ*‰„È“[¡1ÀT/RÒ ï¤.=Â"7°E&à=‘²hÚòs0'gX­P@qð…S>¾«„ÑÇðÂO†µâÙë¨à‡íÙGÏu¶ÿÏÏÏI|ûǘüÿ º$¦
endstream
endobj
23 0 obj
4916
endobj
22 0 obj

[/FlateDecode/RunLengthDecode]
endobj
24 0 obj
<<
/Length 25 0 R
>>
stream
 q 1 g 0 g 0.50 w 5.65 76.55 547.10 487.55 re S Q q 1 g 0 g 0.50 w 277.80 649.15 274.95 141.75 re S Q q 1 g 0 g 0.50 w 5.65 564.15 547.10 51.00 re S Q q 0.90 g 6.40 597.40 545.95 17.00 re f Q q 0.90 g 6.40 564.10 545.95 17.00 re f Q q 1 g 0 g 0.50 w
 5.65 530.10 547.10 34.00 re S Q q 1 g 0 g 0.50 w 5.65 501.75 547.10 28.35 re S Q q 1 g 0 g 0.50 w 277.80 501.75 0.00 28.35 re S Q q 1 g 0 g 0.50 w 5.65 76.55 547.10 425.20 re S Q /F003 10.00 Tf 2.20 Tw q 0.00 w 0 g 11.35 472.25 35.15 1.00 re f Q 0 g BT
 11.35 472.75 Td <414E45584F>Tj ET /F001 8.00 Tf 1.80 Tw 0 g BT 11.35 444.50 Td <446573637269706369F36E3A>Tj ET 0 g BT 11.35 432.50 Td
 <436F6465726C616E642045737061F16120534C2C20636F6D7061F1ED61206465207472616E73666F726D616369F36E206469676974616C207920>Tj ET 0 g BT 246.25 432.50 Td
 <6465736172726F6C6C6F20646520736F6674776172652C20736F6C696369746120756E61206167656E6461206465207265756E696F6E657320>Tj ET 0 g BT 469.40 432.50 Td <706572736F6E616C697A61646120636F6E>Tj ET 0 g BT 11.35 420.50 Td
 <706F74656E6369616C657320736F63696F7320636F6D65726369616C65732E>Tj ET 0 g BT 11.35 396.50 
<656D70726573617320612064657465726D696E617220656E747265206C6120656D70726573612079206C61204F666963696E612045636F6EF36D6963612079>Tj ET 0 g BT 491.15 372.50 Td <20436F6D65726369616C2061>Tj ET 0 g BT 11.35 360.50 Td
 <20696E646963616E646F20696E666F726D616369F36E20646520696E746572E9732070657263696269646120647572616E7465206C6120>Tj ET 0 g BT 480.60 276.50 Td <656C61626F72616369F36E2064656C>Tj ET 0 g BT 11.35 264.50 Td <736572766963696F2E>Tj ET q 0 0 0 rg
 170.15 0 0 80.40 6 722 cm /00018 Do Q q 0 0 0 rg 198.70 0 0 86.15 6 625 cm /00021 Do Q /F002 8.00 Tf 1.80 Tw 0 g BT 5.65 64.55 Td <50E167696E613A203220646520>Tj ET 0 g BT 58.75 64.55 Td <20202032>Tj ET /F002 8.00 Tf 1.80 Tw 0 g BT 430.85 64.55 Td
 <454A454D504C4152205041524120454C20434C49454E5445>Tj ET /F002 6.00 Tf 1.35 Tw 0 g BT 5.65 52.55 Td <4943455820636F6E20646F6D6963696C696F20656E20506173656F206465206C612043617374656C6C616E6120323738206465204D61647269642C20646520>Tj ET 0 g BT
 198.65 52.55 Td <6163756572646F20636F6E206C6F2064697370756573746F20656E206C61206E6F726D617469766120766967656E746520656E206D61746572696120646520>Tj ET 0 g BT 388.40 52.55 Td
 <70726F7465636369F36E206465206461746F7320646520636172E16374657220706572736F6E616C2C206C6520696E666F726D61206465>Tj ET 0 g BT 5.65 40.55 Td
 <71756520737573206461746F7320706572736F6E616C657320736572E16E20696E636F72706F7261646F73206120756E206669636865726F20646520737520>Tj ET 0 g BT 195.95 40.55 Td
 <746974756C617269646164207920736572E16E207472617461646F7320706F7220E97374652C20636F6E206C612066696E616C6964616420646520>Tj ET 0 g BT 361.95 40.55 Td
 <67657374696F6E6172206C6F7320636F62726F7320636F72726573706F6E6469656E7465732E20557374656420706F6472E120656A6572636974617220>Tj ET 0 g BT 538.30 40.55 Td <737573>Tj ET 0 g BT 5.65 28.55 Td
 <6465726563686F7696369F36E20646520>Tj ET 0 g BT 187.25 28.55 Td
 <737573206461746F7336369F36E20>Tj ET 0 g BT 360.80 28.55 Td <696E64696361646120616E746572696F726D656E74652E>Tj ET /F001 10.00 Tf 2.20 Tw 0 g BT 283.45 773.20 Td
 <434F4445524C414E442045535041D14120534F434945444144204C494D49544144412E>Tj ET /F001 10.00 
 <46454348412046414354555241>Tj ET 0 g BT 428.00 586.90 Td <31332E30362E32303234>Tj ET 0 g BT 11.30 570.65 Td <43D34449474F20434C49454E5445>Tj ET 0 g BT 161.55 570.65 Td <313831373030>Tj ET 0 g BT 277.80 570.65 Td <4E4946>Tj ET 0 g BT 428.00 570.65 Td
 <423732363431373732>Tj ET /F003 8.00 Tf 1.80 Tw 0 g BT 14.15 549.45 Td <464F524D41204445205041474F3A>Tj ET /F003 10.00 Tf 2.20 Tw 0 g BT 86.80 549.45 Td <20202020>Tj ET /F003 8.00 Tf 1.80 Tw 0 g BT 106.80 549.45 Td
 <4943422020436F627261646F207472616E73666572656E636961>Tj ET /F003 10.00 Tf 2.20 Tw 0 g BT 14.15 512.40 Td <202020204F666963696E612064652056656E7461733A204F747461776120202020202020202020202020202020202020>Tj ET 0 g BT 277.80 512.40 Td
 <2020202020202020202020204EBA20534552564943494F3A202053502D30303030303634383338>Tj ET
endstream
endobj
25 0 obj
6925
endobj
26 0 obj
<<
/Type /Page
/MediaBox
[0 0 595 842]
/Parent 1 0 R
/Resources
<<
/ProcSet
[/PDF /Text /ImageB]
/Font
<<
/F001 4 0 R
/F002 12 0 R
/F003 14 0 R
>>
/XObject
<<
/00018 18 0 R
/00021 21 0 R
>>
>>
/Contents 24 0 R
>>
endobj
27 0 obj
<<
/Author (TECHEDGE )
/CreationDate (D:20240613134714)
/Creator (Form ZF_FACT_SSPP ES)
/Producer (SAP NetWeaver 701 )
%SAPinfoStart TOA_DARA
%FUNCTION=(    )
%MANDANT=(   )
%DEL_DATE=(00000000)
%SAP_OBJECT=(          )
%AR_OBJECT=(          )
%OBJECT_ID=(                                                  )
%FORM_ID=(                                        )
%FORMARCHIV=(  )
%RESERVE=(                           )
%NOTIZ=(                                                                )
%-(                                                                )
%-(                                                                )
%-(                                                                )
%SAPinfoEnd TOA_DARA
>>
endobj
1 0 obj
<<
/Type /Pages
/Kids
[ 17 0 R
 26 0 R
]
/Count 2
>>
endobj
28 0 obj
<<
/Type /Catalog
/Pages 1 0 R
/PageMode /UseNone
>>
endobj
xref
0 29
0000000000 65535 f
0000036151 00000 n
0000000040 00000 n
0000000225 00000 n
0000000260 00000 n
0000001377 00000 n
0000003772 00000 n

trailer
<<
/Size 29
/Root 28 0 R
/Info 27 0 R
>>
startxref
36305
%%EOF

My question is, how can I treat that variable as it comes to me from SAP to send it as a blob from APEX?

How could I store it to put it as input in the APEX call?

EDIT:

The problem really is that I have a SAP service that currently returns a PDF in base64. We are in the process of changing the external application of the document manager, the new one only supports the content of the file as a blob, it no longer supports base64 (due to legal issues they do not want to use it).

The new service will return the pdf blob as indicated above, but I don't know how I can manage it in APEX: The code with which I make the call is this:

    public void ALF_AddDocumento(???? file) {
                   
        String ALF_ticket = ALF_getTicket();
        String BaseURL = 'https://pre-alhacena.icex.es/alfresco/s/icex';
        String Endpoint = BaseURL + '/records/new/files?alf_ticket=' + ALF_ticket;
        String jsonData = '{"tipoDocumento":"D023","subTipoDoc":"","titulo":"Programa (1)","nombre":"Programa (1).pdf","autor":"CRM_Integracion","fechaRegistroAplicativo":"2024-06-12T11:22:50","idioma":"I40","objSalesForce":"OS33","nombreDescripcion":"ES-01461","anoCamp":"","origenENI":"","estadoElaboracion":"","identificadorDocOrigen":"","nombreFormato":"","tipoDocumental":"","tipoFirma":"","valorCSV":"","defGeneracionCSV":"","codPoliticaAcceso":"","clasificacionENS":"","nivelConfidencialidad":"","tipoAcceso":""}';
        String jsonDataExp = '{"origen":"O3","service":"O3S5","anoExp":"9876","convocatoria":"","proceso":"","fechaApertura":"2024-06-12T11:22:50","interesado":"","identificadorExterno":"ICEX_CLI_0015800000yyvc3AAA"}';
        // Crear la solicitud HTTP
        HttpRequest req = new HttpRequest();
        String boundary = '--------------------------' + DateTime.now().getTime();
        String CRLF = '\r\n';
        req.setEndpoint(Endpoint);
        req.setMethod('POST');
        req.setHeader('Content-Type', 'multipart/form-data; boundary=' + boundary);

        
        // Construir el cuerpo de la solicitud

        String body = '--' + boundary + CRLF;
        body += 'Content-Disposition: form-data; name="content"; filename="programa.pdf' + CRLF;
        body += 'Content-Type: application/octet-stream' + CRLF + CRLF;
        body += file + CRLF;

        body += '--' + boundary + CRLF;
        body += 'Content-Disposition: form-data; name="data"' + CRLF + CRLF;
        body += jsonData + CRLF;

        body += '--' + boundary + CRLF;
        body += 'Content-Disposition: form-data; name="dataExp"' + CRLF + CRLF;
        body += jsonDataExp + CRLF;

        body += '--' + boundary + '--' + CRLF;

        req.setBody(body);

        // Enviar la solicitud
        Http http = new Http();
        HTTPResponse res = http.send(req);

        // Manejar la respuesta
        if (res.getStatusCode() == 200) {
            System.debug('Solicitud exitosa: ' + res.getBody());
        } else {
            System.debug('Error en la solicitud: ' + res.getStatusCode() + ' ' + res.getBody());
        }
    }

I don't know how to store the variable I receive and how to use it as input to the code

7
  • The contents of the PDF are relatively useless, and don't need to be provided for us to help you. What we would like, however, is the Visualforce and Apex code that you have so far. This will help us identify a solution for your problem. Please edit your question to include the relevant code.
    – sfdcfox
    Commented Jun 18 at 13:49
  • Ok, I'm going to edit the question, but what I'm getting at is that I don't have visual, only apex.
    – Banzoni
    Commented Jun 18 at 14:18
  • @sfdcfox edited!
    – Banzoni
    Commented Jun 18 at 14:42
  • Based on your edit, I have linked a Q&A that should help you get where you're trying to go. If you need further help, please let us know, and we'll be happy to help.
    – sfdcfox
    Commented Jun 18 at 15:27
  • Thank you very much, the article has been very useful to me. But I have a doubt, in the multipartform I want to add the content and two text keys, I have tried different ways to add everything but I get an error. Would you know how to add what I indicated about Data and DateaExp?
    – Banzoni
    Commented Jun 19 at 9:51

0

Browse other questions tagged .