I’m using pd4ml to generate pdf using pd4ml taglib. The jsp is rendered with wired characters instead of showing pdf. we are using tiles for rendering jsp.
ex: %PDF-1.4 %Çåôåð 1 0 obj << /Filter /FlateDecode /Length 940 >> stream xÚÅWmsÚ8þÅ»IfcùÇÌäKBÒÒÐë]aPk[$pé¯ïÊÉÌ&×aÒJÚgß´»Ü[?Á ë÷9¼^D` nuß>ÚÎ_$@úõí#ùÏQ*¡mÜ»ä)Ç”áù¤çqé)s¡×í@ö:;»ùcüûÕäcÿ]ßýY÷ü”ïÑnؽßò+åïßN¿Î_§Þdø.|E#ÉèõHEô¯LtòâÁÊÂ^ë>@24óxq>ì[8ø9ZÍ«x:ÎÌIÊsP3Ë +@iٮƻ×OrRãáãàôÚÁÌüÐ7{Ìoâ?Îj¬v¸{o5ÈRóãEHE-gC«aÀ&VãøRäú KçLó4!àÀpl5hObï;ág«q1´njµ¿Ýºê¤ºÈÙ_jz1³Xó9nj}*ã)¸ w¨z]ñão%ÿpÊÆ3)®üí·[&ç
The “garbage” is PDF bytes, shown as plain text. Obviously “Content-type” HTTP response header is overridden with a wrong value. Check the server/webapp setting.
Thanks for your response.
I have changed the weblogic server start parameter to add
-Dweblogic.webservice.i18n.charset=utf-8 and restarted the server. No luck.
then I added the below parameter and restarted the server.
-Dfile.encoding=utf8
Weblogic Domain path-> bin folder -> setDomainEnv.sh under JAVA_OPTS added the below variable.
-Dfile.encoding=utf8.
Still it is displaying the same characters. Plz help me what could be the problem.
Your webapp should send “Content-type: application/pdf” with HTTP response.
PD4ML taglib implicitly sets the correct HTTP header. (Do you use PD4ML taglib?)
It your case it seems to be overridden with “Content-type: text/plain“.
<%@ taglib prefix="pd4ml" uri="/WEB-INF/taglib/pd4ml.tld"%><pd4ml:transform
screenWidth="400"
pageFormat="A5"
pageOrientation="landscape"
pageInsets="100,100,100,100,points">
<div >
HI This is test :
</div>
</pd4ml:transform>
You published as “response” returned HTTP content, which looks correct.
HTTP server also sends so-called “HTTP Header”, which should have “Content-type: application/pdf” entry.
Your JSP code also seems to be ok. So first I would suspect your web application has a config mapping “JSP -> plain/text”, and the configuration overrides “Content-type: application/pdf” set by PD4ML taglib.