PDF generation in D?
Jot via Digitalmars-d
digitalmars-d at puremagic.com
Tue Nov 15 17:22:33 PST 2016
On Tuesday, 15 November 2016 at 15:23:29 UTC, Adrian Matoga wrote:
> On Tuesday, 15 November 2016 at 11:13:54 UTC, Jot wrote:
>> On Tuesday, 15 November 2016 at 09:39:09 UTC, Adrian Matoga
>> wrote:
>>> On Friday, 11 November 2016 at 09:47:21 UTC, Robert burner
>>> Schadek wrote:
>>>> I used text files and LaTeX in the past, it works with
>>>> everything
>>>>
>>>> textfile -> process -> LaTeX -> pdf
>>>
>>> This.
>>>
>>> Another (a bit lower-level) option would be to produce a
>>> PostScript file and pass it to (e)ps2pdf.
>>
>>
>> Then that begs the question about how to generate ps in D and
>> just kicks the can down the road.
>
> PostScript is a programming language and PS files are plain
> text files with programs written in it, so formatted file
> output is your friend here.
>
> "Lower-level" means that you need to take care of the layout of
> items on a page manually, using physical positions. It's quite
> straightforward for simple vector graphics, but not so much for
> multi-page text documents with figures and tables.
What's your point?
"PDF is largely based on PostScript but simplified to remove flow
control features like these, while graphics commands such as
lineto remain.
As a document format, PDF has several advantages over PostScript:
PDF contains tokenized and interpreted results of the
PostScript source code, for direct correspondence between changes
to items in the PDF page description and changes to the resulting
page appearance.
PDF (from version 1.4) supports true graphic transparency;
PostScript does not.
PostScript is an interpreted programming language with an
implicit global state, so instructions accompanying the
description of one page can affect the appearance of any
following page. Therefore, all preceding pages in a PostScript
document must be processed to determine the correct appearance of
a given page, whereas each page in a PDF document is unaffected
by the others. As a result, PDF viewers allow the user to quickly
jump to the final pages of a long document, whereas a PostScript
viewer needs to process all pages sequentially before being able
to display the destination page (unless the optional PostScript
Document Structuring Conventions have been carefully complied
with).
"
More information about the Digitalmars-d
mailing list