Extension talk:PdfBook

About this board

And once more, with frustration...

2
Slgrandson (talkcontribs)

To developers @Nad: /@Igorabsorto:

On Miraheze, PdfBook is currently on the chopping block as the MW 1.38 era closes in (linked statement by Universal Omega (talk · contribs)). Not much to add here, except my experimentation last month spat out a local error message that went:

Cannot display PDF (Title.pdf is of invalid format)

...and forced me to remove the extension from my wiki's lineup. (Details at Meta's Community noticeboard.)

A real shame, as something like it would sure come in handy for my future books. Let's hope it actually gets fixed soon enough....

P.S. To @Bawolff: Any further assistance you might provide?

(MW 1.37.2/PHP 7.4.28) --Slgrandson (talk) 11:53, 5 June 2022 (UTC)

Bawolff (talkcontribs)

Those are some scary looking regexes...


Nothing looks particularly incompatible at a glance, except probably $wgParser should be replaced with the equivalent MediaWiki\MediaWikiServices::getInstance()->getParser().


I dont really care about this extension so i probably wouldn't fix it myself, but if you want help fixing it i would be willing to offer advice.

Reply to "And once more, with frustration..."

Generates empty pdf document

1
Pspviwki (talkcontribs)

When using the extension it generates an empty pdf file, message in error log: PHP Deprecated: Use of $wgParser was deprecated in MediaWiki 1.32. [Called from MediaWiki::performAction in ...mediawiki/includes/MediaWiki.php at line 543] in ..mediawiki/includes/debug/MWDebug.php on line 375. Used for single page generation, format=single.

Installation: MediaWiki 1.37.1, PHP 7.4.27, MariaDB 10.6.5-MariaDB, ICU 70.1, PdfBook 2.0.5,2021-07-19.

Reply to "Generates empty pdf document"
Squeak24 (talkcontribs)

Hi

I am having a bit of an issue with PdfBook not exporting to PDF.

I have an issue where I am getting an error

Error 
Failed to load PDF document.

I have done what DGessei suggests on FreeBSD installation - fails to generate pdf but does generate HTML substituting the path to HtmlDoc with what I have, but still get the same error.

I am running: RHELV7 MediaWiki 1.35.3 PHP 7.4.22 (apache2handler) MariaDB 10.5.11-MariaDB


I have set my path to HTMLDoc to /var/lib/snapd/snap/htmldoc/current

I am running it on a server with TLS, I did see HtmlDoc only works with http:// rather than https:// so not sure if that is a thing or if that's something which isn't anything to be worried about.


Any help is appreciated.

Igorabsorto (talkcontribs)

Hi @Squeak24 I don't think it is an issue with TLS.

As your issue seems similar to the one DGessei described, can you confirm that:

  1. Exporting as HTML works action=pdfbook&format=html
  2. Invoking HTMLDoc from command line works

thanks!

Squeak24 (talkcontribs)
Igorabsorto (talkcontribs)

@Squeak24 Nice, it seems that HTMLDoc is working fine them.


Please check your wiki log searching for 'PdfBook' and also look the httpd-error.log. In DGessei there was some useful error in the httpd log.

We have to keep digging, I'm not aware of what could be possibly happening, I'm hopeful the logs will help us.

Squeak24 (talkcontribs)

Just checked the httpd-error log, and I think I know what's not working, just how to make it work.

The error I got is:

[Thu Aug 12 12:29:20.767533 2021] [core:notice] [pid ****:tid ******] AH00052: child pid **** exit signal Segmentation fault (11)

sh: /var/www/html/****/images/pdf-book-cache-f9615d5465514db4928d99bae7e5c29e: Permission denied

sh: /var/www/html/****/images/pdf-book-cache-f9615d5465514db4928d99bae7e5c29e: Permission denied

So I created the folder pdf-book-cache-f9615d5465514db4928d99bae7e5c29 in the images directory and chmod to 755.

But when I try and run the PdfBook for the help category I still don't get a PDF output. The HTML is still blank.

The error this time is:

sh: /var/www/html/wind/images/pdf-book-cache-3111d94f42c206868284391c0693d1ce: Permission denied

I can upload images OK. The permissions are set to 755 and the owner is root. I guess the owner should be www-data or httpd

Any help is appreciated.

Igorabsorto (talkcontribs)

@Squeak24 Great, we have some directions now :)

The owner of the images directory should be httpd (for Apache) or www-data (nginx).

Just run chown recursively on the directory and you should be good to go.

Squeak24 (talkcontribs)

Apologies for the delay. I have been a little run of my feet recently.


I have tried to do what has suggested. I am just experimenting on a Ubuntu machine as well.


But I am still having the same issues. The Wiki I am working on is part of a farm using symbolic links, this will be the way we will be doing things in the future. After further experimentation I can't even upload images.


I get the error:

Uploading not possible "Could not open lock file for "mwstore://local-backend/local-public/"


I have tried to change the image directory and upload path in the Local LocalSettings.php, but still nothing.

When I include the full path:

/var/www/html/field1/images

The image uploads, but doesn't display. The URL looks something like:

http://field1.tld/index.php/Image/path to image/image.png

But if I take out the index.php and change the Image to image the file shows.

I did get the images working on a farm, but for some reason it's not working now.

Any help is appreciated.

