SlideShare a Scribd company logo
1 of 23
How	
  a	
  cupsfilter	
  made	
  a	
  hard	
  
  web	
  conversion	
  easier	
  
100s	
  of	
  web	
  page	
  HTML	
  reports	
  to	
  convert	
  to	
  PDF	
  
How	
  do	
  I	
  do	
  it?	
  
Manually?	
  
Buy	
  a	
  Tool	
  
Some	
  other	
  way...	
  
Google	
  is	
  your	
  friend…	
  
First	
  AIempt:	
  #FAIL	
  




Landscape	
  VS	
  Portrait;	
  data	
  missing/cut	
  off;	
  borders	
  not	
  right	
  
RTFM	
  
$ man convert!
No manual entry for convert!
Idea:	
  What	
  if	
  convert,	
  is	
  something	
  else	
  



                                           SSck	
  Bug	
  
*NIX	
  gives	
  us	
  symbolic	
  links.	
  
$ ls -ln convert!

lrwxr-xr-x 1 0 0 20 Aug 14 2009
convert -> /usr/sbin/cupsfilter!
Is	
  there	
  a	
  manpage	
  for	
  cupsfilter?
cupsfilter(8)                                Apple Inc.                         cupsfilter(8)!
NAME!
       cupsfilter - convert a file to another format using cups filters!
SYNOPSIS!
       cupsfilter [ -c config-file ] [ -e ] -j job-id[,N] [ -m mime/type ] [ -n copies ] [ -o!
       name=value ] [ -p filename.ppd ] [ -t title ] filename!
DESCRIPTION!
       cupsfilter is a front-end to the CUPS filter subsystem which allows you to convert a file to!
       a specific format, just as if you had printed the file through CUPS. By default, cupsfilter!
       generates a PDF file.!
OPTIONS!
       -c config-file!
             Uses the named cupsd.conf configuration file.!
       -e!
             Use every filter from the PPD file.!
       -j job-id[,N]!
             Converts document N from the specified job. If N is omitted, document 1 is converted.!
       -m mime/type!
             Specifies the destination file type. The default file type is application/pdf.      Use!
             printer/foo to convert to the printer format defined by the filters in the PPD file.!
       -n copies!
            Specifies the number of copies to generate.!
       -o name=value!
            Specifies options to pass to the CUPS filters.!

       -p filename.ppd!
            Specifies the PPD file to use.!
OpSons? 	
  	
  
/System/Library/Printers/Libraries/convert!
Usage: convert [ options ]!
Options:!
  -e                   Use every filter from the PPD file!
  -f filename          Set file to be converted (otherwise stdin)!
  -o filename          Set file to be generated (otherwise stdout)!
  -i mime/type         Set input MIME type (otherwise auto-typed)!
  -j mime/type         Set output MIME type (otherwise application/pdf)!
  -P filename.ppd      Set PPD file!
  -a 'name=value ...' Set option(s)!
  -U username          Set username for job!
  -J title             Set title!
  -c copies            Set number of copies!
  -u                   Remove the PPD file when finished!
  -D                   Remove the input file when finished!

/usr/sbin/cupsfilter!
Usage: cupsfilter -m mime/type [ options ] filename!
Options:!
  -c cupsd.conf    Set cupsd.conf file to use!
  -e               Use every filter from the PPD file!
  -j job-id[,N]    Filter file N from the specified job (default is file 1)!
  -n copies        Set number of copies!
  -o name=value    Set option(s)!
  -p filename.ppd Set PPD file!
  -t title         Set title!
Tweak	
  #1:	
  OpSons	
  




Cupsfilter	
  uses	
  –o	
  to	
  set	
  the	
  opSons;	
  convert	
  uses	
  -­‐a	
  
Tweak	
  #2:	
  Media	
  formats	
  




Media	
  format	
  opSons	
  were	
  "LeIer"	
  "Legal"	
  and	
  "A4"	
  but	
  A4	
  worked	
  best.	
  
What	
  opSons	
  did	
  I	
  need?	
  
/System/Library/Printers/
Libraries/convert !

-f   filename.htm !
-o   filename.pdf !
-a   landscape !
-a   scaling=75 !
-a   media=A4!
Working	
  Example:	
  
