Advertisement
Guest User

PDF CSS Macro

a guest
May 14th, 2014
1,190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 2.39 KB | None | 0 0
  1. ## Macro title: PDF CSS
  2. ## Macro has a body: N
  3. ## Body processing: No macro body
  4. ## Output: HTML
  5. ##
  6. ## Developed by: Sam Hall
  7. ## Date created: 13/05/2014
  8. ## Installed by: Sam Hall
  9. ## @noparams
  10.  
  11. #set($debugStyles=false)
  12.  
  13. #set($servletPath=$req.getServletPath())
  14.  
  15. #if ($servletPath =="/spaces/flyingpdf/pdfpageexport.action")
  16.  
  17.   #set($pageTitle=$content.getTitle())
  18.  
  19.   #if ($debugStyles)
  20.     #set($debugBlue="background-color:cyan !important;")
  21.     #set($debugYellow="background-color:yellow !important;")
  22.     #set($debugRed="background-color:#FBB !important;")
  23.   #else
  24.     #set($debugBlue="")
  25.     #set($debugYellow="")
  26.     #set($debugRed="")
  27.   #end
  28.  
  29. <div class="pdf-header">
  30.   <img width="300" height="100" align="left" src="data:image/gif;base64,R0lGODdhAQABAJEAAP///8zMzAAAAAAAACwAAAAAAQABAAECAkwBADs="/>
  31.   <span>$pageTitle</span>
  32. </div>
  33.  
  34. <table class="pdf-footer">
  35.   <tr>
  36.     <td class="confluenceTd" colspan="2">Details...</td>
  37.     <td class="confluenceTd" style="width: 120px;text-align:right"><p><span class="page-cnt"></span></p></td></tr>
  38.   <tr>
  39.     <td class="confluenceTd" style="border:none" colspan="3">
  40.       <div style="text-align: center;"><strong><span style="color: rgb(255,0,0);">Some important notice text.</span></strong></div>
  41.     </td>
  42.   </tr>
  43. </table>
  44.  
  45. <style>
  46. <!--
  47.  
  48. @page { $debugRed
  49.  size: A4;
  50.  margin: 42mm 10mm 32mm 10mm; /* headers/footers seem to ignore margins */
  51.  padding: 0 !important; /* maintains sanity */
  52.  
  53.  /* Header Section */
  54.  @top-center { $debugYellow
  55.    content: element(runninglogo);
  56.    text-align:left;
  57.    padding-top: 10mm; /* otherwise doesn't respect top margin */
  58.    display: table-cell;
  59.    vertical-align: top;
  60.    overflow:visible;
  61.  }
  62.  
  63.  /* Footer Section */
  64.  @bottom-center { $debugYellow
  65.    content: element(runningfooter);
  66.    padding-bottom: 10mm; /* otherwise doesn't respect bottom margin */
  67.  }
  68. }
  69.  
  70. /* Remove default page title header */
  71. div.pagetitle > h1 {
  72.  display: none;
  73. }
  74.  
  75. div.pdf-header { $debugRed
  76.  position: running(runninglogo);
  77. }
  78.  
  79. div.pdf-header > span { $debugBlue
  80.  line-height: 1.2;
  81.  font-family: ConfluenceInstalledFont, Helvetica, Arial, sans-serif;
  82.  font-size: 20pt;
  83.  font-weight:bold;
  84. }
  85.  
  86. table.pdf-footer {
  87.  margin-left: 10mm;
  88.  position: running(runningfooter);
  89. }
  90.  
  91. .page-cnt:before {
  92.  content: "Page " counter(page) " of " counter(pages);
  93. }
  94. -->
  95. </style>
  96. #end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement