Skip to content

Instantly share code, notes, and snippets.

View szahn's full-sized avatar

Stuart Zahn szahn

View GitHub Profile
@szahn
szahn / TiffToPDFConverter
Last active September 18, 2017 15:24
Converting a tiff to pdf using iText.
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.List;
import com.itextpdf.text.Document;
import com.itextpdf.text.DocumentException;
import com.itextpdf.text.Image;
import com.itextpdf.text.io.FileChannelRandomAccessSource;
@szahn
szahn / EncodeBased64Binary.java
Created October 8, 2012 16:34 — forked from utsengar/EncodeBased64Binary.java
Encode a file to base64 binary in Java
import org.apache.commons.codec.binary.Base64;
private String encodeFileToBase64Binary(String fileName)
throws IOException {
File file = new File(fileName);
byte[] bytes = loadFile(file);
byte[] encoded = Base64.encodeBase64(bytes);
String encodedString = new String(encoded);