I'm creating a pdf with Apache FOP in Linux
then I need to convert the pdf it into an eps.
I'm trying lot of ways, the only one that seems works is the pdftops.
But,
when I convert it into Linux in command line
pdftops file.pdf -eps file.eps
This command creates me the eps
but when I try to open it in Adobe Illustrator in Windows XP
It returns me the error
EAAFD+HelveticaNeueLTStd-MdCnO_99-Identify-H;
Font not found on the system; missing font has been substituted.
But
1: the fonts han not been substituted
2: the eps do not show words inside it is all blank instead of the images
I'm sure that in Windows XP I have all the fonts
becouse if I convert the pdf to an eps inside the Adobe Illustrator
all works fine and Adobe Illustrator do not show me the fonts issue.
Can you help me?
What I'm doing wrong?
If something is not working as intended, then that's a bug clear and simple: it needs to be debugged and fixed. Please could you file a bug-report at:
launchpad.net/ubuntu/+source/poppler/+filebug
along with a copy of the PDF file that is being generated, and the exact command that is being used for the conversion (particularly whether it is pdf2ps (part of GhostScript), or pdfteps (part of Poppler/Xpdf and found in the poppler-utils package).
(Note that this question has been asked in three other places, but not yet reported in the bug-tracker where it can be explored, pointed to the right people and hopefully fixed).
Without knowing much about your setup, it looks like you're asking FOP to draw your text using the Helvetica Neue font, which is not part of the standard set of PDF fonts (note that Helvetica is, but not Helvetica Neue).
It would seem to me that your two options are to either force FOP to use Helvetica instead of Helvetica Neue, or force it to embed Helvetica Neue into the PDF (pdf2ps should automatically embed it into the result EPS file). In the first instance, you shouldn't need embedding at all, while in the second case the file should be embedded.
More info on how FOP handles fonts is also available from the package's documentation—as you can see, Helvetica Neue is not listed here.
Related
Understanding The Problem
I've run into a problem. I have a need to convert an svg file with multiple custom fonts into a png. This is supported by svglib. I actually was able to convert one of the fonts into a proper format for svglib to properly transform an svg to a png with the font. The problem is, I don't necessarily know what fonts are going to be "good" fonts and what fonts are going to be "bad" fonts (otf fonts that load for some reason and otf fonts that don't load for some reason), so ideally, I'd have a function in Python 3.x.x to convert all fonts to the same workable format. According to this google group on the subject, its a complicated beast (as of 2013). However, I could load any font (ttf / otf / woff) into this site and use it to get python to pump out a png file, just by having the font in the same directory as the svg file with the same name as the font file as the font family, with the proper results, but I couldn't get the converted font using Python's fonttools to work with the below provided code:
Code
from reportlab.graphics import renderPM
from svglib.svglib import svg2rlg
from fontTools import ttLib
from io import BytesIO
from PIL import Image
# Here I tried to take the font (which I had initially as a woff) and convert it to a ttf.
#woff2.decompress("./my_font.woff", "./my_font.ttf")
# Here I tried to take the original otf and convert it to a ttf
# font = ttLib.TTFont("my_font.otf")
# font.flavor = None
# font.save("my_font.ttf")
buff = BytesIO()
drawing = svg2rlg("./test.svg")
renderPM.drawToFile(drawing, buff, fmt="PNG")
img = Image.open(buff)
# l, w = image.size
# img = img.resize()
new_buff = BytesIO()
img.save("new_test.png", dpi=(600, 600))
Font For Minimal Reproduceable Example
I can upload a demo working font and the same font that is not working with the given format, but before I did that, I wanted to make sure that was part of the SO community guidelines to distribute potentially copyrighted (and other items of this nature with different licenses and EULAs) works - maybe a comment can confirm or deny this (I don't have the EULA, so I will probably find a link to a font that will be reproduceable). I think easiest is for me to find a link to a font online that I can reproduce the problem with, so I will get to looking and update the post with a link, but I mean... come on! I can't be the only person trying to solve this problem?!
Working font example
A non working font example - I could be wrong, but I think if you convert from a ttf to a woff back to a ttf using fonttools that you will be able to reproduce this issue. I'm still looking for an online example.
Problem Statement
So to make sure the problem statement is well articulated, the goal is to: Take any otf / ttf / or woff (even for simplicity sake - just a woff) file and convert it to a ttf file via Python that is supported by reportlab (which would mean it would be supported by svglib).
As unfortunate as it is, I couldn't supply a font to help with the "minimal, reproducible example clause", because finding a font online to replicate this with is very challenging (maybe I wasn't searching in the right place). However, I could convert the font in fontforge and opted for that. I could use the scripting portion of fontforge to accomplish this, so I can use this to convert fonts in bulk, and despite being GPL, after reaching out to the community from fontforge, they said:
We do not consider fonts created with FontForge or scripts run in FontForge to be derivative works of FontForge, which is standard practice for content creation tools and script interpreters. The FontForge license thus has no implication upon the ownership of those fonts and scripts or the owner's right to use and to distribute them. FontForge depends heavily upon a number of GPL libraries at the moment, and that is unlikely to change.
So for my purposes, I am content with this solution.
I want to generate text using postscript and some font file. I can convert the font to whatever needed font type necessary. The catch is, I can't install the font on the computer - there are certain limitations on the computer that would be way to long to explain, just know that the end result means that I can't install the font.
I am aware of the fact that t42 fonts are generated as a glorified eps file, however, I am not looking to simply append the font to the file - I have more than 1 font I am doing this to.
Are there hacky work arounds for the end goal?
I'm trying to edit a vector graphics file from Freepik. The format is EPS and after installing both Inkscape and Ghostscript on Windows, I'm able to open the file with Inkscape. However, Inkscape introduces some weird artifacts (see lines and wrong colors in the picture below).
Side by side comparison, original vector (left) and SVG saved after opening the EPS file in Inkscape (right)
Is there a way to fix this issue?
It's a little difficult to tell, partly because this is a complex illustration and partly because the rendering is a little small. I'd suggest that the circular artefacts are caused by radial fills not being rendered completely.
This could simply be a rendering problem with Inkscape, or it could be that the radial fill has an Extend parameter which isn't being honoured. It could also be a problem calculating a clip.
It's not entirely obvious what you used to render the left hand image, is that Ghostscript ?
Generally I'd say this looks like an Inkscape bug and you should report it as such.
Edit
Reading through the Inkscape FAQ it seems that Inkscape uses SVG as its native format. That's going to mean that an awful lot of PostScript (and PDF) vector objects aren't going to be represented well. Shadings will either have to be rendered to an image or converted into a complex series of SVG primitives.
Following the link on 'How to open EPS files in Windows' from the FAQ suggests to me that EPS files are either rendered to an image or converted to PDF.
You could use Ghostscript to convert the EPS to PDF yourself, and then try loading the PDF into Inkscape to see if you get a better result. You can also open the PDF in, say, Acrobat to see if it looks OK there.
If the PDF looks fine in Acrobat, but not so good in Inkscape, then I'd say that's an Inkscape problem. If the PDF looks poor in Acrobat then that's a Ghostscript problem.
You can then report the problem as a bug to the appropriate site.
It seems that EPS has more capabilities than SVG and that's why some stuff looks weird when converted to PDF/SVG. Specifically, highlights in an EPS file are not properly rendered in an SVG file.
I checked the conversion from EPS to PDF via Ghostscript and the lines are already there, i.e. it's not an Inkscape bug.
Here's the original file to reproduce the problem:
https://www.freepik.com/free-vector/data-processing-factory-isometric-technology_8625296.htm
And here's what it looks like after converting it to PDF: The artifacts are not as noticeable on the PDF file, possibly because Ghostscript converts it with a higher DPI by default
My workaround to be able to edit the file (remove the background) was to:
open the EPS with Inkscape, ungroup the items
delete the background
export it as PNG
then use the PNG as a "mask" on GIMP to edit the JPG file that came together with the EPS.
I'm trying to convert an eps (created with Mathtype) to svg format.
I don't have any problems with math characteres, but I'm unable to get any special characters (aka àâä...)
I have tried on unix and windows, and none of those works.
The font used is Arial, and is installed properly(Default on Windows, manually added in fonts folder in unix)
I have oppened the Arial font in windows font manager and the non working character are in.
They just aren't converted.
Actually, to convert I use Inkscape (with ghostscript) like this :
inkscape -z -f in.eps -l out.svg
Thanks in advance,
Edit :
Added in.eps file
https://pastebin.com/vBtUVy69
The fact that you have installed Arial on your Windows box has little to do with the problem.
Does the EPS file include the embedded Arial font ? If not then you are dependent on font substitution. You should probably post a sample EPS file so that we can look at it.
My guess is that the Arial font is not embedded, so Ghostscript substittues Helvetica, and the Helvetica font doesn't have those glyphs, or they are not encoded at the character codes which the EPS file thinks they are.
[EDIT]
The EPS comments say DocumentNeededFonts: Arial-BoldMT", so the EPS does not include the font and you get font substitution.
I can't tell you immediately why the SVG says Arial. I can guess, but in the absence of a complete description as to how you are producing the SVG I can't (obviously) be sure.
Now... if the conversion path uses Ghostscript's pdfwrite device to create a PDF file from the EPS, and that PDF file is then somehow converted to Inkscape's internal format (or directly to SVG using something other than Ghostscript) then what is happening is that Ghostscript is substituting Helvetica for the missing Arial-BoldMT and when it produces the PDF file it embeds the Helvetica font, but calls it Arial-BoldMT (or whatever). That's a consequence of the font substitution, the font that gets substituted gets renamed to the expected name.
I think you can avoid that by setting -dEmbedAllFonts to false, though I haven't tested it. Even if you do, all that happens is that the PDF file then doesn't have the font, just the same as the EPS file. So the SVG creation will (presumably) have to use a substitute font instead. All you do is shove the problem further down.
The correct answer to this is 'always embed fonts'.
You can also make the Arial-BoldMT font available to Ghostscript by editing its fontmap.GS file in ghostpdl/Resource/Init for builds where the resources are not built into a ROM file system. For builds which do use a ROM file system (eg Windows) you must pick up a copy of the Resources (from the Ghostscript Git repository), modify the fontmap.GS file and then tell Ghostscript to use the modified resources by pointing to it with the -I switch.
This is still a hack, because its a TrueType font being used as a replacement for a PostScript font, so there's a certain amount of guesswork going on inside Ghostscript, but it usually works well enough, YMMV.
After installing libgd on RedHat Linux, I found the path to .ttf fonts and used the full pathname to a DejaVu .ttf font (in 'set terminal gif font...") to create a .gif file from gnuplot. It looks good in a Firefox window, but when I change the size, it looks bad, as though the font is not scalable.
I am using the default binaries. Do I need to recompile gnuplot with different settings to make it scalable? I get no errors or msgs when the image is created from gnuplot (i.e. it finds and uses the .ttf file; I know because I tried several fonts and the image responded accordingly, with .pfa fonts also).
The gnuplot documentation says that TrueType fonts are fully scalable. Maybe I don't understand what scalable means. I had a similar problem with SUN OS, and my solution was to create a postscript (.eps) file from gnuplot and then convert it to .gif, and then it was scalable, but I don't have such a conversion utility on Linux (yet), and it seems like an unnecessary step.
I don't have the actual code/output in front of me, but I can add some if it would help. Also, I can't find any arial.ttf fonts on the system. Maybe that is a clue to the problem.
I heard good things about pngcairo (to avoid using gd), but 'set terminal' does not list it as an image type.
This is not a definitive answer, but it allows to show me a picture of the situation on my machine.
This plot was generated as gif using gnuplot 4.6p5 and Suse Linux 13.2.
The upper plot shows labels written in DejaVu, left using the full path to the TTF file, right using the name of the font. (DejaVu is an installed font here.)
The lower plot shows the same, the font is from the game Minecraft (i.e. very pixelated). I do not get any error message about missing fonts or similar, but gnuplot uses its default font here, but not what I want. More interesting: When I do not specify the font, I get Liberation Serif...
However, it seems my system ONLY uses fonts, regardless if referenced by name or path, when the font is correctly installed. Nevertheless, also the default font is smooth and scalable. (the gnuplot help says, gd has some not scalable build-in fonts, which may be used in your plot)