3

I have a view, displayed as table on single page.

HTML print view looks ok (I want border on every td), but it seems that I can't apply any styles to print pdf, I try to use HTML attributes and it seems, that only this is changing appearance of generated PDF.

Any chance to use CSS files to theme PDF output?

I am using Print module with additional PDF module (https://drupal.org/project/Print)

PDF library: tcpdf

EDIT

I just used old plain table attributes and it works inside PDF

  • Do you have problem with generating PDF files? If so, what module / library you use for generation? Or do you want to apply CSS to real pdf files you have on your server's HDD? – Mołot Jun 17 '13 at 14:05
  • @Mołot question edited – Codium Jun 17 '13 at 16:29
1

You need to add a "print.css" file on your theme css folder. Print PDF will take it.

yourtheme/css/print.css
1

One of the benefits mentioned on the PDF using mPDF project page is "Add custom Style Sheet to PDF". Here are some more quotes about this module (from the module's project page):

... used for Conversion of HTML pages to PDF documents using mPDF PHP Library. It allows you to generate a pdf document of any node.

Features

  • PDF creation (www.example.com/node/nid/pdf) where nid is the node id of content to render.
  • PDF generation API is provided, the content developers can use this API to generate a PDF document.
  • By creating your own CSS file and/or the node.tpl.php template files, it is possible to change the look of the output page to suit your taste.

Benefits

  • Document Properties
  • PDF Page settings
  • Watermark Image/Text
  • HTML Header & Footer
  • Password Protected PDF
  • Add custom Style Sheet to PDF
  • Enable/disable PDF generation for each Content type
  • Display/ hide any fields of Content type for PDF

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.