Hi All,

I dont know if this really fixes the issue or messes soomething else up but this seems to work for me to prevent duplicate pages.
Im using Charts & Graphs demo view with google charts (which works perfectly).

My next issue is i get two copies of the underlying data in tables with one column named 'x' and i cant remove it for any not obvious reason.
/* line 63 in js/pdf_export.js
getHtml: function ($button) {
var $content = $($button.attr('data-content-selector'));

if ($content.length === 0) {
return;
}

var $clone = $content.clone();
var html = '';
$clone.each(function (index, value) {
$('.generating-pdf', value).remove();
html += this.elementToHtml($(value));
return false; /* ******************* ADDED BY ME ******************** */
}.bind(this));

return html;
},

Comments

arne_hortell created an issue.

arne_hortell’s picture

I found that the "extra" table which i cant remove is actually a part of the google chart&graph which keeps a tabular representation of the data in the piechart.
This is printed in the pdf.

arne_hortell’s picture

Problem occurs as google charts
<div aria-label="A tabular representation of the data in the chart." style="position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden;">
<table> WITH LOTS OF DATA I WISH I COULD HIDE </table>
</div>
arne_hortell’s picture

For anyone out there, here is maybe a solution possible...

In your view add class pdf-export for items you want in your pdf document.
For those who you dont want to export the aria table also add a second class

Then add this at line 64

getHtml: function ($button) {
var $content = $($button.attr('data-content-selector'));

if ($content.length === 0) {
return;
}

var $clone = $content.clone();
var html = '';
$clone.each(function (index, value) {
$('.not-aria-table', value).find("table").remove(); // <- this is the remove tag
html += this.elementToHtml($(value));

arne_hortell’s picture

Do like this instead

Alter at row 64 above

$('.not-aria-table', value).find("table").remove();
$('.not-for-pdf', value).remove();

Now, add class pdf-export for everything you want to export with pdf
secondly add class

not-aria-table

for everything which have a ariatable you DO NOT WANT INTO THE PDF
and finally
add
not-for-pdf

Which is perfect for links etc you DO NOT WANT IN THE PDF.
Problem solved.

arne_hortell’s picture

File mentioned above is the

pdf_export/js/pdf_export.js

Happy coding!

I might make a patch for this.
Meanwhile its a twoliner...

nbouhid’s picture

It's not really clean, but you can always include your own JS file and override the getHtml method with your own implementation.