All Projects → mipmip → YAPDFKit

mipmip / YAPDFKit

Licence: MIT license
Yet another PDF Kit for parsing and modifying PDF's. For OS X and iOS.

Programming Languages

objective c
16641 projects - #2 most used programming language
ruby
36898 projects - #4 most used programming language
C++
36643 projects - #6 most used programming language
c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to YAPDFKit

twitter-to-rss
Simple python script to parse twitter feed to generate a rss feed.
Stars: ✭ 15 (-44.44%)
Mutual labels:  parsing
pypact
A Python package for parsing FISPACT-II output
Stars: ✭ 19 (-29.63%)
Mutual labels:  parsing
logstash-config
logstash-config provides a parser and abstract syntax tree (AST) for the Logstash config format, written in Go
Stars: ✭ 26 (-3.7%)
Mutual labels:  parsing
Ramble
A R parser based on combinatory parsers.
Stars: ✭ 19 (-29.63%)
Mutual labels:  parsing
ios
Resources & homeworks for N17R iOS track
Stars: ✭ 14 (-48.15%)
Mutual labels:  cocoa
php-fast-xml-parser
Fast SAX XML parser for PHP.
Stars: ✭ 25 (-7.41%)
Mutual labels:  parsing
OperationPlus
NSOperation's missing pieces
Stars: ✭ 119 (+340.74%)
Mutual labels:  cocoa
LSPKit
Language Server Protocol (LSP) implementation for Cocoa ☕️
Stars: ✭ 33 (+22.22%)
Mutual labels:  cocoa
parser-lang
A parser combinator library with declarative superpowers
Stars: ✭ 25 (-7.41%)
Mutual labels:  parsing
Whatsapp-Chat-Exporter
A customizable Android and iPhone WhatsApp database parser that will give you the history of your WhatsApp conversations in HTML and JSON. Android Backup Crypt12, Crypt14 and Crypt15 supported.
Stars: ✭ 150 (+455.56%)
Mutual labels:  parsing
TextViewPlus
Collection of useful extensions when working with NSTextView
Stars: ✭ 28 (+3.7%)
Mutual labels:  cocoa
fhash
fHash - an open source files hash calculator for Windows and macOS
Stars: ✭ 222 (+722.22%)
Mutual labels:  cocoa
FullFIX
A library for parsing FIX (Financial Information eXchange) protocol messages.
Stars: ✭ 60 (+122.22%)
Mutual labels:  parsing
Wireworld
A simple Wireworld cellular automaton explorer in Swift
Stars: ✭ 12 (-55.56%)
Mutual labels:  cocoa
sb-dynlex
Configurable lexer for PHP featuring a fluid API.
Stars: ✭ 27 (+0%)
Mutual labels:  parsing
pysub-parser
Library for extracting text and timestamps from multiple subtitle files (.ass, .ssa, .srt, .sub, .txt).
Stars: ✭ 40 (+48.15%)
Mutual labels:  parsing
arborist
Arborist is a PEG parser that supports left-associative left recursion
Stars: ✭ 17 (-37.04%)
Mutual labels:  parsing
puppeteer-autoscroll-down
Handle infinite scroll on websites by puppeteer
Stars: ✭ 40 (+48.15%)
Mutual labels:  parsing
attoparser
A tiny but fast java event-style markup parser.
Stars: ✭ 46 (+70.37%)
Mutual labels:  parsing
biaffine-ner
Named Entity Recognition as Dependency Parsing
Stars: ✭ 293 (+985.19%)
Mutual labels:  parsing

YAPDFKit

Build Status

Yet another PDF Kit is a independent PDF Kit written in objective-c for parsing and manipulating PDF's. YAPDFKit is completely independent of Apple's PDFKit

For specific cases YAPDFKit can be of great help, but it's currently in an Alpha state.

Requirements

Platform targets

  • Usable in OS X and iOS projects
  • Oldest Mac target: Mac OS X 10.7

Functionality targets

  • Parser to create PDF Structure
  • Extract Deflated and other filtered content
  • Some essential Postscript knowledge and features
  • Modify PDF Objects directly in PDF

Example

Use these includes:

#import <Foundation/Foundation.h>
#import "YPDocument.h"

In this example we add a purple rectangle below the text of every page. See main.c for a working version of this example.

image image

NSString *file =@"/tmp/2-page-pages-export.pdf";

NSData *fileData = [NSData dataWithContentsOfFile:file];

YPDocument *document = [[YPDocument alloc] initWithData:fileData];

YPPages *pg = [[YPPages alloc] initWithDocument:document];
NSLog(@"page count: %d", [pg getPageCount]);

//All Pages unsorted
NSArray * allPages = [document getAllObjectsWithKey:@"Type" value:@"Page"];

for (YPObject* page in allPages) {

    NSString *docContentNumber = [[document getInfoForKey:@"Contents" inObject:[page getObjectNumber]] getReferenceNumber];
    YPObject * pageContentsObject = [document getObjectByNumber:docContentNumber];

    NSData *plainContent = [pageContentsObject getUncompressedStreamContentsAsData];

    NSData *data2 = [@"q /Cs1 cs 0.4 0 0.6 sc 250 600 100 100 re f q " dataUsingEncoding:NSASCIIStringEncoding];

    NSRange firstPartRange = {0,64};
    NSRange lastPartRange = {64, ([plainContent length]-64)};
    NSData *data1 = [plainContent subdataWithRange:firstPartRange];
    NSData *data3 = [plainContent subdataWithRange:lastPartRange];

    NSMutableData * newPlainContent = [data1 mutableCopy];
    [newPlainContent appendData:data2];
    [newPlainContent appendData:data3];

    [pageContentsObject setStreamContentsWithData:newPlainContent];
    [document addObjectToUpdateQueue:pageContentsObject];
}

[document updateDocumentData];
[[document modifiedPDFData] writeToFile:@"/tmp/2-page-pages-export-mod.pdf" atomically:YES];

Roadmap

Milestone 1: update page contents object

  • Return all document objects
  • Deflate content object stream
  • cleanup deflate function
  • Enable Existing Tests
  • Enable travis
  • Add some file intergration tests
  • Return all document pages
  • Return page content object
  • Add new object at file bottom
  • Add new xref table at file bottom
  • Add new trailer
  • calculate file length
  • calc object length
  • fix and check all offsets;

Milestone 2: first CocoaPod Release

  • Make podspec
  • Replace PDF prefix with YAPDF everywhere

Milestone 3: first CocoaPod Release

  • remove nsstring convertion for streams
  • add included pdf in main.c
  • cleanup file reader

Backlog

  • more examples
  • Return all page objects / per page
  • add inflate function
  • Exact Text (ProcessOutput)
  • Code Coverage
  • Rename all object attributes classes with a name including object

Motivation

This project started because we needed to remove white backgrounds from PDF's made by Applications like Apple Pages. YAPDFKit is used in the PDF Letterhead App.

image

image

Contributing

  1. Fork it ( https://github.com/[my-github-username]/YAPDFKit/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Credits

image

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].