Skip to content

Commit

Permalink
see changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
Myst authored and Myst committed Oct 26, 2014
1 parent 4027364 commit 7b48c9f
Show file tree
Hide file tree
Showing 11 changed files with 89 additions and 52 deletions.
36 changes: 9 additions & 27 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,32 +1,14 @@

.yardoc/proxy_types

.yardoc/checksums

.yardoc/object_types

.yardoc/objects/root.dat

*.gem
*.rbc
.bundle
.config
.yardoc
Gemfile.lock
InstalledFiles
_yardoc
coverage
doc/
lib/bundler/man
pkg
rdoc
spec/reports
test/tmp
test/version_tmp
tmp
/.bundle/
/.yardoc
/Gemfile.lock
/_yardoc/
/coverage/
/doc/
/pkg/
/spec/reports/
/tmp/
*.bundle
*.so
*.o
*.a
mkmf.log

13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#Change Log

***

Change log v.0.1.6

**Fix**: added Mutex to font library (which was shared by all PDFWriter objects) - now fonts are thread safe (PDF objects are NOT thread safe by design).

**update**: updated license to MIT.

**known issues**: encrypted PDF files can sometimes silently fail (producing empty pages) - this is because on an attempted decrypt. more work should be done to support encrypted PDF files. please feel fee to help.

I use this version on production, where I have control over the PDF files I use. It is beter then system calls to pdftk (which can cause all threads in ruby to hold, effectively causing my web app to hang).
4 changes: 4 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
source 'https://rubygems.org'

# Specify your gem's dependencies in combine_pdf.gemspec
gemspec
22 changes: 22 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Copyright (c) 2014 Myst

MIT License

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ Credit to his wonderful is given here. Please respect his license and copyright.

License
=======
GPLv3
MIT



Expand Down
2 changes: 2 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
require "bundler/gem_tasks"

43 changes: 24 additions & 19 deletions combine_pdf.gemspec
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
# -*- encoding : utf-8 -*-
########################################################
## Thoughts from reading the ISO 32000-1:2008
## this file is part of the CombinePDF library and the code
## is subject to the same license.
########################################################
Gem::Specification.new do |s|
s.name = 'combine_pdf'
s.version = '0.1.6'
s.date = Time.now.strftime "%Y-%m-%d"
s.add_runtime_dependency 'ruby-rc4', '>= 0.1.5'
s.required_ruby_version = '>= 1.9.2'
s.summary = "Combine, stamp and watermark PDF files in pure Ruby."
s.description = "A nifty gem, in pure Ruby, to parse PDF files and combine (merge) them with other PDF files, number the pages, watermark them or stamp them, create tables or basic text objects etc` (all using the PDF file format)."
s.authors = ["Boaz Segev", "Masters of the open source community"]
s.email = '[email protected]'
s.files = Dir["{lib}/**/*.rb"] #["lib/combine_pdf.rb", "lib/combine_pdf/combine_pdf_pdf.rb", "lib/combine_pdf/combine_pdf_parser.rb" , "lib/combine_pdf/combine_pdf_decrypt.rb" , "lib/combine_pdf/combine_pdf_filter.rb" ]
s.homepage = 'https://github.com/boazsegev/combine_pdf'
s.license = 'MIT'
# coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'combine_pdf/version'

Gem::Specification.new do |spec|
spec.name = "combine_pdf"
spec.version = CombinePdf::VERSION
spec.authors = ["Boaz Segev"]
spec.email = ["We try, we fail, we do, we are"]
spec.summary = %q{Combine, stamp and watermark PDF files in pure Ruby.}
spec.description = %q{A nifty gem, in pure Ruby, to parse PDF files and combine (merge) them with other PDF files, number the pages, watermark them or stamp them, create tables or basic text objects etc` (all using the PDF file format).}
spec.homepage = "https://github.com/boazsegev/combine_pdf"
spec.license = "MIT"

spec.files = `git ls-files -z`.split("\x0")
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]

spec.add_runtime_dependency 'ruby-rc4', '>= 0.1.5'

spec.add_development_dependency "bundler", "~> 1.7"
spec.add_development_dependency "rake", "~> 10.0"
end
6 changes: 3 additions & 3 deletions lib/combine_pdf.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# -*- encoding : utf-8 -*-
# use under GPLv3 terms only

require 'zlib'
require 'securerandom'
Expand All @@ -16,6 +15,7 @@
load "combine_pdf/combine_pdf_filter.rb"
load "combine_pdf/combine_pdf_parser.rb"
load "combine_pdf/combine_pdf_pdf.rb"
require "combine_pdf/version"


# This is a pure ruby library to combine/merge, stmap/overlay and number PDF files - as well as to create tables (ment for indexing combined files).
Expand Down Expand Up @@ -101,7 +101,7 @@
#
# == License
#
# GPLv3
# MIT
module CombinePDF
module_function

Expand Down Expand Up @@ -288,7 +288,7 @@ def register_font_from_pdf_object font_name, font_object

#########################################################
# this file is part of the CombinePDF library and the code
# is subject to the same license (GPLv3).
# is subject to the same license (MIT).
#########################################################
# PDF object types cross reference:
# Indirect objects, references, dictionaries and streams are Hash
Expand Down
8 changes: 7 additions & 1 deletion lib/combine_pdf/combine_pdf_fonts.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,9 @@ def register_font(font_name, font_metrics, font_pdf_object, font_cmap = nil)
new_font.cmap = font_cmap
new_font[:is_reference_only] = true
new_font[:referenced_object] = font_pdf_object
FONTS_LIBRARY[new_font.name] = new_font
FONTS_LIBRARY_MUTEX.synchronize do
FONTS_LIBRARY[new_font.name] = new_font
end
new_font
end

Expand Down Expand Up @@ -342,6 +344,10 @@ def register_font_from_pdf_object font_name, font_object
# the Hash listing all the fonts.
FONTS_LIBRARY = {}

# the Mutex for library write access

FONTS_LIBRARY_MUTEX = Mutex.new


# this method parses a cmap file using it's data stream
# FIXME:
Expand Down
2 changes: 1 addition & 1 deletion lib/combine_pdf/combine_pdf_operations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ def _format_hash_to_pdf(object)

#########################################################
# this file is part of the CombinePDF library and the code
# is subject to the same license (GPLv3).
# is subject to the same license (MIT).
#########################################################
# PDF object types cross reference:
# Indirect objects, references, dictionaries and streams are Hash
Expand Down
3 changes: 3 additions & 0 deletions lib/combine_pdf/version.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module CombinePdf
VERSION = "0.1.6"
end

0 comments on commit 7b48c9f

Please sign in to comment.