How can export pdf content special character with inkscape?

Discussion about writing code for Inkscape.
lucle
Posts: 7
Joined: Mon Jul 11, 2016 1:10 pm

How can export pdf content special character with inkscape?

Postby lucle » Mon Jul 11, 2016 1:12 pm

I have some special characters ☎ in svg file, I use inkscape to export svg to pdf, but the special characters don't display.

Could you give me solutions for that?

Many thank.

User avatar
Maestral
Posts: 982
Joined: Sat Aug 27, 2011 7:10 am

Re: How can export pdf content special character with inkscape?

Postby Maestral » Mon Jul 11, 2016 6:05 pm

Perhaps converting them to Paths/Outlines?
:tool_zoom: <<< click! - but, those with a cheaper tickets should go this way >>> :!:

lucle
Posts: 7
Joined: Mon Jul 11, 2016 1:10 pm

Re: How can export pdf content special character with inkscape?

Postby lucle » Mon Jul 11, 2016 9:27 pm

Maestral wrote:Perhaps converting them to Paths/Outlines?

I don't know, what you're mean?
I would some special characters such as: U+1F512 (Lock), U+1F511 (Key), U+260E (Black Telephone) display on pdf file.

User avatar
Maestral
Posts: 982
Joined: Sat Aug 27, 2011 7:10 am

Re: How can export pdf content special character with inkscape?

Postby Maestral » Mon Jul 11, 2016 11:09 pm

Convert Text to Path (Shift+Ctrl+C)
:tool_zoom: <<< click! - but, those with a cheaper tickets should go this way >>> :!:

User avatar
Xav
Posts: 1209
Joined: Fri May 08, 2009 1:18 am
Location: UK
Contact:

Re: How can export pdf content special character with inkscape?

Postby Xav » Tue Jul 12, 2016 12:15 am

There's also a checkbox to "Convert text to paths" in the dialog that appears when I choose "Save As..." to save the file as a PDF. You should be able to use that rather than changing the text to paths in the original document (per Maestral's instructions). That said, try both approaches to see if there's any difference in the files.

With my testing I was able to save a PDF that contained the Black Telephone character whether that checkbox was ticked or not. If you don't tick the box I suspect it only works on a machine with the same font installed (I don't think Inkscape embeds fonts into PDF files). If you do tick the box it should work with any machine, but the file will be larger.
Co-creator of The Greys and Monsters, Inked - Inkscape drawn webcomics
Web SiteFacebookTwitter

lucle
Posts: 7
Joined: Mon Jul 11, 2016 1:10 pm

Re: How can export pdf content special character with inkscape?

Postby lucle » Tue Jul 12, 2016 1:12 pm

Xav wrote:There's also a checkbox to "Convert text to paths" in the dialog that appears when I choose "Save As..." to save the file as a PDF. You should be able to use that rather than changing the text to paths in the original document (per Maestral's instructions). That said, try both approaches to see if there's any difference in the files.

With my testing I was able to save a PDF that contained the Black Telephone character whether that checkbox was ticked or not. If you don't tick the box I suspect it only works on a machine with the same font installed (I don't think Inkscape embeds fonts into PDF files). If you do tick the box it should work with any machine, but the file will be larger.


Thank for your response.

I use vb.net to convert svg with special characters to pdf.
1. Create svg file

Code: Select all

Dim pathSvgs = HttpContext.Current.Server.MapPath("~/src/svgs")
If Not Directory.Exists(pathSvgs) Then
     Directory.CreateDirectory(pathSvgs)
End If
Dim svgDoc As System.Xml.XmlDocument = New System.Xml.XmlDocument()
svgDoc.LoadXml(strLayer.ToString())
newSvgFile = pathSvgs & "\" & Regex.Replace(layerName, "[^a-zA-Z0-9_]", "_") & ".svg"
If fresh OrElse
      Not File.Exists(newSvgFile) Then
      svgDoc.Save(newSvgFile)
End If

2. Convert to pdf

Code: Select all

string pdfFileName;
pdfFileName = svgFileName.Replace(".svg", ".pdf").Replace(".SVG", ".pdf");
ProcessStartInfo startInfo = default(ProcessStartInfo);
Process pStart = new Process();
startInfo = new ProcessStartInfo(pathInkSpace, "\"" + svgFileName + "\" --export-pdf=\"" + pdfFileName + "\"");
pStart.StartInfo = startInfo;
pStart.Start();
pStart.WaitForExit();


when pdf file is created, the special characters don't display. How can I convert to pdf with special chars

User avatar
Xav
Posts: 1209
Joined: Fri May 08, 2009 1:18 am
Location: UK
Contact:

Re: How can export pdf content special character with inkscape?

Postby Xav » Tue Jul 12, 2016 4:52 pm

The problem isn't an Inkscape one, it's a vb.net one. You might gave a better chance on a .Net forum as the question is about how to escape unicode characters in a pdf export, and is probably not SVG specific.

I've moved this thread to the Programming forum, as that's a more appropriate place for this kind of question.
Co-creator of The Greys and Monsters, Inked - Inkscape drawn webcomics
Web SiteFacebookTwitter


Return to “Programming”