Log of #ghostscript at irc.freenode.net.

 <<<Back 1 day (to 2020/02/24)Fwd 1 day (to 2020/02/26) >>>20200225 
rishi4 Hello Everyone, I have a problem with ghostscript with a pdf. Hoping someone will be able to help.08:16.06 
  have a pdf file that I need to convert using ghostscript. Unfortunately I will not be able to share the pdf as it belongs to the client. I am trying to debug using gsnd -dPDFDEBUG command. When I first ran it, I got the following error:08:16.26 
kens If you cannot send us the file there is likely little we can do to help you08:16.53 
rishi4 I will just post the errors here if you can give me a hint. It's fine otherwise. I will try to debug it on my own.08:20.18 
  Can't find CID font "Arial".Attempting to substitute CID font /Adobe-Identity for /Arial, see doc/Use.htm#CIDFontSubstitution.The substitute CID font "Adobe-Identity" is not provided either. attempting to use fallback CIDFont.See doc/Use.htm#CIDFontSubstitution.The fallback CID font "CIDFallBack" is not provided. Finally attempting to use08:20.31 
  ArtifexBullet. **** Error reading a content stream. The page may be incomplete. Output may be incorrect. **** Error: File did not complete the page properly and may be damaged. Output may be incorrect.08:20.31 
  Here is the error I was getting. Then I downloaded the Arial.ttf file and copied it to /usr/share/ghostscript/current/Resource/CIDFont/ directory and renamed it as Arial. After doing this when I run the command, I get the following:08:20.43 
  > R /DW 1000 /BaseFont /Arial >> endobj %Resolving: [11 0] << /StemV 50> /ItalicAngle 0 /Type /FontDescriptor /FontName /Arial /Ascent 905> /Flags 32 /FontBBox [> -665 -325 2000 1006 ] /CapHeight 716 /Descent -211 >> endobj %Resolving: [11 0] **** Error: can't process embedded font stream,> attempting to load the font using its name.>08:20.51 
  Output may be incorrect. **** Error reading a content stream. The page may be incomplete.> Output may be incorrect. **** Error: File did not complete the page properly and may be damaged.> Output may be incorrect.08:20.52 
  This is a ubuntu based Docker container. On a separate Macbook this is working fine08:21.20 
kens Sticking a font (presumably a TrueType font) in the CIDFont resource direcotyr won't work, for the very simple reason its not a CIDFont08:21.21 
  So by doing that you break Ghostscript08:21.54 
rishi4 Will the OTF work? I had an issue with another pdf file as well and I copied KozMinPro-Regular.otf and it resolved the issue08:21.56 
kens Don't meddle with the Ghostscript resources unless you know what you are doing08:22.04 
  No the OTF will also not work, it has to be a *CIDFont*08:22.16 
rishi4 COPY KozMinPro-Regular-Acro /usr/share/ghostscript/current/Resource/CIDFont/KozMinPro-Regular-Acro08:22.24 
  I did this the last time08:22.29 
kens Also the font is undoubtedly not causing the error08:22.34 
rishi4 It's a line from my docker configuration08:22.35 
  and those particular pdfs started working fine.08:22.50 
kens You cannot simply copy fonts around like that, they won't be in the correct format.08:23.18 
  You can add fonts as CIDFonts, but not like that, you need to edit cidfmap. This is covered in the documentation.08:24.07 
  But I bvery much doubt this is causing the error you quoted above, because worst case we will use our built-in fallback font.08:24.29 
  I do notice that you don't seem to be getting to our usual fallback, which suggests the package maintainer has removed it.08:25.02 
  You should take that up with the package maintainer, who will likely also want to see the PDF file.08:25.29 
rishi4 Who or what will be package maintainer? I am talking to client for sharing the file here. Will paste the link to file here once I can.08:27.19 
kens I don't know who is the package maintainer, I'm assuming you did not build Ghostscript yourself from source ?08:30.25 
rishi4 We have a product that we ship as Docker container. It is based on Ubuntu. We install Ghostscript inside that using apt-get install08:34.34 
  Here is the file by the way08:35.08 
kens Then its the Ubuntu Ghostscript package maintainer08:35.28 
  And the command line you are using with that PDF file ?08:36.48 
rishi4 Is there anyway I can enable the fallback now?08:37.07 
kens Recompile Ghostscript from the sources we wupply.08:37.30 
  Ghostscript doesn't give me any warnings or errors processing that PDF file. Of course that PDF file doesn't contain a font called Arial either08:38.39 
rishi4 Well when I try to process that in my personal mac as I will I don't get any error08:39.24 
kens Hang on, I think that was the wrong file I picked up08:39.36 
  Dropbox being difficult08:39.41 
rishi4 Ohk. 08:40.16 
  use this link if that one is not working08:40.44 
kens That seems to work better08:41.20 
  I notice XDropBox cannot sdisplay the PDF preview which suggests there's a problem with the file08:41.41 
  Yes, teh file uses Arial and Arial,Bold08:42.09 
  The standard Ghostscript opens the file without problems, though it is (obviously) using a fallback replacement for the missing oens.08:43.04 
  What version of Ghostscript are you using ?08:43.10 
rishi4 9.2608:43.23 
  What is yours?08:43.27 
kens Well you should upgrade to start with, teh current shipping version is 9.50 and the 9.51 RC is about to go out.08:43.48 
  Your package doesn't contain the DroidSansFallback font, which is why you get an error.08:44.19 
  So your only remaining alternative is to supply substittue fonts for the missing CIDFonts.08:44.37 
rishi4 9.50 also doesn't contain the DroidSansFallback font?08:45.02 
kens *Our* code does, yes, I have no idea what the package maintainer will haev done. But since they apparently didn't ship it with 9.26 I presume they didn't ship it with 9.50 either.08:45.37 
  You can add CIDFonts by editing cidfmap. See the file itself for documentation on adding CIDFonts.08:46.20 
chrisl DroidSansFallback.ttf is on my Ubuntu install08:46.36 
rishi4 On my local, version is even older 9.21 though it is macbook so package will be different08:46.36 
  Ok, let me have a look08:46.46 
  I will see the file as well as copy DroidSansFallback and run fc-cache08:47.02 
  Thanks a lot for your help and time :)08:47.15 
chrisl fc-cache won't help08:47.19 
kens chrisl I was going by the error message above, which said the fallback font CIDFallback is not provided08:47.28 
chrisl kens: Just because it is provided doesn't mean gs is configured to find it08:47.55 
kens That should, obviously, say DroidSansFallback.ttf08:47.59 
  It doesn't behave like that for me built from source, so the package maintainer broke it (IMO)08:48.30 
rishi4 root@cf05e546ac28:/code# fc-list | grep Droid/usr/share/fonts/truetype/DroidSansFallback.ttf: Droid Sans Fallback:style=Regular09:11.24 
  I installed the DroidSansFallback.ttf but it still did not work as chrisl said09:12.04 
chrisl Like I said, fontconfig won't help09:12.48 
kens To reiterate, teh error above says that it can't find 'CIDFallback' which isn't our usual falllback font09:15.37 
chrisl Yes, it is09:15.51 
kens I thought it was DroidSansFallback09:16.09 
  But in any event, as you say font-config isn't going to help because it has to be added to our CIDFonts, not font-config09:16.48 
chrisl But the specific fallback is configurable, it does not *have* to be DroidSansFallback. So CIDFallback is a generic name09:16.56 
kens Ah, fair enough then09:17.11 
chrisl rishi4: Trying calling ghostscript with the additional parameter: -sCIDFSubstPath=/usr/share/fonts/truetype09:18.39 
rishi4 Ohk09:18.53 
  Let me try09:18.56 
  Well this time error is different09:20.01 
  Can't find CID font "Arial".Attempting to substitute CID font /Adobe-Identity for /Arial, see doc/Use.htm#CIDFontSubstitution.The substitute CID font "Adobe-Identity" is not provided either. attempting to use fallback CIDFont.See doc/Use.htm#CIDFontSubstitution.Loading a TT font from /usr/share/fonts/truetype/DroidSansFallback.ttf to emulate a CID09:20.03 
  font Adobe-Identity ... Done.Can't find CMap Identity-UTF16-H building a CIDDecoding resource.Warning: falling back to Identity orderingLoading a TT font from /usr/share/fonts/truetype/DroidSansFallback.ttf to emulate a CID font CIDFallBack ... Done.Can't find CMap Identity-UTF16-H building a CIDDecoding resource. **** Error: can't process09:20.04 
  embedded font stream, attempting to load the font using its name. Output may be incorrect.Can't find CID font "Arial".Attempting to substitute CID font /Adobe-Identity for /Arial, see doc/Use.htm#CIDFontSubstitution.The substitute CID font "Adobe-Identity" is not provided either. attempting to use fallback CIDFont.See09:20.04 
  doc/Use.htm#CIDFontSubstitution.Loading a TT font from /usr/share/fonts/truetype/DroidSansFallback.ttf to emulate a CID font Adobe-Identity ... Done.Can't find CMap Identity-UTF16-H building a CIDDecoding resource.Warning: falling back to Identity orderingLoading a TT font from /usr/share/fonts/truetype/DroidSansFallback.ttf to emulate a CID font09:20.05 
  CIDFallBack ... Done.Can't find CMap Identity-UTF16-H building a CIDDecoding resource. **** Error reading a content stream. The page may be incomplete. Output may be incorrect. **** Error: File did not complete the page properly and may be damaged. Output may be incorrect.09:20.05 
