ThinkGeo.com    |     Documentation    |     Premium Support

Error print pdf



Hi, 

I want to print the bounding box of the map in a pdf file.


I looked at the example LargeScaleMapPrinting.



I tested with a feature with this style (ie attached file) and when I print I have an error message ;-(



 à ThinkGeo.MapSuite.Core.PdfGeoCanvas.3RM=(GeoBrush 3hM=, ScreenPointF[] 3xM=)
   à ThinkGeo.MapSuite.Core.PdfGeoCanvas.qxM=(IEnumerable`1 rBM=, GeoPen rRM=, GeoBrush rhM=, Single rxM=, Single sBM=, PenBrushDrawingOrder sRM=)
   à ThinkGeo.MapSuite.Core.PdfGeoCanvas.0BM=(Collection`1 0RM=)
   à ThinkGeo.MapSuite.Core.PdfGeoCanvas.EndDrawingCore()
   à ThinkGeo.MapSuite.Core.GeoCanvas.EndDrawing()



It is important to us to print hatches to view the different layers (black and white printer)



Thanks.

Regards.

Steph.

Hi Steph, 
  
 I download the sample LargeScaleMapPrinting here: wiki.thinkgeo.com/wiki/File:WpfDesktopEditionSample_LargeScaleMapPrinting_120216.zip 
  
 It looks this sample shows how to render the special components, if you want to shows your shape, you need put it in the AddMapLayer function. 
  
 If I misunderstand you, please provide more detail code for help reproduce that. 
  
 Regards, 
  
 Don

Hi Don, 



I know that if i want to show the shape, I have to put it in the addMapLayer.
My problem is the visual of the shape. I want to have Hatchstyle and if i do that, I have an error.





Code in the sample LargePrint : 
            typeValueStyle.ValueItems.Add(new ValueItem("1", new AreaStyle(new GeoPen(GeoColor.StandardColors.Black), new GeoSolidBrush(GeoColor.StandardColors.LightGreen))));
            typeValueStyle.ValueItems.Add(new ValueItem("2", new AreaStyle(new GeoPen(GeoColor.StandardColors.Black), new GeoSolidBrush(GeoColor.StandardColors.LightPink))));
            typeValueStyle.ValueItems.Add(new ValueItem("3", new AreaStyle(new GeoPen(GeoColor.StandardColors.Black), new GeoSolidBrush(GeoColor.StandardColors.LightBlue))));



I change and the new code is  : 

            typeValueStyle.ValueItems.Add(new ValueItem("1", AreaStyles.CreateHatchStyle(GeoHatchStyle.Cross, GeoColor.StandardColors.LightGreen ,GeoColor.StandardColors.Green)));
            typeValueStyle.ValueItems.Add(new ValueItem("2", AreaStyles.CreateHatchStyle(GeoHatchStyle.Cross, GeoColor.StandardColors.LightPink, GeoColor.StandardColors.Pink)));
            typeValueStyle.ValueItems.Add(new ValueItem("3", AreaStyles.CreateHatchStyle(GeoHatchStyle.Cross, GeoColor.StandardColors.LightBlue, GeoColor.StandardColors.Blue)));



And there is an error …



Thanks.

Regards.

Steph.




Hi Steph, 
  
 When I use "To PDF" I get the same exception, the exception said: "GeoHatchBrush is not supported." 
  
 I viewed the code and found for brush only GeoSolidBrush and GeoLinearGradientBrush is supported to print to PDF for now. 
  
 Regards, 
  
 Don

Hi Don,

as this restriction regarding the allowed types of brushes for print “to PDF” still exists in 2017.
I’d like to ask if this restriction also exists in Version 10 of MapSuite for WPF?

Regards,
Peter

Hi Peter,

In Version 10 it’s the same than before, only the GeoSolidBrush and GeoLinearGradientBrush is supported.

If you have any scenario about this problem please let us know, we can let our developer do some research and see whether we can enhancement this part in next version.

Regards,

Ethan

Hi Ethan,

any scenario?
What about black an white printing using hatches?

I think this is one of the most basic requirements when printing maps. And in a modern enviromment our customer wants an integrated user experience, that means no printing to an external PDF printer and manually importing the created file afterwards but creating PDF files directly out of the application.

I just can’t believe that we’re the only ThinkGeo user having this issue.

Regards,
Peter

Hi Peter,

We implement the print to PDF function based on a 3rd part library PdfSharp, you can find it here: https://www.nuget.org/packages/PdfSharp/1.50.4619-beta4c

We are using the XSolidBrush in it, it only support color but not support hatch.

I think if we want to support hatch, that’s should be a big enhancement and introduce big changes for the PDF printer part, it looks we don’t have a plan for that in near future.

I had submitted this requirement in our EnhancementTracker system, so our managers will see it and consider start the enhancement at some time in future.

Regards,

Ethan

Hi Ethan,

thank you for your effort.

Regards,
Peter

Hi Peter,

Thanks to let us know your requirement, any question please let us know.

Regards,

Ethan

Hi,

i have the same problem as Peter. Please put me on the list of customers for whom the feature to print to pdf with GeoHatchBrush is an important one.

Regards,
Andreas

Hi Andreas,

Thanks for suggestion, if we find a better support library for pdf printing, we will support more style.

Regards,

Ethan