I'm hoping, wishing, begging, somebody can help here. I'm trying to export the Map to a PDF with a modified version of PDFExport.cs sample (using silverPDF). My goal is to export the map to various paper sizes like 8.5 x 11, 8.5 x 14, 11 x 17, 24 x 18, 48 x 36. In order to do this, I must create a seperate map specifically for generating the PDF and then size it to the paper and then add the layers and adjust the extent to match the extent and layers visible on the web page map.
I almost have it working, but when I set the paper 48 x 36 it get the error System.OutOfMemoryException' occurred in mscorlib.dll (this happens in the "PngEncoder" class's routine "Encode" of PDFExport.cs - see below). I've tried freeing up layers by setting them to null at the earliest possible point so that the system might squeek by with enough memory. Has anybody else see this problem and what did you do to get around it. Anybody have any sample code that does what I'm trying to do.
Problem Code (error occurs some where in loop bolded below):
// First part of ZLIB header is 78 1101 1010 (DA) 0000 00001 (01) // ZLIB info // // CMF Byte: 78 // CINFO = 7 (32K window size) // CM = 8 = (deflate compression) // FLG Byte: DA // FLEVEL = 3 (bits 6 and 7 - ignored but signifies max compression) // FDICT = 0 (bit 5, 0 - no preset dictionary) // FCHCK = 26 (bits 0-4 - ensure CMF*256+FLG / 31 has no remainder) // Compressed data // FLAGS: 0 or 1 // 00000 00 (no compression) X (X=1 for last block, 0=not the last block) // LEN = length in bytes (equal to ((width*4)+1)*height // NLEN = one's compliment of LEN // Example: 1111 1011 1111 1111 (FB), 0000 0100 0000 0000 (40) // Data for each line: 0 [RGBA] [RGBA] [RGBA] ... // ADLER32
uint adler = ComputeAdler32(data); MemoryStream comp = new MemoryStream();