/System/Library/Printers/
Libraries/convert


-f   contactForm.html !
-o   contactForm.pdf !
-a   landscape !
-a   scaling=75 !
-a   media=A4!
Need	
  to	
  automate	
  




ConverSng	
  hundreds	
  of	
  files.	
  Shell	
  to	
  the	
  rescue!	
  
Shell	
  out	
  a	
  soluSon	
  

for name in `ls *.htm` ; do !
   /System/Library/Printers/Libraries/convert !
   -f $name -o `echo $name !
   | sed s/htm/pdf/` !
   -a landscape -a scaling=75 -a media=A4; !
done !
Room	
  for	
  improvement?	
  
•  Paul	
  Hankin	
  suggested	
  this	
  change	
  for	
  the	
  
   subsStuSon	
  to	
  automate	
  the	
  conversion:	
  $
   {name/htm/pdf}	
  instead	
  of	
  back	
  quoSng	
  
   using	
  sed	
  
•  Use	
  cupsfilter	
  directly;	
  specify	
  the	
  opSons	
  
   from	
  the	
  manpage.	
  
Victory!	
  
World	
  is	
  saved;	
  the	
  birds	
  are	
  singing,	
  the	
  rainbows	
  are	
  out,	
  the	
  sun	
  is	
  shining.	
  

                                   *NIX	
  variant	
  (OS	
  X)	
  to	
  the	
  rescue!	
  
                 I	
  could	
  have	
  used	
  OS	
  X,	
  Linux,	
  or	
  CygWin	
  on	
  a	
  PC	
  for	
  this.	
  	
  

Ran	
  in	
  an	
  hour	
  and	
  some	
  change	
  for	
  100s	
  of	
  files	
  in	
  a	
  few	
  different	
  directories.	
  
CreaSve	
  Commons	
  Imagery	
  List	
  
These	
  images	
  are	
  CreaSve	
  Commons	
  licensed	
  images	
  I	
  found	
  on	
  Flickr	
  (through	
  a	
  
Yahoo	
  search)	
  from	
  the	
  users	
  listed	
  below.	
  The	
  excepSons	
  are	
  the	
  Adobe	
  ™	
  icon	
  taken	
  
from	
  the	
  Adobe	
  ™	
  website	
  and	
  the	
  wikipedia	
  page	
  where	
  I	
  got	
  the	
  Paper	
  image	
  from.	
  
•  Reports	
  image:	
  artnoose	
  
•  QuesSon	
  Marks:	
  crystaljingsr	
  
•  Manual	
  labor/man	
  digging	
  a	
  ditch:	
  worldbank	
  
•  Chisels:	
  cfa	
  
•  Australian	
  Web	
  Bridge:	
  Smmythesuk	
  
