JSP is text output oriented environment. PD4ML taglib outputs binary data, where file start markers and the document structure (PDF object offsets integrity) is very important.

If there is some content before tag, the undesired content is sent directly to client’s browser, before outputs the binary PDF data starts with “%PDF-“.

Another possible reason: PD4ML failed (let’s say ss_css2.jar library is missing) but “Content-type: application/pdf” HTTP header is already sent. Adobe Reader plugin launched and tries to interpret the received data, however actually the data is not PDF bytes, but Java exception stack trace text.

In any case a good starting point of the problem analyze is to add enable=”false” attribute to , to make sure that HTML passed to PD4ML is correct.