Understanding PDF operators - for iOS app

后端 未结 2 764
[愿得一人]
[愿得一人] 2021-01-15 10:20

I am tasked to create a pdf reader app for our company. After a few research, I became confused with the different operators inside the PDF. Here are a few things that I wou

2条回答
  •  情书的邮戳
    2021-01-15 10:46

    Hrmm... you've been tasked with a very non-trivial job then. You should tell your them that the PDF-1.7 spec is a dense document of roughly 800 pages...

    Yes, it's a very good idea to use a third-party library for this. It's impossible for a single person to implement a conforming PDF reader that can truthfully display all the graphic objects, fonts, colors, transparencies, vector graphics, images.... that may be embedded in a PDF-1.7 (ISO spec) file.

    The first few things you need to be aware of:

    • PDF builds on the same graphics model as PostScript did. (But PostScript is a Turing-complete programming language, while PDF has been -- on purpose! -- stripped of all programming language capabilities.)
    • Like PostScript, the PDF graphic description "language" is using stacks and it uses the inverted "Polish notation" for expressions: operators come last, arguments for operators come first. To express "1 + 2" you'd write "1 2 add" in PostScript.
    • PDF is hardly "line based". So regarding your questions about Tm: it's not the starting point of a new line, it's the end of the expression 1 0 0 1 100 100 saying: "the previous 6 numbers represent the setting of a text line matrix, and it is for now set to the named values". Tm would rather be the end of a line, than the start of one!

提交回复
热议问题