•  Broken	
  Bridge	
  (#FAIL):	
  ghostv	
  
•  Light	
  Bulb	
  Idea:	
  preef	
  
•  SSck	
  bug:	
  safoocat	
  
•  Swirls	
  for	
  “opSons”	
  page:	
  kymberlyanne	
  
•  Paper	
  size	
  image:	
  
   hIp://en.wikipedia.org/wiki/File:A_size_illustraSon2_with_leIer_and_legal.svg	
  
•  Super	
  Hero	
  clip-­‐art:	
  hIp://www.clker.com/	
  
•  Rainbow:	
  homer4k	
  

More Related Content

Similar to How a Cupsfilter Made a Hard Web Conversion Easier

Batch uploading to the Internet Archive using Python
Batch uploading to the Internet Archive using PythonBatch uploading to the Internet Archive using Python
Batch uploading to the Internet Archive using PythonAlison Harvey
 
NYPHP March 2009 Presentation
NYPHP March 2009 PresentationNYPHP March 2009 Presentation
NYPHP March 2009 Presentationbrian_dailey
 
Linux powerpoint
Linux powerpointLinux powerpoint
Linux powerpointbijanshr
 
Computer basics--basic comp-oper
Computer basics--basic comp-operComputer basics--basic comp-oper
Computer basics--basic comp-operSabbir Alam
 
The structure of Linux - Introduction to Linux for bioinformatics
The structure of Linux - Introduction to Linux for bioinformaticsThe structure of Linux - Introduction to Linux for bioinformatics
The structure of Linux - Introduction to Linux for bioinformaticsBITS
 
Autoconf&Automake
Autoconf&AutomakeAutoconf&Automake
Autoconf&Automakeniurui
 
Shell Scripts
Shell ScriptsShell Scripts
Shell ScriptsDr.Ravi
 
Introduction to C programming
Introduction to C programmingIntroduction to C programming
Introduction to C programmingRokonuzzaman Rony
 
Love Your Command Line
Love Your Command LineLove Your Command Line
Love Your Command LineLiz Henry
 
Morphosyntactic analysis for stylometry
Morphosyntactic analysis for stylometryMorphosyntactic analysis for stylometry
Morphosyntactic analysis for stylometrySilvie Cinková
 

Similar to How a Cupsfilter Made a Hard Web Conversion Easier (20)

Batch uploading to the Internet Archive using Python
Batch uploading to the Internet Archive using PythonBatch uploading to the Internet Archive using Python
Batch uploading to the Internet Archive using Python
 
NYPHP March 2009 Presentation
NYPHP March 2009 PresentationNYPHP March 2009 Presentation
NYPHP March 2009 Presentation
 
Linux powerpoint
Linux powerpointLinux powerpoint
Linux powerpoint
 
Computer basics--basic comp-oper
Computer basics--basic comp-operComputer basics--basic comp-oper
Computer basics--basic comp-oper
 
The structure of Linux - Introduction to Linux for bioinformatics
The structure of Linux - Introduction to Linux for bioinformaticsThe structure of Linux - Introduction to Linux for bioinformatics
The structure of Linux - Introduction to Linux for bioinformatics
 
Autoconf&Automake
Autoconf&AutomakeAutoconf&Automake
Autoconf&Automake
 
Adobe AIR & Printing
Adobe AIR & PrintingAdobe AIR & Printing
Adobe AIR & Printing
 
C_Intro.ppt
C_Intro.pptC_Intro.ppt
C_Intro.ppt
 
Using monodoc
Using monodocUsing monodoc
Using monodoc
 
Sandy Report
Sandy ReportSandy Report
Sandy Report
 
Sandy Report
Sandy ReportSandy Report
Sandy Report
 
Shell Scripts
Shell ScriptsShell Scripts
Shell Scripts
 
PerlScripting
PerlScriptingPerlScripting
PerlScripting
 
Introduction to C programming
Introduction to C programmingIntroduction to C programming
Introduction to C programming
 
Love Your Command Line
Love Your Command LineLove Your Command Line
Love Your Command Line
 
unix-editors.pdf
unix-editors.pdfunix-editors.pdf
unix-editors.pdf
 
Morphosyntactic analysis for stylometry
Morphosyntactic analysis for stylometryMorphosyntactic analysis for stylometry
Morphosyntactic analysis for stylometry
 
Ext 0523
Ext 0523Ext 0523
Ext 0523
 
Linux
Linux Linux
Linux
 
Rmarkdown cheatsheet-2.0
Rmarkdown cheatsheet-2.0Rmarkdown cheatsheet-2.0
Rmarkdown cheatsheet-2.0
 

More from Matthew McCullough

Using Git and GitHub Effectively at Emerge Interactive
Using Git and GitHub Effectively at Emerge InteractiveUsing Git and GitHub Effectively at Emerge Interactive
Using Git and GitHub Effectively at Emerge InteractiveMatthew McCullough
 
All About GitHub Pull Requests
All About GitHub Pull RequestsAll About GitHub Pull Requests
All About GitHub Pull RequestsMatthew McCullough
 
Git Graphs, Hashes, and Compression, Oh My
Git Graphs, Hashes, and Compression, Oh MyGit Graphs, Hashes, and Compression, Oh My
Git Graphs, Hashes, and Compression, Oh MyMatthew McCullough
 
Git and GitHub at the San Francisco JUG
 Git and GitHub at the San Francisco JUG Git and GitHub at the San Francisco JUG
Git and GitHub at the San Francisco JUGMatthew McCullough
 
Migrating from Subversion to Git and GitHub
Migrating from Subversion to Git and GitHubMigrating from Subversion to Git and GitHub
Migrating from Subversion to Git and GitHubMatthew McCullough
 
Build Lifecycle Craftsmanship for the Transylvania JUG
Build Lifecycle Craftsmanship for the Transylvania JUGBuild Lifecycle Craftsmanship for the Transylvania JUG
Build Lifecycle Craftsmanship for the Transylvania JUGMatthew McCullough
 
Git Going for the Transylvania JUG
Git Going for the Transylvania JUGGit Going for the Transylvania JUG
Git Going for the Transylvania JUGMatthew McCullough
 
Transylvania JUG Pre-Meeting Announcements
Transylvania JUG Pre-Meeting AnnouncementsTransylvania JUG Pre-Meeting Announcements
Transylvania JUG Pre-Meeting AnnouncementsMatthew McCullough
 
Game Theory for Software Developers at the Boulder JUG
Game Theory for Software Developers at the Boulder JUGGame Theory for Software Developers at the Boulder JUG
Game Theory for Software Developers at the Boulder JUGMatthew McCullough
 
Cascading Through Hadoop for the Boulder JUG
Cascading Through Hadoop for the Boulder JUGCascading Through Hadoop for the Boulder JUG
Cascading Through Hadoop for the Boulder JUGMatthew McCullough
 

More from Matthew McCullough (20)

Using Git and GitHub Effectively at Emerge Interactive
Using Git and GitHub Effectively at Emerge InteractiveUsing Git and GitHub Effectively at Emerge Interactive
Using Git and GitHub Effectively at Emerge Interactive
 
All About GitHub Pull Requests
All About GitHub Pull RequestsAll About GitHub Pull Requests
All About GitHub Pull Requests
 
Adam Smith Builds an App
Adam Smith Builds an AppAdam Smith Builds an App
Adam Smith Builds an App
 
Git's Filter Branch Command
Git's Filter Branch CommandGit's Filter Branch Command
Git's Filter Branch Command
 
Git Graphs, Hashes, and Compression, Oh My
Git Graphs, Hashes, and Compression, Oh MyGit Graphs, Hashes, and Compression, Oh My
Git Graphs, Hashes, and Compression, Oh My
 
Git and GitHub at the San Francisco JUG
 Git and GitHub at the San Francisco JUG Git and GitHub at the San Francisco JUG
Git and GitHub at the San Francisco JUG
 
Finding Things in Git
Finding Things in GitFinding Things in Git
Finding Things in Git
 
Git and GitHub for RallyOn
Git and GitHub for RallyOnGit and GitHub for RallyOn
Git and GitHub for RallyOn
 
Migrating from Subversion to Git and GitHub
Migrating from Subversion to Git and GitHubMigrating from Subversion to Git and GitHub
Migrating from Subversion to Git and GitHub
 
Git Notes and GitHub
Git Notes and GitHubGit Notes and GitHub
Git Notes and GitHub
 
Intro to Git and GitHub
Intro to Git and GitHubIntro to Git and GitHub
Intro to Git and GitHub
 
Build Lifecycle Craftsmanship for the Transylvania JUG
Build Lifecycle Craftsmanship for the Transylvania JUGBuild Lifecycle Craftsmanship for the Transylvania JUG
Build Lifecycle Craftsmanship for the Transylvania JUG
 
Git Going for the Transylvania JUG
Git Going for the Transylvania JUGGit Going for the Transylvania JUG
Git Going for the Transylvania JUG
 
Transylvania JUG Pre-Meeting Announcements
Transylvania JUG Pre-Meeting AnnouncementsTransylvania JUG Pre-Meeting Announcements
Transylvania JUG Pre-Meeting Announcements
 
Game Theory for Software Developers at the Boulder JUG
Game Theory for Software Developers at the Boulder JUGGame Theory for Software Developers at the Boulder JUG
Game Theory for Software Developers at the Boulder JUG
 
Cascading Through Hadoop for the Boulder JUG
Cascading Through Hadoop for the Boulder JUGCascading Through Hadoop for the Boulder JUG
Cascading Through Hadoop for the Boulder JUG
 
JQuery Mobile
JQuery MobileJQuery Mobile
JQuery Mobile
 
R Data Analysis Software
R Data Analysis SoftwareR Data Analysis Software
R Data Analysis Software
 
Please, Stop Using Git
Please, Stop Using GitPlease, Stop Using Git
Please, Stop Using Git
 
Dr. Strangedev
Dr. StrangedevDr. Strangedev
Dr. Strangedev
 

Recently uploaded

Integumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptIntegumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptshraddhaparab530
 
ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxVanesaIglesias10
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptxmary850239
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 
Textual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSTextual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSMae Pangan
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17Celine George
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfPatidar M
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...Postal Advocate Inc.
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSJoshuaGantuangco2
 
Millenials and Fillennials (Ethical Challenge and Responses).pptx
Millenials and Fillennials (Ethical Challenge and Responses).pptxMillenials and Fillennials (Ethical Challenge and Responses).pptx
Millenials and Fillennials (Ethical Challenge and Responses).pptxJanEmmanBrigoli
 
TEACHER REFLECTION FORM (NEW SET........).docx
TEACHER REFLECTION FORM (NEW SET........).docxTEACHER REFLECTION FORM (NEW SET........).docx
TEACHER REFLECTION FORM (NEW SET........).docxruthvilladarez
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
The Contemporary World: The Globalization of World Politics
The Contemporary World: The Globalization of World PoliticsThe Contemporary World: The Globalization of World Politics
The Contemporary World: The Globalization of World PoliticsRommel Regala
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptxmary850239
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Seán Kennedy
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxHumphrey A Beña
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfVanessa Camilleri
 

Recently uploaded (20)

Integumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.pptIntegumentary System SMP B. Pharm Sem I.ppt
Integumentary System SMP B. Pharm Sem I.ppt
 
ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptx
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 
Textual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSTextual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHS
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdf
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
 
Millenials and Fillennials (Ethical Challenge and Responses).pptx
Millenials and Fillennials (Ethical Challenge and Responses).pptxMillenials and Fillennials (Ethical Challenge and Responses).pptx
Millenials and Fillennials (Ethical Challenge and Responses).pptx
 
TEACHER REFLECTION FORM (NEW SET........).docx
TEACHER REFLECTION FORM (NEW SET........).docxTEACHER REFLECTION FORM (NEW SET........).docx
TEACHER REFLECTION FORM (NEW SET........).docx
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
The Contemporary World: The Globalization of World Politics
The Contemporary World: The Globalization of World PoliticsThe Contemporary World: The Globalization of World Politics
The Contemporary World: The Globalization of World Politics
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...
 
Paradigm shift in nursing research by RS MEHTA
Paradigm shift in nursing research by RS MEHTAParadigm shift in nursing research by RS MEHTA
Paradigm shift in nursing research by RS MEHTA
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdf
 

How a Cupsfilter Made a Hard Web Conversion Easier

  • 1. How  a  cupsfilter  made  a  hard   web  conversion  easier  
  • 2. 100s  of  web  page  HTML  reports  to  convert  to  PDF  
  • 3. How  do  I  do  it?  
  • 7. Google  is  your  friend…  
  • 8. First  AIempt:  #FAIL   Landscape  VS  Portrait;  data  missing/cut  off;  borders  not  right  
  • 9. RTFM   $ man convert! No manual entry for convert!
  • 10. Idea:  What  if  convert,  is  something  else   SSck  Bug  
  • 11. *NIX  gives  us  symbolic  links.   $ ls -ln convert! lrwxr-xr-x 1 0 0 20 Aug 14 2009 convert -> /usr/sbin/cupsfilter!
  • 12. Is  there  a  manpage  for  cupsfilter? cupsfilter(8) Apple Inc. cupsfilter(8)! NAME! cupsfilter - convert a file to another format using cups filters! SYNOPSIS! cupsfilter [ -c config-file ] [ -e ] -j job-id[,N] [ -m mime/type ] [ -n copies ] [ -o! name=value ] [ -p filename.ppd ] [ -t title ] filename! DESCRIPTION! cupsfilter is a front-end to the CUPS filter subsystem which allows you to convert a file to! a specific format, just as if you had printed the file through CUPS. By default, cupsfilter! generates a PDF file.! OPTIONS! -c config-file! Uses the named cupsd.conf configuration file.! -e! Use every filter from the PPD file.! -j job-id[,N]! Converts document N from the specified job. If N is omitted, document 1 is converted.! -m mime/type! Specifies the destination file type. The default file type is application/pdf. Use! printer/foo to convert to the printer format defined by the filters in the PPD file.! -n copies! Specifies the number of copies to generate.! -o name=value! Specifies options to pass to the CUPS filters.! -p filename.ppd! Specifies the PPD file to use.!
  • 13. OpSons?     /System/Library/Printers/Libraries/convert! Usage: convert [ options ]! Options:! -e Use every filter from the PPD file! -f filename Set file to be converted (otherwise stdin)! -o filename Set file to be generated (otherwise stdout)! -i mime/type Set input MIME type (otherwise auto-typed)! -j mime/type Set output MIME type (otherwise application/pdf)! -P filename.ppd Set PPD file! -a 'name=value ...' Set option(s)! -U username Set username for job! -J title Set title! -c copies Set number of copies! -u Remove the PPD file when finished! -D Remove the input file when finished! /usr/sbin/cupsfilter! Usage: cupsfilter -m mime/type [ options ] filename! Options:! -c cupsd.conf Set cupsd.conf file to use! -e Use every filter from the PPD file! -j job-id[,N] Filter file N from the specified job (default is file 1)! -n copies Set number of copies! -o name=value Set option(s)! -p filename.ppd Set PPD file! -t title Set title!
  • 14. Tweak  #1:  OpSons   Cupsfilter  uses  –o  to  set  the  opSons;  convert  uses  -­‐a  
  • 15. Tweak  #2:  Media  formats   Media  format  opSons  were  "LeIer"  "Legal"  and  "A4"  but  A4  worked  best.  
  • 16. What  opSons  did  I  need?   /System/Library/Printers/ Libraries/convert ! -f filename.htm ! -o filename.pdf ! -a landscape ! -a scaling=75 ! -a media=A4!
  • 17. Working  Example:   /System/Library/Printers/ Libraries/convert
 -f contactForm.html ! -o contactForm.pdf ! -a landscape ! -a scaling=75 ! -a media=A4!
  • 18. Need  to  automate   ConverSng  hundreds  of  files.  Shell  to  the  rescue!  
  • 19. Shell  out  a  soluSon   for name in `ls *.htm` ; do ! /System/Library/Printers/Libraries/convert ! -f $name -o `echo $name ! | sed s/htm/pdf/` ! -a landscape -a scaling=75 -a media=A4; ! done !
  • 20. Room  for  improvement?   •  Paul  Hankin  suggested  this  change  for  the   subsStuSon  to  automate  the  conversion:  $ {name/htm/pdf}  instead  of  back  quoSng   using  sed   •  Use  cupsfilter  directly;  specify  the  opSons   from  the  manpage.  
  • 21. Victory!   World  is  saved;  the  birds  are  singing,  the  rainbows  are  out,  the  sun  is  shining.   *NIX  variant  (OS  X)  to  the  rescue!   I  could  have  used  OS  X,  Linux,  or  CygWin  on  a  PC  for  this.     Ran  in  an  hour  and  some  change  for  100s  of  files  in  a  few  different  directories.  
  • 22.
  • 23. CreaSve  Commons  Imagery  List   These  images  are  CreaSve  Commons  licensed  images  I  found  on  Flickr  (through  a   Yahoo  search)  from  the  users  listed  below.  The  excepSons  are  the  Adobe  ™  icon  taken   from  the  Adobe  ™  website  and  the  wikipedia  page  where  I  got  the  Paper  image  from.   •  Reports  image:  artnoose   •  QuesSon  Marks:  crystaljingsr   •  Manual  labor/man  digging  a  ditch:  worldbank   •  Chisels:  cfa   •  Australian  Web  Bridge:  Smmythesuk   •  Broken  Bridge  (#FAIL):  ghostv   •  Light  Bulb  Idea:  preef   •  SSck  bug:  safoocat   •  Swirls  for  “opSons”  page:  kymberlyanne   •  Paper  size  image:   hIp://en.wikipedia.org/wiki/File:A_size_illustraSon2_with_leIer_and_legal.svg   •  Super  Hero  clip-­‐art:  hIp://www.clker.com/   •  Rainbow:  homer4k