GithubHelp home page GithubHelp logo

md2pdf's Introduction

Md2Pdf

Export Markdown files to PDF. Implementing official PDF specification

Ref: https://opensource.adobe.com/dc-acrobat-sdk-docs/pdfstandards/PDF32000_2008.pdf

Running tests

python3 -m pytest test

Notes

PDF Syntax

  • PDF Components

    • Objects.
    • File structure.
    • Document structure.
    • Content streams.
  • Non-encrypted PDF can be written in ANSI X3.4-1986.

  • Special ASCII-encoded tokens

    • Tokens thar delimit objects, reserved words, certain types of arrays.
    • Data values of strings and streams objects (can be entirely binary data too). Data such as images is represented in binary for compactness.

Objects

  • Boolean, Integer, Real, String, Name(PDF 1.2), Array, Dictionary(<<>>), Stream(unlimited length), null.

  • Stream objects

    • Consist of a dictionary followed by a stream object
    dictionary
    stream
    ...bytes...
    endstream
    
    • All streams shall be indirect objects and the stream dictionary shall be a direct object.
    • Stream dictionary entries:
    Key Value
    Length (Required) Number of bytes of the stream
    Filter (Optional) Name of the filter to apply to stream data
    DecodeParams (Optional) Dictionary or array of dictionaries used by the filter specified in Filter
    F (Optional) File containing the stream data
    FFilter (Optional) Filter to apply to stream data contained in file F
    FDecodeParams (Optional) Params of FFilter
    DL (Optional) Number of bytes in the decoded (defiltered) stream
  • May be labeled (called an indirect object)

  • Indirect objects

    • Identification: Object number, generation number, obj ... endobj
    10 0 obj
        (String)
    endobj
    
    • Reference to an object: Object number, generation number, R keyword
    10 0 R
    
  • Stream filters. Must be specified in the stream dictionary if required

/Filter [/ASCII85Decode /LZWDecode]

Filters

  • ASCIIHexDecode, ASCII85Decode
  • LZWDecode, FlateDecode

File structure

  • Header. One line identifying PDF specification of the file.

  • Body. Objects of the document.

  • Xref table. Info about indirect objects in the file.

  • Trailer. Location of the Xref table and of certain special objects within the body.

md2pdf's People

Contributors

urkx avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.