Skip to content

Instantly share code, notes, and snippets.

View practicingruby's full-sized avatar

Gregory Brown practicingruby

View GitHub Profile
API = ffi_builder("C:/Windows/pcmsvr32.dll") do
short :PCMSOpenServer, [:int, :int]
int :PCMSCloseServer, [:short]
long :PCMSCalcDistance, [:string, :string]
end
require "java"
require "rubygems"
require "flying_saucer"
pdf_file = java.io.File.new(ARGV[0].sub(/html$/,"pdf"))
renderer = org.xhtmlrenderer.pdf.ITextRenderer.new
renderer.set_document(java.io.File.new(ARGV[0]))
renderer.layout
set vb t_vb=
set nobackup
set nowritebackup
set noswapfile
set backspace=indent,eol,start
set history=50 " keep 50 lines of command line history
set ruler " show the cursor position all the time
set showcmd " display incomplete commands
body {
font-family: Gill Sans;
font-size: 20px;
}
div#wrapper {
width: 900px;
margin-left: auto;
margin-right: auto;
margin-top: 50px;
This file has been truncated, but you can view the full file.
diff --git a/test.pdf b/test.pdf
index 2cd671f3d193f628a4e75411d07d1c7bfe78187b..139357ebffc87a199591f626c8fd956dc2bb24d4 100644
GIT binary patch
delta 952155
zcmb?^1$<OT_h>fRB|wM~To>0Q>jFgrNzjCl1PvCFjX;tOQLHQ!EmnMRmtsXrC<O|o
z#l3iol@?l@3bg1uV|T9v`v1T8zW%;&@12=5=bSk<XJjXS(eC)QsVY~!nDEG8eTd1o
z-p_Z={NP*KXti3jI<0fyAnivVg?3KQawO)Y4|gPM^`V`$dYesWHkm`aXrY=tG(u~$
z*-WO;XsuCi3XO+ioyl&~hql)yXssrrMQgHH^?h5m^mSw<13+Ib{h#m997l>T>B#75
zw$2<~#icjsbylqo|4*CcTbexR4F;P@@y%#7D!y3^dgV7vh7_JrXI9iRT5vs=tfI{#
module RAAWS
ONE_NECESSARY_SEARCH_PARAM =%w<
Actor Artist AudienceRating Author
Brand BrowseNode Composer Conductor CityDirector
Keywords Manufacturer MusicLabel Neighborhood
Orchestra Power Publisher TextStream Title>
class ItemOperation < Operation
def self.lookup(item_id, index=nil, &block)
Prawn::Document.generate("raw_lines.pdf", :skip_page_creation => true) do
# SET UP A PAGE
@page_content = ref(:Length => 0)
@current_page = ref(:Type => :Page,
:Parent => @pages,
:MediaBox => [0, 0, 612.0, 792.0],
:Contents => @page_content)
# ADD IT TO THE PAGE LIST
@pages.data[:Kids] << @current_page
@data=[
{ "row" => '1', "name" => "Gandalf", "race" => "Human" },
{ "row" => '2', "name" => "Bilbo", "race" => "Hobbit" },
{ "row" => '3', "name" => 'Frodo', "race" => "Hobbit" },
{ "row" => '4', "name" => 'Saruman', "race" => "Human" },
{ "row" => '5', "name" => 'Sauron', "race" => "???" },
]*2000
pdf_doc = PDF::Writer.new
table = PDF::SimpleTable.new
RGhost::Document.new do |doc|
doc.matrix_grid do |g|
g.column 'row'
g.column 'name'
g.column 'race'
g.style(:border_lines)
g.data(@data_array)
end
doc.render :pdf, :filename => 'rghost.pdf'
end
def build_jpg_object(data, jpg)
color_space = case jpg.channels
when 1
:DeviceGray
when 3
:DeviceRGB
when 4
:DeviceCMYK
else
raise ArgumentError, 'JPG uses an unsupported number of channels'