java - dofilter not giving pdf as output on response -
i trying show pdf output on browser. here code in dofilter class of servlet. getting byte array renders pdf correctly on line --> byte[] pdfarray = pdfconverter.converttodoc(bytes); see pdf file saved in --> file somefile = new file("c:\\log\\java2.pdf"); it's not outputting on servletresponse, mixed characters show up. appreciated. please inside dofilter method. have pdfconverter take whole site byte array , convert pdf. import java.io.bytearrayoutputstream; import java.io.ioexception; import java.io.printwriter; import javax.servlet.filter; import javax.servlet.filterchain; import javax.servlet.filterconfig; import javax.servlet.servletexception; import javax.servlet.servletoutputstream; import javax.servlet.servletrequest; import javax.servlet.servletresponse; import javax.servlet.writelistener; import javax.servlet.http.httpservletresponse; import javax.servlet.http.httpservletresponsewrapper; import org.slf4j.logger; import org.slf4j.loggerfactory; ...