Hi Aneta,

I didn't try on the command line. But I've tried with QGIS (QGIS uses
GDAl to generate PDFs).

I was able to create a PDF with accent characters everywhere. Check the
attached PDF.

I've used a layer name with accents; I've used a label with accents.
I've also used as attribute field name with accents and the value with
accents. The label is displayed properly on the feature.

I'm using GDAL 3.3.0dev, compiled with --with-poppler. I would recommend
a more recent version of GDAL (ver. >= 3.1.0).

Regards,

Jorge

Às 08:26 de 09/11/20, Aneta Muslić escreveu:
> Yes, it does.
> The problem is that gdal uses ansi as a default encoding when given font
> in label, and that cannot be changed.
> 
> 
> ------------------------------------------------------------------------
> *From:* Richard Greenwood <richard.greenw...@gmail.com>
> *Sent:* Thursday, November 5, 2020 4:27 PM
> *To:* Aneta Muslić <a.mus...@outlook.com>
> *Cc:* gdal-dev@lists.osgeo.org <gdal-dev@lists.osgeo.org>
> *Subject:* Re: [gdal-dev] Encoding when creating pdf
>  
> 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.mus...@outlook.com
> <mailto:a.mus...@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@lists.osgeo.org <mailto:gdal-dev@lists.osgeo.org>
>     https://lists.osgeo.org/mailman/listinfo/gdal-dev
> 
> 
> 
> -- 
> Richard W. Greenwood, PLS
> www.greenwoodmap.com <http://www.greenwoodmap.com>
> 
> _______________________________________________
> gdal-dev mailing list
> gdal-dev@lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev
> 

-- 
OSGeo Portugal
NIF: 509588190
email: ge...@osgeopt.pt
https://www.osgeopt.pt/

Próximo evento: SASIG 2017, 20 a 22 de novembro, Porto
Mais informações: http://osgeopt.pt/sasig2017/

Attachment: test.pdf
Description: Adobe PDF document

_______________________________________________
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to