Home | History | Annotate | Download | only in 5.1
      1 WKTHMLTOPDF README
      2 ==================
      3 Or, how I stopped hating the cdd and learned to love html-to-pdf conversions.
      4 
      5 
      6 OVERVIEW
      7 ==================
      8 TL:DR This document describes how to create a CDD.pdf from the CDD.html file. You need to generate a cover file and a body file, then use Adobe Acrobat to insert the cover page into the body.pdf.
      9 
     10 The Android Compatibilty Definition Document (CDD) is maintained as an html file but distributed as a .pdf. The partner team updates the CDD for every new major Android release and the APE doc team posts the new .pdf to source.android.com in http://source.android.com/compatibility/.
     11 
     12 To create the pdf from the html file, use wkhtmltopdf (http://wkhtmltopdf.org/) plus a little bit of Adobe Acrobat. You can do the conversion on a Mac or Linux (or even Windows); you just need to download the wkhtmltopdf pkg for your system. However, since you must use Adobe Acrobat Pro (not Reader) to insert the cover page, you must perform this step on a Mac or Windows box (none of the Linux PDF apps can do the swap successfully and still maintain the PDF bookmarks and links)
     13 
     14 
     15 1. INSTALL WKHTMLTOPDF
     16 ====================
     17 Go to http://wkhtmltopdf.org/ and download the app for your system. It's command line only.
     18 
     19 
     20 2. GENERATE COVER PDF
     21 ======================
     22 
     23 Syntax:
     24 
     25 wkthmltopdf [page-size] [page-margins] cover path-to-html path-to-pdf
     26 
     27 page-size
     28 Set to letter.
     29 Ex. -s letter
     30 
     31 page-margins
     32 set to 0in (cover goes all the way to page edges)
     33 Ex. -B 0in -T 0in -L 0in -R 0in
     34 
     35 path-to-html
     36 The full path (from root, including the filename) to the cover html file. You will need to update the cover text to specify the release name , number, and date. You might also need to swap the image out for the image associated with the release (store images in compatibility/images).
     37 Ex:
     38 /usr/local/google/home/hvm/Projects/internal/lmp-mr1-dev/docs/source.android.com/src/compatibility/5.1/android-cdd-cover_5_1.html
     39 
     40 path-to-pdf
     41 The full path (from root, including the filename) to where you want the output pdf file to reside. If the pdf file is NOT open (in Preview or some other app), running the command will silently overwrite the existing .pdf.
     42 Ex.
     43 /usr/local/google/home/hvm/Projects/internal/lmp-mr1-dev/docs/source.android.com/src/compatibility/5.1/android-cdd-cover.pdf
     44 
     45 
     46 Example cover command:
     47 
     48 wkhtmltopdf -s letter -B 0in -T 0in -L 0in -R 0in cover /usr/local/google/home/hvm/Projects/internal/lmp-mr1-dev/docs/source.android.com/src/compatibility/5.1/android-cdd-cover_5_1.html /usr/local/google/home/hvm/Projects/internal/lmp-mr1-dev/docs/source.android.com/src/compatibility/5.1/android-cdd-cover.pdf
     49 
     50 
     51 3. GENERATE BODY PDF
     52 ====================
     53 Syntax:
     54 
     55 wkthmltopdf [page-margins] page path-to-html path-to-footer path-to-pdf
     56 
     57 page-margins
     58 set to 1in on top and bottom, .75in on left and right.
     59 Ex. -B 1in -T 1in -L .75in -R .75in
     60 
     61 path-to-html
     62 The full path (from root, including the filename) to the body html file. This is the main cdd.html, which will change with each release.
     63 Ex.
     64 /usr/local/google/home/hvm/Projects/internal/lmp-mr1-dev/docs/source.android.com/src/compatibility/5.1/android-5.1-cdd.html
     65 
     66 path-to-footer
     67 The full path (from root, including the filename) to the footer html file. This is a simple html file that contains the android logo and some javascript to calculate the page number and count. The footer should NOT change from release to release.
     68 Ex.
     69 --footer-html /usr/local/google/home/hvm/Projects/internal/lmp-mr1-dev/docs/source.android.com/src/compatibility/5.1/android-cdd-footer.html
     70 
     71 
     72 path-to-pdf
     73 The full path (from root, including the filename) to where you want the output pdf file to reside. If the pdf file is NOT open (in Preview or some other app), running the command will silently overwrite the existing .pdf.
     74 Ex.
     75 /usr/local/google/home/hvm/Projects/internal/lmp-mr1-dev/docs/source.android.com/src/compatibility/5.1/android-cdd-body.pdf
     76 
     77 
     78 Example body command:
     79 
     80 wkhtmltopdf -B 1in -T 1in -L .75in -R .75in page /usr/local/google/home/hvm/Projects/internal/lmp-mr1-dev/docs/source.android.com/src/compatibility/5.1/android-5.1-cdd.html --footer-html /usr/local/google/home/hvm/Projects/internal/lmp-mr1-dev/docs/source.android.com/src/compatibility/5.1/android-cdd-footer.html /usr/local/google/home/hvm/Projects/internal/lmp-mr1-dev/docs/source.android.com/src/compatibility/5.1/android-cdd-body.pdf
     81 
     82 4. CREATE CSS PDF
     83 ==================
     84 A. Open the body.pdf in Adobe Acrobat Pro (you *cannot* use Acrobat Reader for this task).
     85 B. Select Tools > Replace, then open the cover.pdf file and replace page 1 of the body.pdf with page 1 of the cover.pdf.
     86 C. Save the new file as the android-cdd_x_x.pdf (where X_X is the number of the release, such as 5.1).
     87 
     88 QUESTIONS?
     89 ==================
     90 - For details on wkhtmltopdf, see http://wkhtmltopdf.org/usage/wkhtmltopdf.txt.
     91 - all cdd html, css, and current pdf files are in docs/source.android.com/src/compatibility/release-number (currently 5.1).
     92 - all cdd images are in docs/source.android.com/src/compatibility/images.
     93 - all files currently in the lmp-dev-mr1 branch.