Skip to content

Instantly share code, notes, and snippets.

@manoot
Created January 31, 2012 15:44
Show Gist options
  • Save manoot/1711158 to your computer and use it in GitHub Desktop.
Save manoot/1711158 to your computer and use it in GitHub Desktop.
<?php
foreach ($data as $line){
// go through each line, showing it as required, if it is surrounded by '<>' then
// assume that it is a title
$line=chop($line);
if (strlen($line) && $line[0]=='#'){
// comment, or new page request
switch($line){
case '#NP':
$pdf->ezNewPage();
break;
case '#C':
$pdf->selectFont($codeFont);
$textOptions = array('justification'=>'left','left'=>20,'right'=>20);
$size=10;
break;
case '#c':
$pdf->selectFont($mainFont);
$textOptions = array('justification'=>'full');
$size=12;
break;
case '#X':
$collecting=1;
break;
case '#x':
$pdf->saveState();
eval($code);
$pdf->restoreState();
$pdf->selectFont($mainFont);
$code='';
$collecting=0;
break;
case '#I':
$collecting=1;
break;
case '#i':
$pdf->addPngFromFile('');
$collecting=0;
break;
# data.txt file
1<Indianapolis Field Office>
#I
./tmp_images/INP_-_Indianapolois_Field_Office_496.png
#I
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment