Print / create a form as PDF

Print / create a form as PDF

classic12classic12 Posts: 228Questions: 60Answers: 4

I am using datatables to display data to the client.
It has a print button but this is limited as it does not print what is on the screen or images if shown.

If on click of a row I could populate another form formatted as I need.

Then use this on a print button.

Anyone done this or any ideas ?

Cheers

Steve Warby

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,669Questions: 1Answers: 10,096 Site admin

    It should print images - that's a bug if it isn't and a test case showing the issue would be great.

    You would use row().data() to get the data for the row, but how you display that in a form is more or less up to yourself.

    Allan

  • classic12classic12 Posts: 228Questions: 60Answers: 4

    www.toolfolks.com/surplusAnywhere4 ( ignore colours still playing with themes)

    Mac just prints columns & text
    Same on Andriod.
    Also on IOS 11 the print just prints a blank document

    I've had a quick look at http://pdfmake.org/playground.html but it looks like you have to repeat whats in the datatables ????

    Anyone used it before I get in deep....

    Cheers

    Steve Warby

  • allanallan Posts: 61,669Questions: 1Answers: 10,096 Site admin

    There is a refresh, copy to clipboard and CSV button on your page. I don't see a print button. Are you able to add that - I was assuming that you are using print?

    Images in the PDF output are a pita to be honest. You need to base64 encode each image. It isn't something that the pdfHtml5 button does out of the box I'm afraid.

    Allan

  • classic12classic12 Posts: 228Questions: 60Answers: 4

    I have added a print button now.

    http://127.0.0.1:56805/surplusAnywhere5/

    Cheers

    Steve Warby

  • allanallan Posts: 61,669Questions: 1Answers: 10,096 Site admin
    Answer ✓

    I think the URL was meant to be http://toolfolks.com/surplusAnywhere5/ .

    Try:

    {
      extend: 'print',
      exportOptions: {
        stripHtml: false
      }
    }
    

    Hopefully that should do it.

    Allan

  • classic12classic12 Posts: 228Questions: 60Answers: 4

    Cheers.....

This discussion has been closed.