Hi,
when printing (I have enhanced the printing sample) the Output Quality is very very poor.
Everythink Looks like behind a milky glas. Lines have stairs etc.
This is as PDF Output or printing to devices.
Only Output as Bitmap (png or so) is ok.
Where to increase dpi/Quality ?
Regards
Hardy
Poor printing quality
Hi Hartwig,
Are you using your code to print or test that in our print sample, could you please attach printed PDF so I can see what it looks like?
Regards,
Don
Hi Don,
please look at the Screen shots…
pic 1, on the left side you see the gis form, on the right the plot form.
The plot map is ugly and scaled in x/y have a look at the Symbols (Point style with geoimages)
when loading the printing preview and closing and refresh the plot map it will be a bit better…
Attached you’ll find the Output as pdf and png.
In both forms the map Control is left with Default Settings.
What to do to get brilliant printing results?
Increas dpi or what?
Regards
Hardy
gisme.pdf (785 KB)
gisme.PNG (301 KB)
Hi Hardy,
If the preview looks bad, please set the PreviewDrawingMode property in MapPrinterLayer to “Redraw”.
You said: "This is as PDF Output or printing to devices. Only Output as Bitmap (png or so) is ok."
But it looks your gisme.pdf looks better than gisme.PNG, whether I misunderstand your question?
Regards,
Don
Hi Don,
to set
mapPrinterLayer.PreviewDrawingMode = MapPrinterPreviewDrawingMode.Redraw
is good. Result is a sharp displayed map.
This fix also the Output to PDF.
But you’ll see the scale of all Image Point styles!!! in x/y in the next Screen shots…
I have printed a few maps to device and measured the Output on paper.
The scale is correct (for vector geometry e.g. Buildings etc.).
They are drawn in correct scale.
But pointstyle based on geoimages will be scaled.
Any idea for solving this Major Problem?
Is there a dependency to projections?
I’m using 25832 for the data (comming from POstGIS).
Regards
Hardy
Hi Don,
I have done some more Tests.
But with no better result.
I’m wondering where to increase the Quality maybe DPI or anything else…
What can I do to get accurate Printings?
Regards
Hardy
Hi Hardy,
Yes it looks the images in the right map is re-sized, I want to know how you implement the right map? From your original screen capture, it looks the point render correct in preview window there.
Regards,
Don
Don
here is my Code which reads the layer to plotMap:
Dim
MyOverlay
As
LayerOverlay =
Nothing
For
Each
MyOverlay
In
ParentMap.Overlays
If
MyOverlay.IsVisible
Then
For
Each
MyLayer
In
MyOverlay.Layers
If
MyLayer.IsVisible
Then
mapPrinterLayer.Layers.Add(MyLayer)
End
If
Next
End
If
Next
ParentMap is the Control in the MainApplication.
So I’m only copying the current Overlays and it’s Layers to the PlotForm.
PlotForm is like your Plot-Example from Code library.
I have no idea where scaling take place…
Some Settings in the Load Event:
winformsMap1.MapUnit = GeographyUnit.Meter
winformsMap1.ZoomLevelSet = ParentMap.ZoomLevelSet
winformsMap1.MinimumScale = winformsMap1.ZoomLevelSet.ZoomLevel20.Scale
???
Regards
Hardy
Don
one more question: Looking at pdf Output, I’m wondering why is Text “gisME” is excellent and Text from the Map is horrible?
Please have a look at attached pdf.
Regards
Hardy
001_gisme.pdf (494 KB)
Me again,
a Screen shot showing the Plotform (in the back) with sharp entities and in front of the pdf Output from that printing…
You see Dimension text 10,76m. In the PlotForm it’s accurate, in PlotForm it seems to be in a “Cloud” and not sharp/clear.
The other text you can’t read in pdf. But in the Plotform.
So there is a great difference between the Quality when displaying on the PlotForm’s Control and it’s Output (like PDF, BMP…).
The current scale is 1:100. You can read small text on the printed paper, but it’s not good.
If scale is 1:250 or 1:500 etc. you are not able to identify the text!
What’s going wrong?
I have also set the canvas property like
Dim
newGeoCanvas
As
New
GdiPlusGeoCanvas
newGeoCanvas.Dpi = 600
winformsMap1.GeoCanvas = newGeoCanvas
But there is no better result :-(
And all B
Help!
Regards
Hardy
Hi Hartwig,
I am sorry I still failed to reproduce your issue, and I have some questions:
1. About the problem “pointstyle based on geoimages will be scaled.” about the screen shot as below:
We found when set mapPrinterLayer.PreviewDrawingMode = MapPrinterPreviewDrawingMode.Default, both image Point styles and vector geometry e.g. building looks incorrect, but after we set it to MapPrinterPreviewDrawingMode.Redraw verything looks well.
And I doubt maybe the problem is caused by any incorrect settings(like mapPrinterlayer’s Position, MapExtent, mapUnit etc.) when you move the layers of MainApplication to PlotForm.
2. About the problem “in PlotForm it seems to be in a “Cloud” and not sharp/clear” and “Text ‘gisME’ is excellent and Text from the Map is horrible”:
We viewed your PDF file, and thought the map maybe saved as one image in pdf, because you said it seems to be in a “cloud”.
Attached is a PDF which export from our Print Preview sample, in our pdf file, you can see if you zoom in, the images will blur but the map are still clear.
I think we need a simple project for reproduce your issues, if possible please upload a simple project. And we have a Print Preview sample maybe helpful, you can get it from Product Center.
Thanks,
PrintingResults.pdf (507 KB)
Hi Don,
thank you for your suggestion about scaling.
I have done some more investigations.
When MapSuite draws the map in PlotForm or on Desktop it will call the Draw-Methode from ImagePointStyle.
In this methode there is a scale calculation
canvas.DrawWorldImage(m_image, point.X + offsetxDrawing, point.Y + offsetyDrawing, widthSize * Scale, heightSize * Scale / SymbolHeightScale, m_Level, 0, 0, m_rotateAngle)
Here we got a ratio between width and height on the actual extent / device.
But on screen it must be different as on Printing (like our PlotForm=mapPrinterLayer).
If I “rescale” with my variable SymbolHeightScale (on Screen the value will be 1, on mapPrinterLayer the value will be set to 1.66 which is like height / width from map extent) the output in PlotForm and on Paper etc. is correct!
ImagePointStyle Feature will be drawn correct when “rescaling”.
So I do a workaround : When drawing PointStyle on Screen/Desktop the SymbolHeightScale will be 1, if PrintingMode SymbolHeightScale will be about 1.66 (theMap.currentExtent.height / …width, depending on the output device).
Now the Images looks correct on Output (PDF or Paper etc.).
But my next problem is the Quality from Output.
Printing to PDF will result in a poor Quality (Text isn’t read able…).
Please look at the attached PDF and compare with both png.
The png are generated with 1000 pix or 200 pix picture width.
You see an increasing Quality and a much better one than PDF output.
So my question: How to increase the quality for printing to PDF or Printing devices?
Regards
Hardy
004_003_002_001_gisme.pdf (349 KB)
1000.PNG (156 KB)
2000.PNG (145 KB)
Hi Hardy,
Thanks for your reply and your images, we viewed your PDF file and agree the text “gisME” is excellent but the labels in Map looks horrible, and you can see the shapes in Map is also looks fuzzy.
I guess the poor labels and shapes on map should be rendered as a raster layer such as MrSidRasterLayer, Jpeg2000RasterLayer, GeoTiffRasterLayer or WmsRasterLayer, so when we export them, they are saved as images in PDF. But the title “gisMe” should be from LabelPrinterLayer, it is saved as vector data in pdf.
As below is a screen shot(from PrintingResults.pdf), the legend text is from LegendPrinterLayer and is saved as vector in PDF, but the orange images is rendered as geoimages so it will be saved as image in PDF. You can see the legend text looks well but the orange images looks poor.
So I think maybe poor quality of printing devices is the same reason.
Here we want to make sure which layers in your project and how to be set. If possible could you please upload a simple project to show us that and we can work based on it.
Thanks,
Emil
Hi Don,
I have startet to extract a sample from my Code. But it’s a lot of work. I think i should extract my PointStyle class etc.
If nessecary I will do this work. But if not…:
I think data which will be printed is stored in PostGIS, Shape files and some ratser from Tiff/ECW or Google maybe OSM.
Is there a dependency from the data? Can’t believe. So you should be able to test the issues with any data.
The main part is to get an excellent Output for text and geoimgaes.
My Suggestion was that MapSuite pass the Plot as Bitmap to the device. So how to set dpi/Quality for the drawing canvas or receiving device?
My overall question is to increase the dpi (or Quality) for the printing device/Driver to get pdf or paper in good quality.
If I write to Bitmap and define a large Picture width (like 10K, 20K) the png for example is looking quiet nice.
Text is accurate and geoimages as well.
So if you need data or coding sample I’ll do that work.
Regards
Hardy
Hi Hardy,
Sorry for waiting.
Data source will result in poor quality, attached PDF file “PrintingResultsWithWMS.pdf” which export from our Print Preview
sample, in the Pdf file, you can see if you zoom in, the map will blur because the map come from WMS.
WorldMapKitLayer worldMapKitLayer
= new WorldMapKitLayer();
worldMapKitLayer.Projection = WorldMapKitProjection.DecimalDegrees;
mapPrinterLayer.Layers.Add(worldMapKitLayer);
And I think I still need your demo, which can show me how the layers
is being used and export. I am not very sure about that, for example, there are two ways to export map,
1: In this way, the map will be save as an image, then save
the image to PDF or Printing device.
Bitmap bitmap =
Map1.GetBitmap();
MemoryStream stream = new MemoryStream();
bitmap.Save(stream, ImageFormat.Png);
PointShape centerPoint = pdfGeoCanvas.CurrentWorldExtent.GetCenterPoint();
pdfGeoCanvas.DrawWorldImageWithoutScaling(new GeoImage(stream), centerPoint.X,
centerPoint.Y, DrawingLevel.LabelLevel);
pdfGeoCanvas.EndDrawing();
string filename = "MapSuite PDF Map.pdf";
document.Save(filename);
2: In this way, the layers will be draw directly on the pdfGeoCanvas.
Collection<SimpleCandidate> labelsInAllLayers = new Collection<SimpleCandidate>();
foreach (LayerOverlay myOverlay in winformsMap1.Overlays)
{
if (myOverlay.IsVisible)
{
foreach (Layer maylayer in myOverlay.Layers)
{
if (maylayer.IsVisible)
{
maylayer.Draw(pdfGeoCanvas, labelsInAllLayers);
}
}
}
}
pdfGeoCanvas.EndDrawing();
string filename = "MapSuite PDF Map.pdf";
document.Save(filename);
Attached PDF file "PrintingResultsByImage.pdf” which
was export by the first way, you can see if you zoom in, all shape in PDF will
blur.
And we can find the Text "gisME" is excellent but
the ScaleLine is blur in your pdf file.
Our developer is working for try to build a demo for test whether we can get good printing quality if we increase the dpi of the
printing device/Driver, any news I will
let you know about it.
Thanks,
PrintingResultsByImage.pdf (92.5 KB)
PrintingResultsWithWMS.PDF (635 KB)
Hi Don,
thank you for getting back.
For us it is very very important to get excellent printing results (paper or pdf).
I’m using the second way to print the layers. I will extract a sample from my Code.
But now there is an other issue while printing. And I think it’s in the same area.
When opening my PlotForm Map Looks ok, scaling is fine. But changing to PrinterPreView the map will be scaled from upper left Corner to lower right. Have a look.
Any idea?
My Code to get the preview is like yours from printpreviewsample
Public
Sub
PlotPreview()
Try
Dim
printerInteractiveOverLay
As
PrinterInteractiveOverLay =
DirectCast
(winformsMap1.InteractiveOverlays(
“PrintPreviewOverlay”
), PrinterInteractiveOverLay)
Dim
pagePrinterLayer
As
PagePrinterLayer = TryCast(printerInteractiveOverLay.PrinterLayers(
“PageLayer”
), PagePrinterLayer)
Dim
printerGeoCanvas
As
New
PrinterGeoCanvas
Try
'printerGeoCanvas.Dpi = 300
printerGeoCanvas.DrawingQuality = DrawingQuality.HighQuality
'thePrintDocument.DefaultPageSettings.Bounds.Inflate(33, 47)
printerGeoCanvas.DrawingArea = thePrintDocument.DefaultPageSettings.Bounds
printerGeoCanvas.BeginDrawing(thePrintDocument, pagePrinterLayer.GetBoundingBox(), winformsMap1.MapUnit)
Catch
e
As
Exception
MsgBox(e.Message, MsgBoxStyle.Information,
“Print Canvas”
)
End
Try
’ Loop through all of the PrintingLayer in the PrinterInteractiveOverlay and print all of the
’ except for the PagePrinterLayer
Dim
labelsInAllLayers
As
New
Collection(Of SimpleCandidate)()
For
Each
printerLayer
As
PrinterLayer
In
printerInteractiveOverLay.PrinterLayers
Try
printerLayer.IsDrawing =
True
If
Not
(
TypeOf
printerLayer
Is
PagePrinterLayer)
Then
printerLayer.Draw(printerGeoCanvas, labelsInAllLayers)
End
If
printerLayer.IsDrawing =
False
Catch
e
As
Exception
MsgBox(e.Message, MsgBoxStyle.Information,
“Printing…”
)
End
Try
Next
printerGeoCanvas.Flush()
Dim
printPreviewDialog
As
New
PrintPreviewDialog()
printPreviewDialog.Document = thePrintDocument
DirectCast
(printPreviewDialog, Form).WindowState = FormWindowState.Maximized
printPreviewDialog.ShowDialog()
Catch
e
As
Exception
MsgBox(e.Message, MsgBoxStyle.Information,
“Generelle Exception”
)
End
Try
End
Sub
Regards
Hardy
Hi Hardy,
Sorry that we are unable to recreate it, to make sure we can have all the problems you have, would you please create a ready-to-use demo for us? It will reduce the complication of this thread, also would reduce the time of resolving the problem. If the demo is a bit big, you can create a ticket to paste the problem with the demo there. There a big upload is allowed.
Thanks,
Johnny
Johnny,
I have done some more investigations.
Therefore I have extracted my PlotForm into a blank Desktop Solution.
To my suprise I can print wiht the same Code an excellent looking map!
Exporting to PDF is also fine.
I suppose there is a property in my main solution which Forces the map or canvas to print/Export the Display area of the map as raster to printeroverlay.
So I have some Questions to go deeper into
1. What property of the Map Control or Canvas will effect that AreaStyles filled with GeoImgaes will be printed on Device or not?
(In PlotForm the map is displayed well but switching to preview mode will raise an exception)
Regards
Hardy
Hi Hardy,
There is a property which can affect the quality of printer ,
please set the DrawingMode property of MapPrinterLayer to
“Default” or “Vector”.
About “scaling is incorrect”, I guess it was caused by the incorrect width and height of mapPrinterLayer, please review the API
mapPrinterLayer.SetPosition(…); and set the suitable values of width and height.
The following is the definition of SetPosition method.
SetPosition(double width, double height, LayerAnchorLocation corner, double cornerPointX, double cornerPointY, PrintingUnit unit);
Thanks,
Emil
Hi emil,
I have solved the Problem: The poor Quality is forced by layer.transparence!!!
If you set the transparence to 254 or less the layer will be printed as raster with bad blur effect (and maybe only 96 dpi).
Using 255 the Printer uses vectors. That’s it.
I think that’s a bad Situation!
Plaese check that behaviour with developement.
I will wish a printing Methode which is able to print with tranparence.
Also we Need printing fill/brushes using GeoImages.
Now PDF and PrintPreview will raise an exception or will not Display the area fill.
If you Need more Information please get in contact.
Regards
Hardy