[gdal-dev] Encoding when creating pdf

Richard Greenwood richard.greenwood at gmail.com
Thu Nov 5 07:27:52 PST 2020


Do your shapefiles include a code page file (*.cpg)? If not, maybe that
would help.

On Wed, Nov 4, 2020 at 2:57 AM Aneta Muslić <a.muslic at outlook.com> wrote:

> Hello,
>
> I am using gdal version 2.4.4 in my c# app.
> As a part of my project I am creating pdf with gdal_translate command.
> GDAL translate command is
> *"gdal_translate  --config SHAPE_ENCODING "utf-8" -of PDF -tr 0.001 0.001
> -a_srs EPSG:3765 Granice.tif Sisacko_moslavacka_zupanija3.pdf -co
> OGR_DATASOURCE=Extent.vrt".*
>
> Part of vrt file that displays labels is:
> *<OGRVRTLayer name="SHPCounties">*
> *<SrcDataSource relativeToVRT="0">MSSQL: driver={SQL Server Native Client
> 11.0};*
> *server=xxx;uid=xx;pwd=xx;database=HAPIH;*
> *Integrated Security=False;MARS_Connection=yes</SrcDataSource>*
> *<SrcLayer>SHPCounties</SrcLayer>*
> *<LayerSRS>EPSG:3765</LayerSRS>        *
> *<SrcSQL>*
> *select Geometry.STCentroid() as pointPolygonCounties,*
> *CAST(Name AS varchar(100)) COLLATE Croatian_CI_AI AS NameCollated,*
> *'LABEL(f:"Times New Roman",t:{NameCollated},c:#000000,s:40pt)' AS
> OGR_STYLE *
> *FROM SHPCounties*
> *</SrcSQL>*
> *<GeometryType>wkbPoints</GeometryType> *
> *<GeometryField name="pointPolygonCounties" />*
>
> *</OGRVRTLayer> *
>
> My labels have special characters (č and ć). I defined encoding to utf-8
> and gdal-config as utf-8 but in generated pdf under fonts I can see that
> the font used is Times New Roman with encoding ansi, and characters č and ć
> are replaced with c because ansi doesn't support those letters. I tried
> writing just the letter 'č' to pdf so I can eliminate that the problem is
> in database but it is replaced with something else in pdf,  also I tried
> using html entity for those letters but it doesn't help.
>
> I would like to know how can I define in label options of vrt file for it
> to use font with custom encoding and not ansi encoding so it can display my
> special characters or there is another way for me to display those special
> characters.
>
> Thank you.
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev



-- 
Richard W. Greenwood, PLS
www.greenwoodmap.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20201105/9fbe53c4/attachment-0001.html>


More information about the gdal-dev mailing list