thanks for your awesome video, i clone the source code form the current page, i want to apply the bootstrap to the pdf-page but failure, could you give some tips? Thanks a lot!
If you've set up the application with the `vendor/assests/stylesheets/pdf.css` and have this set to complile separately, you can download the CSS from https://getbootstrap.com/docs/3.3/customize/?id=08c164bd0450fe50e9bf and paste it into the `pdf.css`. This is what I'm using. You can probably also do the same for bootstrap 4.1, but the important bits would be the things selected where it is mainly the media styles, grid, typography, etc.
I download the bootstrap code from https://getbootstrap.com/docs/4.0/getting-started/contents/#css-files, i paste the bootstrap.css or bootstrap-grid.css to pdf.css , but i can't applay the "d-flex" function, can your find something wrong?
Personally, I would try to keep the styling in the email simple. Supporting rendering on different email clients is very difficult since there are definitely more email clients than browsers. Check out https://www.campaignmonitor.com/css for individual styling compatibility for mail clients.
I am writing a pdf report and want to have page break for every 2 items (with photos) in a loop. The normal [page break] works on html does not work in pdf file.
Can you help ?
David
In the HTML, you would wrap the two items in a div tag with a class like `new-page`.
In the PDF's CSS, define the class like
```
.new-page {
page-break-before: always;
}
```
Notice that the footer is being passed as a second parameter to the WickedPdf.new.pdf_from_string. In your example, it is getting passed into the first parameter and not the additional options.
☒ what issues with wicked_pdf are you having? Webpacker doesn't really have a part in it as far as I know. Are you trying to serve image assets or something via Webpacker instead of the asset pipeline in the PDFs?
def show
respond_to do |format|
format.html
format.pdf do
render(template: 'contracts/contract', pdf: @contract.name, disposition: 'inline')
end
end
end
app/views/contracts/contract.pdf.erb
hello!
However, assets are only loaded with helpers wicked_pdf_stylesheet_link_tag and wicked_pdf_javascript_include_tag
The wicked_pdf_asset_pack_path method for imagesm also does not work correctly, resulting in a blank file when added.
//app/contollers/ sales_controller.rb
// # app/view/shared/footer.html
PRD Footer
....
What is wrong ?
Notice that the footer is being passed as a second parameter to the WickedPdf.new.pdf_from_string. In your example, it is getting passed into the first parameter and not the additional options.
1. image
Same cod and same image, it works on the report, but image does not show on header. The code is like this
<header>
2. The variable
The same variable @sale is accessible in the report, but not accessible in footer.
I tried HTML format, No Luck. The code
header: { html: { template: 'users/header'....
Any ideas?
Thanks a lot.
app/views/layouts/pdf.html.erb
app/javascript/stylesheets/pdf.scss
app/javascript/packs/pdf.js
app/controllers/contracts_controller.rb
app/views/contracts/contract.pdf.erb
However, assets are only loaded with helpers wicked_pdf_stylesheet_link_tag and wicked_pdf_javascript_include_tag
The wicked_pdf_asset_pack_path method for imagesm also does not work correctly, resulting in a blank file when added.