Generate PDF from selector on current page with CSS

Asked

Viewed 913 times

1

I would like to know how to generate a PDF from a selector that I define and that all the formatting of this selector comes correctly in PDF?

I want to make client-server. Example: Imagine that I have a full page, so I have a specific area that has a graphic, I want to generate a PDF, but the content of the PDF will only be the graphic. You can take as an example the printElement that I printed an element. What I want would be like this:

$( '#minhaDiv' ).gerarPDF();

It also serves as a file, it doesn’t have to be exactly what I have on the current page, but as long as CSS is not omitted at the time of generation.

  • Can you explain better what you mean by gerar um PDF a partir de um seletor? And want to do client or server side?

  • I want to make client-server. Example: Imagine that I have a full page, so I have a specific area that has a graphic, I want to generate a PDF, but the content of the PDF will only be the graphic. You can take as an example the printElement that I printed an element. What I want would be like this: $( '#minhaDiv' ).gerarPDF();

  • I tested the solution of the link above and could not fix my problem. The code simply does not run.

1 answer

1

I believe you’re talking about CSS markup/properties, if you want me to recognize CSS properties, I recommend mPDF, but should use markups up to CSS 2.1 and this is a PHP library, ie should generate the PDF on the server side.

Resources:

  • Accepts UTF-8
  • CSS support
  • Relate the item
  • Supports JPEG, GIF, PNG, WMF and SVG images
  • Watermark
  • PHP Standalone Library
  • Etc....

View all resources on http://mpdf.bpm1.com/index.php?page=Features

Download: http://www.mpdf1.com/mpdf/index.php?page=Download

  • I’ll test him today.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.