chrisl So, you are also missing a custom CMap file09:20.42 
kens Seems pretty damn broken to me.09:21.34 
chrisl Well, again, it is there in my Ubuntu install.....09:21.38 
kens Is this because the UTF-16 CMap has an Adobe copyright ?09:21.50 
  I seem to remember someone complaining about that09:22.28 
chrisl It's Artifex copyright09:22.32 
kens Oh, not that then09:22.41 
  Must be thinking of a different CMap09:22.48 
rishi4 https://www.dropbox.com/s/nnpbnj2ic0gsls7/Screen%20Shot%202020-02-25%20at%202.52.04%20PM.png?dl=009:22.54 
chrisl And, as I say, it is there for 9.26 in my Ubuntu config09:22.57 
rishi4 Here is my CMap folder09:23.00 
chrisl Well, I've no idea why it's there for me and not for you.....09:23.51 
kens Well Identity-UTF16-H is missing09:23.54 
rishi4 To give you an idea, we process around 30000 pdfs in a month and didn't have any problem till now with this setup. It is only for the documents from this particular vendor it is giving issues09:23.54 
kens Well, this is beyond the support we can offer to free users.09:24.19 
  You have problems which are due to the package you have installed.09:24.30 
  You either need to shift to using our source and building Ghostscript yourself, or take it up with the package maintainer.09:24.52 
  The installation you are using doesn't match what we ship09:25.03 
rishi4 Ohk. I will try building using source once.09:25.31 
chrisl So, the cmaps are part of the poppler-data package - including Identity-UTF16-H which I'm a little dubious about.....09:27.31 
rishi4 https://bugzilla.redhat.com/show_bug.cgi?id=140230609:28.07 
  I was reading this as well09:28.11 
kens So they are insisting on only shipping one copy or something ?09:29.39 
chrisl Yes, exactly - because disk space is *so* expensive these days :-(09:30.00 
kens Madness.....09:30.07 
  My suggestion for 'fixing it somehow in the future' would be to ship the file where its needed, dammit09:31.01 
  I mean, 1KB!09:31.06 
rishi4 apt-cache madison poppler-datapoppler-data | 0.4.7-7 | http://archive.ubuntu.com/ubuntu xenial/main amd64 Packages09:31.10 
  poppler-data is already installed as well09:31.20 
kens Yes but Ghostscript won't be looking in that directory for its CMaps09:31.39 
  Unless its told to09:32.03 
chrisl That package also sets up symlinks to where gs wants the files to be09:32.07 
kens Ah OK09:32.14 
  Crazy way to operate09:32.26 
chrisl I have *begged* them to change. No chance :-(09:32.54 
kens Perhaps if we could somehow persuade people with a problem to take it to them instead of us...09:33.31 
chrisl rishi4: So, I'm on Ubuntu 18.04 and you are on 16.04 - that probably explains the difference09:34.13 
  It is, still, a packaging issue09:34.32 
kens Indeed, it should be taken up with the package maintainer (its an insane way to operate)09:34.51 
rishi4 but building from source is worth a try, right?09:34.53 
chrisl Well, based on what kens said, it will just work, then09:35.27 
kens Building from source will work (or should) because it puts all the resources we need in the places we need them09:35.32 
  Of course, you need to make sure you are using the one you built, and not the one already installed09:36.14 
chrisl I suspect a lot of this crap dates from when there were a lot of license problems surrounding gs....09:37.37 
kens Its worht pointing out that if you actually want to use Arial instead of DroidSans as the substitute, you will still need to edit cidfmap to define the substitution.09:40.08 
  I also wonder what the license situation is, if you build Ghostscript yourself and distribute it, as you would be doing if you put it in a Docker container as a product that you sell. You should check the AGPL most carefully, possibly with the assistance of a lawyer.09:42.16 
rishi4 Ok. Noted.09:43.03 
rishi54 kens chrisl I managed to create the png without any errors but the png is missing the text. I just copied Identity-UTF16-H to the CMap directory12:17.35 
  Here is how the png look12:17.51 
  This is after installed Droid font, copying Identity file and using the flag provided by chrisl12:18.18 
chrisl If you're subsituting a font, *especially* a cid font, that can happen. Fact of life12:18.25 
kens Well that 'probably' means that the glyphs are mapped to /.notdef in the CIDFont and hence are drawn as spaces.12:18.34 
rishi54 https://www.dropbox.com/s/xq9d863e8y7fnys/30114436_1.pdf?dl=0 Original file12:18.52 
kens As I mentioned previously if you want to use a proper substitute you'll need to edit cidfmap to add the font substitution.12:19.20 
chrisl Even then, you are not guaranteed "correct" output12:19.43 
kens Even then, unles the font is a match for the one that was used to create the file (with the same mapping) then it won't look right12:19.50 
kens was typing :-)12:19.57 
  If your font isn't embedded then we need to use a substitute. As soon as you do that all bets are off12:20.31 
kens lunches12:21.37 
rishi54 Well using the same version of ghostscript without using build from source I am able to run it on my local so there must be something I can do on that particular machine as well12:25.14 
chrisl Same Ubuntu version?12:26.59 
rishi54 No. Local is Macbook :)12:27.24 
  but still12:27.28 
  whatever Ubuntu package is missing I should be able to find out and put it there12:27.48 
