Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No PDF content of news reader module #48

Open
Aybee opened this issue Dec 3, 2020 · 9 comments
Open

No PDF content of news reader module #48

Aybee opened this issue Dec 3, 2020 · 9 comments

Comments

@Aybee
Copy link

Aybee commented Dec 3, 2020

Contao 4.9.9

Hallo Fritz, du benutzt die URLs zu den Artikeln z.B. page/articles/article-alias.html?getpdf=42 um die PDFs zu generieren. Jetzt ist es aber so, dass wenn ein Newsreader im Artikel ausgegeben wird, dass der Reader dann natürlich keine News ausgeben kann und die PDF somit leer ist.

Ich habe mir jetzt erstmal damit geholfen, dass ich über eine Templateänderung nicht die Links mit .../articles/article-alias.html... nehme, sondern sie umforme nach z.B news/details/news-alias.html?getpdf=42. Dies funktioniert einwandfrei. Die Templateanpassung ist allerdings etwas aufwendig, da ich nach dem autoitem suchen muss, falls vorhanden, und auf anderen Seiten nach dem pagealias.

Wieso nimmst du nicht auch direkt diese normalen Links, die Erweiterung contao/tcpdf-bundle von Leo nimmt die auch, und dann würde es doch funktionieren, oder habe ich da etwas nicht bedacht?

@fritzmg
Copy link
Owner

fritzmg commented Dec 4, 2020

Wieso nimmst du nicht auch direkt diese normalen Links, die Erweiterung contao/tcpdf-bundle von Leo nimmt die auch, und dann würde es doch funktionieren, oder habe ich da etwas nicht bedacht?

🤷 I implemented this a long time ago and never used this feature myself or in any of our customer's projects. Feel free to create a PR with the correct link ;)

@fritzmg fritzmg added the bug label Dec 4, 2020
@Aybee
Copy link
Author

Aybee commented Dec 6, 2020

Ok, thank you. I will take a look at how Leo does it in his extension and will come back. Thank you.

ps I also never used this. A customer wants those share buttons and PDF link.

@Aybee
Copy link
Author

Aybee commented Dec 6, 2020

So far I repaired it with JS

// templates/j_patch-share-buttons-pdf.html5 - [email protected]
jQuery(function($) {

  var pdfLinks = $('.sharebuttons .pdf'),
      path = window.location.pathname.replace('/', '');

  pdfLinks.each(function() {
    var articleId = $(this).attr('href').split('=').pop();
    $(this).attr('href', path + '?getpdf=' + articleId);
  });

});

fritzmg added a commit that referenced this issue Feb 26, 2021
@fritzmg
Copy link
Owner

fritzmg commented Feb 26, 2021

Fixed in 3dd4402.

@fritzmg fritzmg closed this as completed Feb 26, 2021
@Aybee
Copy link
Author

Aybee commented Feb 28, 2021

Thank you Fritz 👍

Unfortunately, the PDF generation now only works if the option is checked in the article. The customer uses the sharebutton module included in the layout, to show them page wide.

We explicitly tested this with version 2.1.5. That works without checking the option in the article. With 2.1.7 it no longer works. We did not test 2.1.6.

@fritzmg
Copy link
Owner

fritzmg commented Feb 28, 2021

Yeah, this is actually deliberate. Otherwise every page could be printed with the GET parameter, even though it was not enabled. This is not intended nor desirable. I changed it so that PDF printing only works if you enabled it in the article or a share buttons content element. But I think it is feasible to expand the check to a share buttons module included in the page layout.

@fritzmg fritzmg reopened this Feb 28, 2021
@grashalm4u
Copy link

Hello Fritz,
I am the customer of Aybee...
yes, thank you very much, that would be great. Otherwise we would have to manually activate all articles in the backend.

grashalm

@Aybee
Copy link
Author

Aybee commented Jun 20, 2021

But I think it is feasible to expand the check to a share buttons module included in the page layout.

👍 Yes, that would be great as the pdf syndication doesn't exist in the latest Contao versions.

@grashalm4u
Copy link

Hello Fritz,

here is grashalm again. i am the customer of aybee. is it now possible to select the pdf button in the sharebuttons extension module to integrate the module in the layout? I don't see the pdf button there. So I can't select it to display under every page in the layout. all other 10 elements are displayed and also work.
what is special about me: i use a self-created png graphic for these 11 elements and the pdf button is the third from last. however, I'm not sure if this fact contributes to the pdf button not being displayed.

in our previous thread, aybee wrote:
"Unfortunately, the PDF generation now only works if the option is checked in the article. The customer uses the sharebutton module included in the layout, to show them page wide."

and you replied with:
"Yeah, this is actually deliberate. Otherwise every page could be printed with the GET parameter, even though it was not enabled. This is not intended nor desirable. I changed it so that PDF printing only works if you enabled it in the article or a share buttons content element. But I think it is feasible to expand the check to a share buttons module included in the page layout."

my question: could you extend the check for the sharebuttons module - integrated in the page layout?

i use the latest version of your extension and contao 4.13 (as of today).
if it works, do i still need the tcpdf or dompdf extension?

it would be great if you could help me here, because i haven't been able to use the pdf function for about 2 years now...

you can see it on my page https://die-schreibmaus.de

Many thanks and best regards, grashalm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants