Planet PDF Forum Planet PDF Forum
  New Posts New Posts RSS Feed - Generating .pdf files from .txt files for all CPs
  FAQ FAQ  Forum Search   Register Register  Login Login

Hi, welcome to the Foxit Planet PDF Forum. If you have PDF or Adobe Acrobat questions then the right place to ask them is here, in this forum.

Generating .pdf files from .txt files for all CPs

 Post Reply Post Reply
miskox View Drop Down
New Member
New Member

Joined: 10 Jan 2018
Points: 2
Post Options Post Options   Quote miskox Quote  Post ReplyReply Direct Link To This Post Topic: Generating .pdf files from .txt files for all CPs
    Posted: 10 Jan 2018 at 7:57am
Hello all!

I first asked this question at adobe's forum two weeks ago but no answer.

My problem in one sentence: how to generate .pdf files with Windows batch (.bat) (or any other programming language) with support for CP1250 (and others).

Some background:

Over at forum (dedicated to Windows batch scripts (.bat)) I asked a question ( if anybody had already generated .pdf files from .txt files with Windows batch (.bat).

One expert found very old program (together with C source) made by Phil Smith (written in 1996) According to the author it supports only 7-bit characters. Looks like it can support 8-bit characters if

/Encoding /WinAnsiEncoding

is added. According to the PDF reference CP1252 is supported with /WinAnsiEncoding (this was only tested with one 8-bit character (umlaut character Ü) and it seems to be OK.

This expert (Steffen) managed to 'port' it to batch. Looks like it can only support CP1252. I would like to have a support for CP1250 (or maybe other Code Pages, too). Only single byte characters are used (0x00 - 0xff).

CP1252 is lacking 'ccaron' character for example (čČ). ŠŽ are supported.

We tried to embed 'Lucida Console' font without success.

I don't want to use print to .pdf or something. When I generate a 'report' with my .bat  (result is a classic .txt file) I want to be able to generate .pdf file from it.

And here are my questions:

1. why are there some 'binary' bytes after the '%PDF-version'? Usually start with % (for a comment) and some additional bytes (0xe2e3cfd3))? What is their purpose? (this has nothing to do with this C source or .bat port (they don't have it) - just noticed this when some .pdf files were generated with Word or other software)

2. how can 'lucida console' (or Courier new or any other monospaced fonts that are allowed to be embedded) be embedded in full? This would be the easiest way and not to make selections which characters are used in a document. What objects would be required in a .pdf file to have this supported? Of course I prefer /AsciiHexDecode (or maybe /Ascii85Decode) because it is easier to write these characters with .bat.

3. What else is also required if 2.) (font is embedded) in a .pdf file to make it 'legal'?

Thank you for any info.


Back to Top
karyncorrigan View Drop Down
Moderator Group
Moderator Group

Joined: 25 Oct 2017
Points: 11
Post Options Post Options   Quote karyncorrigan Quote  Post ReplyReply Direct Link To This Post Posted: 29 Jan 2018 at 2:13pm
Hi Saso, 
This a very technical question as fonts can be quite difficult to get right with PDF. It would be better to use a proper PDF library.

You should refer to the PDF specification that all PDF software is developed on:

Some quick answers:
0. Changing to CP1250 could be done using /WinAnsiEncoding in conjunction with a /Differences array (see section in the spec)

1. The binary characters are not necessary, they are recommended. They help IT systems know this is a binary file (see section 7.5.2 in the spec)

2. Using TrueType fonts is possible but it will be very difficult because a lot of information must be read from the .ttf font file and placed into the PDF by the batch file.

3. The PDF specification has all the information but it is very technical (sections 9.1-9.5 and 9.6.3)

I would recommend to create PDFs using established products in the marketplace; there are many of them. Generating a PDF using a free script might produce a working PDF in certain cases but the file will not be guaranteed to work with other PDF systems and could cause unforeseen problems.

Content Marketing
Foxit Software
Back to Top
miskox View Drop Down
New Member
New Member

Joined: 10 Jan 2018
Points: 2
Post Options Post Options   Quote miskox Quote  Post ReplyReply Direct Link To This Post Posted: 30 Jan 2018 at 7:01am

Thank you very much for your answer. I will take a look and see what can be done.

If I made any progress I will post my findings here.


Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.10
Copyright ©2001-2017 Web Wiz Ltd.

This page was generated in 0.031 seconds.