Hi Thinkgeo support,
We have some issues with printing to pdf.
the first issue we have is.
GeoHatchBrush is not supported. at ThinkGeo.MapSuite.Core.PdfGeoCanvas./xM=(Action ABQ=) at ThinkGeo.MapSuite.Core.PdfGeoCanvas.3BM=(Collection`1 3RM=) at ThinkGeo.MapSuite.Core.PdfGeoCanvas.EndDrawingCore() at ThinkGeo.MapSuite.Core.GeoCanvas.EndDrawing() at GeoVisia.Online.Helpers.PrintHelper.PrintMap(String extent, Double scale) in c:\Source\GeoVisia 6\Development\GeoVisia.Online\GeoVisia.Online\Helpers\PrintHelper.cs:line 50
The second issue is related printing a wms to pdf
the wms we are trying to use : openbasiskaart.nl/mapcache/?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetCapabilities
The remote server returned an error: (400) Bad Request. at System.Net.HttpWebRequest.GetResponse() at ThinkGeo.MapSuite.Core.WmsRasterSource.SendWebRequestCore(WebRequest webRequest) at ThinkGeo.MapSuite.Core.WmsRasterSource.SendWebRequest(WebRequest webRequest) at ThinkGeo.MapSuite.Core.WmsRasterSource.GetImageCore(RectangleShape worldExtent, Int32 canvasWidth, Int32 canvasHeight) at ThinkGeo.MapSuite.Core.RasterSource.GetImage(RectangleShape worldExtent, Int32 canvasWidth, Int32 canvasHeight) at ThinkGeo.MapSuite.Core.RasterLayer.DrawCore(GeoCanvas canvas, Collection`1 labelsInAllLayers) at ThinkGeo.MapSuite.Core.Layer.Draw(GeoCanvas canvas, Collection`1 labelsInAllLayers) at GeoVisia.Online.Helpers.PrintHelper.PrintMap(String extent, Double scale) in c:\Source\GeoVisia 6\Development\GeoVisia.Online\GeoVisia.Online\Helpers\PrintHelper.cs:line 48
Printing pdf
Hi Jeroen,
For the first issue, yes, the GeoHatchBrush is not supported currently and it only supports the GeoSolidBrush in GeoPen. Sorry for the inconvenience on this.
As for the second issue, does the wms layer display well? or the exception is just happened when printing to pdf?
It would be highly appreciate if you can provide us a "self-contain" sample about how to use wms with the uri so that we can quick point the root of the issue.
Thanks,
Johnny
Hi Johnny,
Can you tell me at what time the GeoHatchBrush will be supported.
we are currently building a web application where we use the GeoHatchBrush on multiple layers.
The second issue related to printing a wms to pdf
We get a bad request on the WMS layer because of the tile size W:4490 H:3173.
the requested url = openbasiskaart.nl/mapcache/?REQUEST=GetMap&WIDTH=4490&HEIGHT=3173&LAYERS=osm&FORMAT=image/gif&SRS=EPSG:28992&BBOX=142273.397380151,454356.07030608,169450.546640289,473560.82562814&VERSION=1.1.1&STYLES=
in our map view the requested URL uses smaller tiles : W:265 H:265
is there a way to get multiple tiles for pdf printing ?
Regards,
Jeroen van Heel
Hi Jeroen,
The reason we did not have it was that PDF sharp(a third-part library) has not implemented it. If you want to donate the code we would be happy to put it in.
However, I think there is another way to print the map to pdf. We can use the “map.GetBitmap()” method to get the current map image and then print it into pdf. Some codes like the below:
[MapActionFilter]
public
string
ToPdf(Map map, GeoCollection<
object
> args)
{
PdfDocument document =
new
PdfDocument();
PdfPage page = document.AddPage();
string
selectedItemText = args[0].ToString();
if
(selectedItemText ==
“Landscape”
)
{
page.Orientation = PageOrientation.Landscape;
}
PdfGeoCanvas pdfGeoCanvas =
new
PdfGeoCanvas();
RectangleShape printExtent = ExtentHelper.GetDrawingExtent(map.CurrentExtent, (
float
)map.WidthInPixels, (
float
)map.HeightInPixels);
pdfGeoCanvas.BeginDrawing(page, printExtent,GeographyUnit.DecimalDegree);
Bitmap bitmap = map.GetBitmap();
MemoryStream stream =
new
MemoryStream();
bitmap.Save(stream, ImageFormat.Png);
PointShape centerPoint = pdfGeoCanvas.CurrentWorldExtent.GetCenterPoint();
pdfGeoCanvas.DrawScreenImage(
new
GeoImage(stream), (
int
)pdfGeoCanvas.Width / 2, pdfGeoCanvas.Height / 2, bitmap.Width, bitmap.Height, DrawingLevel.LevelOne, 0, 0, 0);
//pdfGeoCanvas.DrawWorldImageWithoutScaling(new GeoImage(stream), centerPoint.X, centerPoint.Y, DrawingLevel.LabelLevel);
pdfGeoCanvas.EndDrawing();
string
relativePath =
string
.Format(
"~/Controllers/{0}/{1}"
, ControllerContext.RouteData.Values[
“Controller”
],
“MapSuite PDF Map.pdf”
);
string
filename = Server.MapPath(relativePath);
document.Save(filename);
return
VirtualPathUtility.ToAbsolute(relativePath);
}
For the second question, I am
not sure why you want to get the big tile with width 4490 and height 3173? As I
know our WmsRasterLayer still can be print into PDF, please check the attached
file.
Any questions please feel free
to let us know.
Johnny
Post11657.txt (2.5 KB)
Hi, Jeroen.
I have ever tried to print PDF files with the help of the following code:
using xxxx.Imaging.Basic;
using xxxx.Imaging.Basic.Core;
using xxxx.Imaging.Basic.Codec;
using xxxx.Imaging.PDF;
xxxx PDF = new xxxx();
public void PdfProcessorPrint();
{
PDFInputFile = (@“C:/1.pdf”);
Printer = (@“C:/HP Color LaserJet 5550 PCL 6”);
};
PDF. PdfProcessorPrint(@“C:/1.pdf”, @“C:/HP Color LaserJet 5550 PCL 6”);
Or you can also google it and select a fine PDF processor whose way of processing is simple and fast to help you with the related work. It will be better if it is totally manual and can be customized by users according to our own favors. Remember to check its free trial package first if possible. I hope you success. Good luck.
Best regards,
Arron
Arron,
Thanks for your sharing but, actually, I don’t think your codes would help on the Jeroen’s question.
Thanks,
Johnny