[Geoserver-users] ["format":"image/png"] java.io.IOException: The byte array is not a recognized imageformat.

Dear All,

I am using mapfish to print WMS layers from Geoserver 2.4.0. While printing WMS layers, Error appears in PDF file for some WMS layers.

The Error is:

java.io.IOException: The byte array is not a recognized imageformat.

If I am using the format “application/pdf”, everything is printed correctly but quality is very poor.

I am using below code to get print:

http://localhost:8080/geoserver/pdf/print.pdf?spec={
“layout”:“A3 portrait”,
“srs”:“EPSG:404000”,
“units”:“m”,
“dpi”:300,
“outputFilename”: “ggg”,
“layers”:[
{
“baseURL”:“http://localhost:8080/geoserver/cite/wms”,
“opacity”:1,
“singleTile”:false,
“type”:“WMS”,
“layers”:[“Oxford_Map”],
“format”:“image/png”,
“styles”:,
“overview”:true
},
{
“baseURL”:“http://localhost:8080/geoserver/cite/wms”,
“opacity”:1,
“singleTile”:true,
“customParams”:{“CQL_FILTER”: “User_id = 234”},
“type”:“WMS”,
“layers”:[“ODC_Graphics_Data”],
“format”:“image/png”,
“styles”:,
“overview”:false
},
{
“baseURL”:“http://localhost:8080/geoserver/cite/wms”,
“opacity”:1,
“singleTile”:true,
“customParams”:{“TRANSPARENT”:true,“buffer”: 0},
“type”:“WMS”,
“layers”:[“Plymouth_Buildings”],
“format”:“image/png”,
“styles”:,
“overview”:false
},
{
“baseURL”:“http://localhost:8080/geoserver/cite/wms”,
“opacity”:1,
“singleTile”:true,
“customParams”:{“TRANSPARENT”:true,“buffer”: 0.1},
“type”:“WMS”,
“layers”:[“Plymouth_Hard_Surface_Block_Paving”],
“format”:“image/png”,
“styles”:,
“overview”:false
},
{
“baseURL”:“http://localhost:8080/geoserver/cite/wms”,
“opacity”:1,
“singleTile”:true,
“customParams”:{“TRANSPARENT”:true,“buffer”: 0},
“type”:“WMS”,
“layers”:[“Plymouth_QUERIES”],
“format”:“image/png”,
“styles”:,
“overview”:false
},
{
“baseURL”:“http://localhost:8080/geoserver/cite/wms”,
“opacity”:1,
“singleTile”:true,
“customParams”:{“TRANSPARENT”:true,“buffer”: 0.1},
“type”:“WMS”,
“layers”:[“Plymouth_Street_Lights”],
“format”:“image/png”,
“styles”:,
“overview”:false
}
],
“pages”:[
{
“center”:[248744.93342196,55350.945],
“mapTitle”:“”,
“company”:“testuser2_portrait”,
“comment”:“”,
“scale”:439,
“rotation”:0
}
] }

And My Yaml Configuration is:

#===========================================================================
A3 portrait:
#===========================================================================
mainPage:
pageSize: A3
landscape: false
rotation: true
backgroundPdf: ‘D:\Oxford\ODC_Internal\PDF${company}.pdf’
header:
height: 1
items:

  • !text
    font: Helvetica
    fontSize: 15
    align: center
    text: ‘${mapTitle}’
    items:
  • !columns
    absoluteX: 87
    absoluteY: 1147
    width: 735
    config:
    #borderWidth: 0.3
    cells:
  • padding: 2
    items:
  • !map
    width: 500
    height: 600
    #width: 733
    #height: 1124

Kindly help me to fix this issue. Thanks in Advance.

A complete stab in the dark here, but does it work when you remove the backgroundPDF from the config.yaml?

This transmission is intended for the named addressee(s) only and may contain sensitive or protectively marked material up to RESTRICTED and should be handled accordingly. Unless you are the named addressee (or authorised to receive it for the addressee) you may not copy or use it, or disclose it to anyone else. If you have received this transmission in error please notify the sender immediately. All email traffic sent to or from us, including without limitation all GCSX traffic, may be subject to recording and/or monitoring in accordance with relevant legislation.

···

Although if it only happens with some WMS layers you say? Are you sure the WMS requests that MFP is sending are actually being responded to with images and not exception reports? Might be worth trying them as stand-alone URL’s.
Cheers,

Jonathan

On 27 December 2013 14:29, venky <venky.src@anonymised.com> wrote:

Dear All,

I am using mapfish to print WMS layers from Geoserver 2.4.0. While printing WMS layers, Error appears in PDF file for some WMS layers.

The Error is:

java.io.IOException: The byte array is not a recognized imageformat.

If I am using the format “application/pdf”, everything is printed correctly but quality is very poor.

Hi Jonathan,

Thanks for your reply. But backgroundPDF is mandatory in my application…and I am very new to geoserver,openlayers and etc… Yes some wms layers not printed and there is no exception reports, and I dont know how to try them as stand-alone URL’s. Kindly help me plz.

···

On Fri, Dec 27, 2013 at 8:14 PM, Jonathan Moules <jonathanmoules@anonymised.com…> wrote:

A complete stab in the dark here, but does it work when you remove the backgroundPDF from the config.yaml?

This transmission is intended for the named addressee(s) only and may contain sensitive or protectively marked material up to RESTRICTED and should be handled accordingly. Unless you are the named addressee (or authorised to receive it for the addressee) you may not copy or use it, or disclose it to anyone else. If you have received this transmission in error please notify the sender immediately. All email traffic sent to or from us, including without limitation all GCSX traffic, may be subject to recording and/or monitoring in accordance with relevant legislation.

Although if it only happens with some WMS layers you say? Are you sure the WMS requests that MFP is sending are actually being responded to with images and not exception reports? Might be worth trying them as stand-alone URL’s.
Cheers,

Jonathan

On 27 December 2013 14:29, venky <venky.src@anonymised.com> wrote:

Dear All,

I am using mapfish to print WMS layers from Geoserver 2.4.0. While printing WMS layers, Error appears in PDF file for some WMS layers.

The Error is:

java.io.IOException: The byte array is not a recognized imageformat.

If I am using the format “application/pdf”, everything is printed correctly but quality is very poor.