chrisl Sure, probably12:28.10 
rishi54 I have one question. Is it possible to print this font output using gsnd even if no error is occurring so I know what is being used in Ubuntu and what in Mac?12:29.21 
chrisl I don't understand the question....12:30.15 
  Ghostscript's stdout/stderr output logs what CIDFont subsitutions we're trying to use, and which (if any) it finds12:31.00 
rishi54 If this commands works alright without any error, it prints some numbers like this12:31.33 
  2684 [446 ]2685 [556 ]2686 [556 222 222 556 ]2690 [556 547 547 781 781 578 578 578 578 578 578 578 578 667 667 813 813 813 813 813 813 556 556 556 556 556 556 556 556 820 820 1015 1015 1015 1015 1015 1015 781 781 781 781 781 781 781 781 796 796 992 992 943 943 943 943 578 578 578 578 578 578 578 667 667 667 667 667 333 333 333 333 333 556 556 55612:31.34 
  556 556 813 813 869 869 722 333 333 333 222 222 222 222 222 222 278 278 424 424 333 333 333 547 547 547 547 569 569 547 512:31.35 
  Is it possible to print what fonts is the gsnd using and etc so I can compare between the two system12:31.51 
chrisl As I said, it does that - I've no idea why it's printing those numbers12:32.31 
  It gives output like:12:33.05 
  Can't find CID font "Arial".12:33.08 
  Attempting to substitute CID font /Adobe-Identity for /Arial, see doc/Use.htm#CIDFontSubstitution.12:33.08 
  The substitute CID font "Adobe-Identity" is not provided either. attempting to use fallback CIDFont.See doc/Use.htm#CIDFontSubstitution.12:33.08 
  Loading a TT font from %rom%Resource/CIDFSubst/DroidSansFallback.ttf to emulate a CID font Adobe-Identity ... Done.12:33.08 
  Can't find CID font "Arial".12:33.09 
  Attempting to substitute CID font /Adobe-Identity for /Arial, see doc/Use.htm#CIDFontSubstitution.12:33.11 
rishi54 Yes, it does that when there is an error12:33.36 
  What if there is no error?12:33.43 
  I would still like to what fonts are being used etc12:33.53 
chrisl That was not an error12:33.54 
  FWIW, I would download DroidSansFallback from here http://git.ghostscript.com/?p=ghostpdl.git;a=tree;f=Resource/CIDFSubst store it somewhere convenient, and use the -sCIDFSubstPath= parameter I mentioned earlier to point gs at that location.12:36.33 
  Ans *obviously* you're not using "-q" or "-dQUIET" on your command line......12:39.08 
velix Hi there. When using Ghostscript to print a chart from Office 2010, lines get converted to polygons. When using the internal PDF export function of Office, they're still strokes. Did anyone experience, if this is a problem of the way, Office prints or maybe the PS printer driver? I'm using the Ghostscript PPD.17:10.30 
kens Cannot possibly tell from the description, we would need to see the PostScript file you sent to Ghostscript.17:11.06 
velix kens: No no, I'm printing from Office to PS :)17:12.15 
  But I can send you the PS of course.17:12.23 
kens And then sending the PostScript to Ghostscript in order to get a PDF file I assume.17:12.37 
velix No, I'm working with the PS directly.17:12.46 
  Oh wait, then this isn't a Ghostscript problem at all then.17:13.06 
kens Then that's not a Ghostscript problem, its down to the Microsoft printer driver17:13.09 
velix naaah. sorry17:13.10 
  Yeah, just realized it while typing.17:13.18 
kens :-D carboard programmer for the win17:13.29 
velix kens: It also could be Office, which converted strokes with polygons.17:13.47 
kens Possibly, I don't know how the OOfice code works internally to produce a PDF file17:14.11 
velix The internal one sometimes is crap, sometimes is nice.17:14.24 
kens If its 'printing' to a PDF fiel then its the printer driver, if its creating it itself, then the two code paths are utterly different, so anything can happen17:14.35 
velix yeah, that's what I think.17:14.44 
  I'm converting the PS to SVG for viewing the charts on the web. I'm also adding animations to make it look like D3 :-)17:15.13 
  I was too lazy to code everything in D3 ;)17:15.22 
