card conversion

Goal: convert TPB PDFs to baseball-card size (2.5×3.5) with a layout compatible with batch cutting.

The 1973 PDF cards are 2.75×4. Horizontal margins are 0.25, but vertical margins are only 0.125.

Margins on Scott’s 1977 set are equal! 0.25, I think. Also, I looked at a set of his as-shipped TPB cards. They are a little bigger than the PDFs, and are cut to 2.75 x 4.25, which is letter in eight pieces. They’re not cut to exactly the same size. I wonder why the PDFs aren’t laid out like the print job. Found out that the cards are laid out in Excel. (!)

Might be interesting to format them like print jobs (2.75 x 4.25) instead of 2.5 x 3.5.

Installed DarwinPorts and used it to install netpbm, Image Magick, and Xpdf.

netpbm documentation: main page and directory.

Xpdf is interesting. pdftotext will extract text, though it would take some complex parsing to grok it. (pdftotext -f 20 -l 20 -upw lenny -layout 1973_Hitters.pdf)

Brooks Robinson                       Baltimore 1973   
Bats: Rsp                    TPB 2      Salary 2378    
.264 vs L                    .254 vs R       POS/R/E   
   0 - 10 Crazy Play!           0 - 10      3B/AV/17   
  11 - 70        Error?        11 - 70                 
  71 - 80      ss LO 2b        71 - 80                 
  81 - 96 Park Effects         81 - 96                 
  97 - 136 gcf 1B gcf          97 - 141                
 137 - 151 lcf 2B rcf                      Pwr L: 1    
 152 - 188    ss DP 2b        142 - 188 Pwr R: 2       
 189 - 229 lcf 1B rcf         189 - 234                
              lcf 3B rcf      235 - 235 Speed: 6       
                cf SF cf      236 - 245 Steal: 2       
                   HR         246 - 253 Jump: 1        
                   HB         254 - 257 Bunt: 4        
 230 - 261    ss RG 2b        258 - 295 Clutch: T      
 262 - 335         BB         296 - 331 H&R: SP        
 336 - 349          K         332 - 345 Injury: 4      
 350 - 364     lfl 2B rfl                   Age: 36    
 365 - 397    ss RG 2b        346 - 384     RBI: 72    
 398 - 499      cf EF cf      385 - 499     BB: 55     
AVG: .257       www.          AB: 549         K: 50    
OBP: .326 TPBaseball           H: 141       SB: 2      
SLG: .344        .com         HR:     9     CS: 0      

Info on the PDF file:

% pdfinfo -upw *** 1973_Hitters.pdf 
Title:          1973 Batters.xls
Author:         ***
Creator:        PScript5.dll Version 5.2
Producer:       Acrobat Distiller 8.0.0 (Windows)
CreationDate:   Sat May 12 09:14:26 2007
ModDate:        Sat Aug 25 07:37:25 2007
Tagged:         no
Pages:          63
Encrypted:      yes (print:yes copy:yes change:yes addNotes:yes)
Page size:      612 x 792 pts (letter)
File size:      299175 bytes
Optimized:      yes
PDF version:    1.6

% pdffonts -upw *** 1973_Hitters.pdf
name                                 type              emb sub uni object ID
------------------------------------ ----------------- --- --- --- ---------
ArialNarrow,Bold                     TrueType          no  no  no     224  0
ArialNarrow                          TrueType          no  no  no     225  0
ArialNarrow                          TrueType          no  no  no     195  0
ArialNarrow-Bold                     TrueType          no  no  no     196  0
Arial-BoldMT                         TrueType          no  no  no     197  0

pdftoppm will convert any page, but there’s some fishy font substitution. (pdftoppm -f 20 -l 20 -r 300 -gray -upw lenny -t1lib yes -freetype no 1973_Hitters.pdf x && pnmtopng x-000020.pgm > ! x.png)

pdftoppm-example.png

pdftops does better on the fonts, but one of the bold faces is still wrong. Turns out the Arial is converted to Helvetica, but the bold & the narrowness is lost. That’s easy to fix.

Does the bold on the on-base rolls enhance or diminish readability? Here’s no bold:

nobold1.png

Wrote card_munge.pl to rearrange a selected range of pages.

  1. PDF to Postscript.
  2. Tweak font definition.
  3. Convert to PBM.
  4. Cut out, pad, & scale each card. 2.5×3.5 in = 900×1260 pels @ 360 dpi. (Should scale, then pad.)
  5. Cat them together.
  6. Convert to PNG with resolution specified.

1973_team_hitters_026.png

To do:

  • Fix font tweak to be more general.
  • Add guide lines/page.
  • Border, scale to scale, border.
  • Try big cards (8 up).

Leave a Reply