0

I'm trying to create a PDF with fonts encoded as winansi instead of custom.

The source file is PCL and I use ghostpcl to convert it to PDF using pdfwrite device.

The PDF is created successfully. However, the font encoding (when checked with pdffonts) is 'custom', but I want it to be 'winansi'. How can I achieve this?

Kurt Pfeifle
  • 86,724
  • 23
  • 248
  • 345

1 Answers1

1

You almost certainly can't do that, you certainly have no control over what pdfwrite chooses to do with the Encoding. Without seeing the input PCL file I can't comment on why the Encoding isn't winansi, but my guess would be that there is insufficient information in the incoming PCL to determine what the font encoding is, and so the only alternative is to use a custom encoding.

If you are trying to make an editable/searchable PDF file from PCL input you cannot reliably do that.

KenS
  • 30,202
  • 3
  • 34
  • 51
  • The fonts embeded in the pdf are the truetypes fonts coming with ghostpcl in uwrfonts directory. I though the winansi encoding was possible because by using ps2write device then ps2pdf, the pdf fonts are winansi encoded. The ps2write device have render problems with some of my pcl, so i can't use it. May be I can insert some pcl controls to get that with pdfwrite ? – user3876129 Jul 28 '14 at 08:06
  • 1
    A 2-step process isn't the same as a single step process. As I said in my reply, without seeing what your PCL file is doing its not really possible to comment further. Have you reported the bugs with ps2write ? Because you know, if nobody reports them, they won't get fixed.... Why do you need your fonts encoded as winansi ? As I said above if you are trying to get searchable text, you won't get far with PCL in the general case. – KenS Jul 28 '14 at 10:07
  • * bug report for ps2write is in my todo list, but i need to get a pcl without personnal data * the pdf is text selectable / searchable even if not in winansi * here is a pcl sample and the command actually used to convert `pcl6 -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -J"@PJL SET PAPER=A4" -sOutputFile=test.pdf test.pcl` – user3876129 Jul 28 '14 at 14:30
  • OK so of the 10 fonts in that document, which one is causing a problem ? Investigating this will be *much* easier if you only use a single font, and preferably a minimum number of characters – KenS Jul 28 '14 at 15:43
  • Using ps2write doesn't produce any fonts in WinAnsiEncoding for me, any more than pdfwrite does. The only font with a 'custom' encoding is a type 3 font, which is most likely a PCL bitmap font given that the CharProcs are all bitmaps. These usually do genuinely have a custom encoding, and are not ASCII or anything else useful. I can't reproduce your result with the current code. The file is too complex (ie too many fonts) to work with and I'm not good enough at PCL to cut it down without spending hours on it. – KenS Jul 28 '14 at 15:49
  • here is the pdf I get with pdfwrite : http://expirebox.com/download/dcbe068c2e7683ba1ba00ea8faaf4e3e.html and the one with ps2write step : http://expirebox.com/download/2b3358d583fe2ee89288855f00359a3f.html in acrobat reader, it says in the first one that fonts are built-in encoded and in the second, that they are Ansi encoded. here is the command I used with ps2write `pcl6 -dNOPAUSE -dBATCH -sDEVICE=ps2write -J"@PJL SET PAPER=A4" -sOutputFile=- test.pcl | ps2pdf - test_ps2write.pdf` – user3876129 Jul 28 '14 at 16:22
  • Fonts are ansi encoded by ps2pdf with 8.71 release of ghostscript but not with the 9.10 – user3876129 Jul 28 '14 at 16:31
  • 8.71 is very old, well out of support. I suspect the winansi encoding is incorrect and has been fixed, which is why it no longer occurs. – KenS Jul 28 '14 at 19:35
  • Thanks for your help, i'm going to try without ansi. – user3876129 Jul 31 '14 at 08:50
  • `+1` for the remark *'Because you know, if nobody reports [bugs], they won't get fixed...'* ;-) – Kurt Pfeifle Jul 31 '14 at 10:08