WordPress.org

Ready to get started?Download WordPress

Forums

NextGEN Gallery
[resolved] Activating plugin breaks WP post to PDF Enhanced (16 posts)

  1. Lewis Rosenthal
    Member
    Posted 5 months ago #

    I am the maintainer of WP Post to PDF Enhanced. I received a report of blank pdfs (0-length files) from a user of my plugin. Further investigation points to NextGen as being incompatible. I'm hoping we can address that, and I am willing to provide whatever resources I can to assist.

    I have confirmed my reporter's issue, and have outlined my findings, below:

    - WordPress up to date?
    Yes
    - NextGEN up to date?
    Yes (2.0.57.1; tried 2.0.57 and 2.0.40, as well)
    - From what version of NextGEN Gallery did you upgrade?
    None. Clean install on test site.

    (please confirm the following, with your server host tech) :
    - MySQL up to date (at least 5.2.4)?
    No. 5.0.86.
    - PHP up to date (at least 5.0)?
    Yes. 5.3.28.
    - The mod_rewrite Apache module activated?
    Yes.
    - PHP Safe Mode OFF?
    Yes.

    Additional information that will help us find a solution:
    - Who are you hosted with?
    Self.
    - What theme are you running?
    Twenty-twelve.
    - Which plugins do you have installed and activated?
    Tested with only WP Post to PDF Enhanced and NextGen.
    - Does this error still occur if you switch your theme to the WP default, and deactivate all plugins except NextGEN Gallery?
    See above. NextGen appears to work properly. Generating the pdf yields a 0-length file.

    Note that we are not getting a file with header and footer information and blank content, but rather, nothing is even getting handed off to TCPDF for rendering, thus leaving us with a blank file.

    Thanks in advance for any help you be able to provide, and pleas elet me know if you need any code from me (though you can probably pull whatever you might want to review from svn).

    Cheers

    Lewis

    https://wordpress.org/plugins/nextgen-gallery/

  2. ebloss
    Member
    Posted 3 months ago #

    I, too, am having this conflict, which is a real show-stopper as my client uses Nextgen extensively. It's strange because the PDF file is being generated OK, I can see it in the cache, but then it doesn't download properly. Any ideas on a workaround?

  3. ebloss
    Member
    Posted 3 months ago #

    I, too, am having this conflict, which is a real show-stopper as my client uses Nextgen extensively. It's strange because the PDF file is being generated OK, I can see it in the cache, but then it doesn't download properly. Any ideas on a workaround?

  4. jrd6dk
    Member
    Posted 3 months ago #

    I think i see something related. When using sellmedia alone i can sell and download the files. when aktivating nextgen the download fails, with a 404. Maybe something with the headers?

  5. photocrati
    Member
    Plugin Author

    Posted 3 months ago #

    @Lewis Rosenthal & @ebloss - We still need to look into this issue as it apparently has not been resolved, yet.

    @Lewis Rosenthal - If you have any additional thoughts on this problem from when you originally posted this topic please feel free to respond to your original Bug Report and I will get those details to our developers.

    @jrd6dk - As you are referring to a different plugin, I would recommend you start your own topic to address the issue(s) you are seeing.

    Thanks!

    - Cais.

  6. jrd6dk
    Member
    Posted 3 months ago #

    ok

  7. photocrati
    Member
    Plugin Author

    Posted 3 months ago #

    @jrd6dk - Thanks. These issues may be related but each might need a slightly different approach to address correctly.

    - Cais

  8. Lewis Rosenthal
    Member
    Posted 2 months ago #

    Hi, Cais...

    Apparently, the issue is stemming from something in the output buffering as handled through class.photocrati_resource_manager.php. WP Post to PDF Enhanced is actually generating the PDF (if caching is turned on in my plugin, a valid PDF is placed in the cache directory on the server). However, when the url is fetched, what is served is a text file of 0 bytes.

    The relevant code to bypass the problem (and unfortunately, breaking NGG) is:

    function __construct()
    	{
    		// Validate the request
    		$this->validate_request();
    		add_action('init', array(&$this, 'start_buffer'), -1);
            add_action('wp_footer', array(&$this, 'print_marker'), -1);
    	}

    Commenting both add_action() lines (and I suspect only the first is the culprit) will allow for a proper download of the PDF.

    I haven't looked beyond that, but ebloss' mention above of seeing the PDF in cache got me looking (I normally have caching disabled for development purposes, as I am always concerned about generating a fresh PDF each time, but in this case, it was a real clue as to where the breakage was occurring - kudos to ebloss!).

    Is that of any help, Cais?

    Cheers

    Lewis

  9. photocrati
    Member
    Plugin Author

    Posted 2 months ago #

    Commenting out the 'start_buffer' line will break things ... but have you tried something along the lines of the following in your theme's functions.php file:

    add_filter( 'run_ngg_resource_manager', '__return_false' ) );

    It can have unexpected results but it may also help to sort out the issue you are seeing as well.

    - Cais.

  10. Lewis Rosenthal
    Member
    Posted 1 month ago #

    Thanks, Cais.

    That does indeed seem to work around the issue, however, I haven't tried generating a pdf from a page with any NextGen-provided content on it. I'll ask my original bug reporter to give the add_filter() a try, and will report his findings.

    Let's leave this open for just a little while longer until I get some more feedback, if you don't mind.

    Thanks again!

    Lewis

  11. photocrati
    Member
    Plugin Author

    Posted 1 month ago #

    @Lewis Rosenthal - Sure thing ... let us know if we can do anything more to help get these more compatible.

    IF the issue persists, please send us a Bug Report (http://www.nextgen-gallery.com/report-bug/ ... please reference this topic) directly so we can look into this more thoroughly.

    - Cais.

  12. Graeme Bruce
    Member
    Posted 1 month ago #

    Hi Lewis, The add on [see below] to the Themes functions.php has solved the problem, the news page is still on http://www.danbba.co.uk for you to try. I hope this solves the problem for the other people. Many thanks for all your help.
    Graeme

    add_filter( 'run_ngg_resource_manager', '__return_false' );

  13. Lewis Rosenthal
    Member
    Posted 1 month ago #

    @Cais - I thought I did open an issue for this. You responded to me back in March. Search for "[NextGEN Gallery/Unverified] Incompatibility with WP Post to PDF Enhanced" for our discussion at the time.

    While this workaround will suffice for situations where there is no content on the page provided by NGG, I have a hunch that on gallery pages, for example, we'll get blank space in the pdf. I'll need to test further to be certain.

    BTW, when you mentioned that it could have unexpected results, can you give me an idea of what we might expect on pages which contain no gallery content?

    BTW #2, you have an extra ")" in your add_filter() statement. ;-) Don't you hate when that happens?

    @Graeme - It's rally Cais who deserves the credit! I should have thought about using add_filter(), but it never occurred to me. LOL! If it suits your needs (i.e., the only place you want to generate pdfs is on non-gallery pages), then this should be an adequate workaround. As mentioned in my previous paragraph, I'd like to see if we can generate a pdf containing a gallery page with all of the image thumbnails presented as they are in the browser.

    Cheers. I'll add a mention in the FAQ for my plugin.

  14. photocrati
    Member
    Plugin Author

    Posted 1 month ago #

    @Lewis Rosenthal - I'll have to look through the old reports to find that issue (I though this sounded more familiar than what it read).

    To be honest, it was one of the developers that reminded me of this filter (for another issue) and he suggested it might have unexpected results. Essentially the resource manager plays a big part in our "compatibility" code so in most cases if there are unwanted results afterward it would be due to a conflict elsewhere.

    ... and, you are correct, my bad for not catching that extra ) in the code. I make every effort to always write the code as cleanly as possible (to WordPress Coding Standards) so that snippet would definitely have had unexpected results (*grin*)

    Lewis, feel free to re-contact us via the Bug Report conversation ... if there are still outstanding issues I'd like to get one of our developers having a closer look at this if the "filter" approach is not a full enough work-around.

    Thanks!

    - Cais.

  15. Lewis Rosenthal
    Member
    Posted 1 month ago #

    Hey, Cais...

    Thanks (again) for the great follow-up. After some additional testing with Graeme, it would appear that this is a viable workaround, even for gallery pages (my plugin still has difficulty with image alignment which results in tables of thumbnails rendering vertically, but that's a known issue).

    I'm going to mark this thread as resolved, and will start a new one should this arise again.

    Many thanks!

    Lewis

  16. photocrati
    Member
    Plugin Author

    Posted 1 month ago #

    @Lewis Rosenthal - Thanks for your follow-ups as well. Definitely start a new topic or send a Bug Report (which ever is more convenient) if you have any further issues.

    - Cais.

    PS: BTW, Bug Reports always take a higher priority although I do my best to address every topic on the forums as well. C.

Reply

You must log in to post.

About this Plugin

About this Topic