kens Not a lot we can do about the PostScript generation I'm afraid17:15.46 
velix Really no problem, sorry for the noise.17:15.59 
kens NP at least it was easy :-)17:16.08 
velix But for normal PDFs, I'm using Ghostscript and muTools damn often. Thanks for this.17:16.28 
kens You're very welcome17:17.01 
velix I've just tried Office 2003 (I'm using it a lot). The PS driver outputs strokes there, too. So it's a "feature" of Office 2010 :/17:17.23 
kens Oh, that's a shame17:17.43 
  I guess they've changed the wway they draw to the canvas17:18.14 
velix Yeah. But Office 2003 really rocks because of embedded EPS.17:18.26 
  I can directly print it to Ghostscript, which renders it perfectly.17:18.36 
  We talked about this 2-3 years ago in here. EPS was canceld due to security OR (in my opinion) license problems.17:19.09 
  I was able to track down the original coder of the EPS converter. The plugin didn't change for > 10 years.17:19.30 
kens I don't recall I'm afraid, I have a crap memory17:19.32 
velix kens: No problem. It's also not a ghostscript problem ;)17:19.43 
kens And I'm heading off for the night now17:19.46 
velix 18:20 here. Have a good night.17:19.58 
Lyusternik I have some PDFs that I am attempting to render to PNG through ghostscript 9.519:40.40 
  when doing so, I get OS errors like 'permission denied' and 'no such file or directory'19:41.16 
  I am expecting at least some subset of the PDFs to have errors and possibly fail, but I'm not ghostscript to think it can't find them19:42.02 
  *expecting ghostscript19:42.10 
Nancy_iMac read the docs about SAFER mode. We changed the default in 9.50 to disallow a lot of file accesses for security reasons. You need to specify paths to allow.19:43.42 
Lyusternik -dNOSAFER seems to just move the crash to a later page19:50.03 
Robin_Watts Lyusternik: How are you calling ghostscript?19:52.34 
  One call per file? From the command line?19:52.41 
Lyusternik commandline for debugging purposes, and then when that works, python19:53.32 
  one call per file19:53.40 
Robin_Watts ok, in that case, you shouldn't need to use -dNOSAFER19:53.58 
  Can you paste an example command line please?19:54.04 
Lyusternik gs -dNOPAUSE -dBATCH -dNOSAFER -sDevice=png16m /path/to/something.pdf19:57.08 
Robin_Watts -sDEVICE, I hope.19:57.37 
  and I would have expected a -o output%d.png19:58.14 
ray_laptop you need -o out.png (or -sOutputFile=out.png)19:58.15 
  Lyusternik: and as Robin_Watts mentioned, gs options are case-sensitive19:58.49 
Robin_Watts gs -o out%d.png -sDEVICE=png16m input.pdf19:58.58 
  gs should automatically add the necessary permissions to read input files specified on the command line, and to write output files specified on the command line.19:59.30 
ray_laptop the %d in the output filename creates one png per page of the input file19:59.54 
  as defined in the doc/Use.htm20:00.18 
Lyusternik okay, good call on the case sensitivity, obvious mistake there20:00.25 
Robin_Watts is being called away for food.20:00.32 
Lyusternik the error persists20:01.50 
Robin_Watts Lyusternik: OK, open a bug. put on the exact command line, and the exact file you're using.20:02.42 
Lyusternik should it be generating PNGs as pages process or all at the end?20:03.02 
 <<<Back 1 day (to 2020/02/24)Forward 1 day (to 2020/02/26)>>> 
ghostscript.com #mupdf