Squeak24 (talkcontribs)

So, I got it working on my Ubuntu device by using the code:


$wgUploadDirectory = "/var/www/html/field1/images";

$wgUploadPath = "/images";


But it's still not working on Red Hat! This is annoying.

Reply to "Failed to load PDF document."

Make PdfBook: The generated PDF is too large for a complete display.

1
94.31.87.198 (talkcontribs)

A 4 byte PDF is generated. This PDF cannot be complete viewed/opened.

Reply to "Make PdfBook: The generated PDF is too large for a complete display."

FreeBSD installation - fails to generate pdf but does generate HTML

2
DGessel (talkcontribs)

The following procedure yielded a registered installation but it does not seem to generate any pdf output:

portmaster -Rd textproc/htmldoc

cd /usr/local/www/mediawiki/extensions

git clone https://gitlab.com/organicdesign/PdfBook.git

cd ..

ee LocalSettings.php

add

wfLoadExtension( 'PdfBook' );

and any settings following

apachectl graceful

and check https://XXX.XXX.XXX.XXX/mediawiki/index.php/Special:Version


Adding the action tab option successful directs to https://XXX.XXX.XXX.XXX/mediawiki/index.php?title=Upgrading_FreeBSD&action=pdfbook&format=single but yields a

ERROR Failed to load PDF document.


the pdf-book-cache- files are empty.  

The log file shows:

2021-06-05T03:06:43 Gessel talk contribs block ⧼pdflogentry⧽ (User:Gessel exported as a PDF book)


https://XXX.XXX.XXX.XXXmediawiki/index.php?title=Main_Page&action=pdfbook&format=single


also fails, however export as HTML works.


http://www.foo.bar/wiki/index.php?title=Main_Page&action=pdfbook&format=html and generates a valid cache file and presents it to the browser (looks lovely).


The command line

htmldoc --webpage -f postscript-output.pdf test-doc.html

works as expected, so there's something about the command structure calling htmldoc that isn't parsing correctly.

DGessel (talkcontribs)
Reply to "FreeBSD installation - fails to generate pdf but does generate HTML"

Can PdfBook handle Semantic Mediawiki Inline Queries?

2
AID-PMBD (talkcontribs)

Hello,


I'm using PdfBook on a Mediawiki 1.31 Installation and want to export Sites that are using inline queries (#ask) to display content. When exporting those sites as PDF, the query content doesn't show up. Can the extensions handle this? If yes, does someone have an idea as to where I went wrong?

AID-PMBD (talkcontribs)

I managed to reach the creator of PDFBook. The extension can handle Semantic Queries in general, however it doesn't seem to be able to handle if the Output of the Query is a table. I decided to use Mpdf or the "Print Version" instead.

Reply to "Can PdfBook handle Semantic Mediawiki Inline Queries?"

Category print and internal links

1
Frank V Damme (talkcontribs)

I generate a book per category which works well. Was wondering though if it were possible to include the page titles. ATM, a category with pages containing 3, 4 and 6 headers respectively will result in a pdf containing 13 chapters.


I was also wondering if there was a way to keep internal links? If a page links to another one in the same category, it will also appear in the same PDF but the link to it leads to the original site (full url).

Reply to "Category print and internal links"

Are there any configuration for Page Header and Footer n HTML Format

1
147.1.18.25 (talkcontribs)

Are  there any configuration for Page Header and Footer n HTML Format?


Kindly help me.

Reply to "Are there any configuration for Page Header and Footer n HTML Format"
147.1.18.25 (talkcontribs)

PDF Format is good. However html Table border is missing in PDF, Could anyone help me on this issue?

Reply to "PDF Format issue"
Maiden taiwan (talkcontribs)

This extension is broken under MediaWiki 1.34:

  • It uses DB_SLAVE instead of DB_REPLICA
  • After fixing this error, I still get an error :

[b2c769246b4f1dc886c4c019] /w/index.php?title=Category:Office_supplies&action=pdfbook Error from line 67 of /var/www/mediawiki/w/extensions/PdfBook/PdfBookAction.php: Cannot access protected property Wikimedia\Rdbms\ResultWrapper::$result

Backtrace:

#0 /var/www/mediawiki/w/includes/MediaWiki.php(511): PdfBookAction->show()

#1 /var/www/mediawiki/w/includes/MediaWiki.php(302): MediaWiki->performAction(CategoryPage, Title)

#2 /var/www/mediawiki/w/includes/MediaWiki.php(900): MediaWiki->performRequest()

#3 /var/www/mediawiki/w/includes/MediaWiki.php(527): MediaWiki->main()

#4 /var/www/mediawiki/w/index.php(44): MediaWiki->run()

#5 {main}

Igorabsorto (talkcontribs)

Hi @Maiden taiwan, sorry for taking this long to get back at you. We are working on making this extension compatible with version 1.34. We will make an announcement here once that is finished.

Pppery (talkcontribs)
Igorabsorto (talkcontribs)

Hi @Pppery, we have updated the code in an attempt to make it compatible with version 1.34, but we haven't been able yet to thoroughly test it. The simple tests I made with a fresh 1.34 install worked fine, but we still need to test in more complex scenarios. If you are willing, install/update the extension with the last commits and give it a try and please report if you spot any bugs.

Reply to "Breaks in MW 1.34"
There are no older topics