Skip to content

Instantly share code, notes, and snippets.

View ksob's full-sized avatar

Kamil Sobieraj ksob

View GitHub Profile
@ksob
ksob / gist:9469618
Last active August 29, 2015 13:57
compiling and packaging iText 2.0.8
COMPILING iText 2.0.8 -------------------
get sources: http://grepcode.com/snapshot/repo1.maven.org/maven2/com.lowagie/itext/2.0.8
$> jar -xvf itext-2.0.8.jar
$> cd itext/ant
replace pom.xml with https://gist.github.com/ksob/9469713
copy core/com dir to ant/src/main/resources (maven will filter out resources like *.awf *.html itself, you can just copy whole dir)
$> mvn compile
$> mvn package
@ksob
ksob / gist:9469713
Created March 10, 2014 17:25
pom.xml for compiling old iText 2.0.8 on recent maven (may work for other iText versions as well)
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.lowagie</groupId>
<artifactId>itext</artifactId>
<packaging>jar</packaging>
<name>iText, a Free Java-PDF library</name>
<version>2.0.8</version>
@ksob
ksob / gist:9484568
Created March 11, 2014 12:23
BaseFont.java (iText 2.0.8)
/*
* $Id: BaseFont.java 3061 2007-12-03 20:08:33Z xlv $
* $Name$
*
* Copyright 2000-2006 by Paulo Soares.
*
* The contents of this file are subject to the Mozilla Public License Version 1.1
* (the "License"); you may not use this file except in compliance with the License.
* You may obtain a copy of the License at http://www.mozilla.org/MPL/
*
@ksob
ksob / gist:9484602
Last active August 29, 2015 13:57
COMPILING CreatePdf.java and PDFServerThread.java for Sage One
cd /Users/developer/work/Sage/project_fuji/fuji_support/lib/pdf_server
COMPILING CreatePdf.java -------------------
javac -cp jars/iText-2.0.8.jar:jars/core-renderer.jar:jars/xml-apis-xerces-2.9.1.jar:jars/jtidy-r938.jar:jars/core-renderer-minimal.jar:. src/CreatePdf.java
cp src/CreatePdf.class lib/pdfserver/
COMPILING PDFServerThread.java -------------------
javac -cp jars/iText-2.0.8.jar:jars/core-renderer.jar:jars/xml-apis-xerces-2.9.1.jar:jars/jtidy-r938.jar:jars/core-renderer-minimal.jar:lib:. src/PDFServerThread.java
cp src/PDFServerThread.class lib/pdfserver/
@ksob
ksob / gist:af9031dd6525b3e96258
Created May 30, 2014 14:21
sageone_pl/sopl_accounts/app/models/sopl_accounts/fixed_asset.rb --- after refactoring - duplication removed - flog/flay
module SoplAccounts
class FixedAsset < ActiveRecord::Base
self.table_name = :fixed_assets
belongs_to :business
has_one :sales_invoice, class_name: 'FujiInvoicing::SalesInvoice'
has_many :fixed_assets_amortizations, class_name: 'SoplAccounts::FixedAssetsAmortization', dependent: :delete_all
after_initialize :set_placed_in_service_date_defaults,
:set_acquisition_date_defaults,
@ksob
ksob / gist:1c1962756fff598943c1
Created June 17, 2014 11:43
Running PDF Server
RUNNING PDF SERVER------------------------------------
cd /Users/developer/work/Sage/project_fuji/fuji_support/bin
$> ./fuji_pdf_server start
STOPING PDF SERVER------------------------------------
MODIFY fuji_pdf_server like this:
stop = "ps -ef | grep PDFServer | grep java | awk '{print$2}' | xargs kill -9"
$> ./fuji_pdf_server stop
@ksob
ksob / gist:a7188d2bd7da1b937253
Created July 2, 2014 12:35
Issue on mysageone_pl / _es
There is a problem that shows up in Ruby 2.1.x (Jenkins is running it)
Chuck LeDuc Díaz: I downgraded your mysageone_pl build to 2.0.0-p451 and it works
Chuck LeDuc Díaz: http://jenkins.sage1.es/job/mysageone_pl/42/console
Chuck LeDuc Díaz: we have the same problem in sageone_es
Chuck LeDuc Díaz: but I don't know what causes it.
I copied promo code functionality from _es but have problem with tests.
Working locally on my Mac all tests passes (bundle exec fudge build) but on UAT, the Jenkins build fails.
@ksob
ksob / gist:36c75b10463e6a2d08aa
Created July 11, 2014 14:28
Why there are no polish chars in XML?
The string is properly sent from ruby pdf_generator because we are sending:
const unsigned int modFileSize = 2089;
const char modFile[] = {
0x3C, 0x3F, 0x78, 0x6D, 0x6C, 0x20, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6F, 0x6E, 0x3D, 0x22
, 0x31, 0x2E, 0x30, 0x22, 0x20, 0x65, 0x6E, 0x63, 0x6F, 0x64, 0x69, 0x6E, 0x67, 0x3D, 0x22
, 0x75, 0x74, 0x66, 0x2D, 0x38, 0x22, 0x3F, 0x3E, 0x0A, 0x3C, 0x46, 0x3E, 0x0A, 0x20, 0x20
, 0x3C, 0x44, 0x3E, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x3C, 0x4E, 0x3E, 0x46, 0x61, 0x6B, 0x74
, 0x75, 0x72, 0x61, 0x20, 0x73, 0x70, 0x72, 0x7A, 0x65, 0x64, 0x61, 0xC5, 0xBC, 0x79, 0x3C
, 0x2F, 0x4E, 0x3E, 0x0A, 0x20, 0x20, 0x20, 0x20, 0x3C, 0x4F, 0x64, 0x62, 0x69, 0x6F, 0x72
@ksob
ksob / gist:777472bed4cee4241b74
Created July 23, 2014 07:57
Prawn declarations print PDF
pdf.font "app/assets/fonts/verdana.ttf"
pdf.font_size 12
@background = "app/assets/declarations/vat-7.png"
#pdf.canvas { pdf.image(@background, :width => pdf.bounds.width) } if @background
pdf.image(@background, :width => pdf.bounds.width + 30, :at => [-15,pdf.bounds.height + 40])
pdf.draw_text "999999999999", :at => [50,705]
pdf.draw_text "Urząd Skarbowy w Sochaczewie", :at => [45,590]
pdf.draw_text "12345,89", :at => [430,0]
pdf.start_new_page(:layout => :portrait)
@ksob
ksob / gist:fafde8927912dc04262b
Last active August 29, 2015 14:16
installation of openport tool supporting encrypted RSA on Mac OS X 10.9.2
1. Install python 2.7.X from: https://www.python.org/downloads/
2. Install mac ports from: https://www.macports.org/install.php
3. Run commands:
su admin_user
sudo easy_install pip
sudo pip install virtualenv
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
sudo port install freetype