Problems with blogpdf plugin

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Post Reply
svenf
Regular
Posts: 20
Joined: Sat Jul 29, 2006 1:56 pm
Location: Germany

Problems with blogpdf plugin

Post by svenf »

Hi all,

when using blogpdf the browser does not open a pdf reader and displays the pdf file in that reader, the browser is displaying the pdf "source code" as plain text instead, something like that:

%PDF-1.3 3 0 obj <> endobj 4 0 obj <> stream 2 J 0.57 w BT /F1 15.00 Tf ET 28.35 813.5 ...
snip
... << /Size 13 /Root 12 0 R /Info 11 0 R >> startxref 2254 %%EOF

Any idea?

Thanks
Sven
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Problems with blogpdf plugin

Post by garvinhicking »

Hi!

What's your URL? It might be caused by the webserver headers...

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
svenf
Regular
Posts: 20
Joined: Sat Jul 29, 2006 1:56 pm
Location: Germany

Post by svenf »

Do you mean the URL shown for the pdf "source code"?
that one:
http://ptagy.germany/ptanews/index.php? ... ticlepdf_8
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

Ah, so it's not a public URL?

Can you check using the LiveHTTP Headers what headers are shown when you fetch this? The most common trouble for this kind of error is when some other patches/plugins you may have made emit blank/newlines before the actual content.

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
svenf
Regular
Posts: 20
Joined: Sat Jul 29, 2006 1:56 pm
Location: Germany

Post by svenf »

That comes from LiveHTTP:

-----------------------
http://ptagy.germany/ptanews/index.php? ... pdf_200608

GET /ptanews/index.php?/plugin/monthpdf_200608 HTTP/1.1
Host: ptagy.germany
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.0.5) Gecko/20060719 Firefox/1.5.0.5
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: de-de,de;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Proxy-Connection: keep-alive
Referer: http://ptagy.germany/ptanews/index.php? ... lings.html
Cookie: serendipity[old_session]=frqggkjnmov9t4euitr8i7n9q4; PHPSESSID=80a79vk8vls2btq844ns0bkv70

HTTP/1.x 200 OK
Content-Length: 1285
Content-Type: text/html
Date: Wed, 02 Aug 2006 10:07:33 GMT
Server: Apache/2.0.54 (Unix) PHP/5.0.4
X-Powered-By: PHP/5.0.4
X-blog: Serendipity
Set-Cookie: PHPSESSID=80a79vk8vls2btq844ns0bkv70; path=/
Expires: Wed, 02 Aug 2006 11:07:34 GMT
Cache-Control: public
X-serendipity-interfacelang: de
Last-Modified: Wed, 02 Aug 2006 10:00:14 GMT
Etag: "Wed, 02 Aug 2006 10:00:14 GMT"
X-serendipity-cache: true
Via: 1.1 proxy-proxy
Proxy-agent: Sun-Java-System-Web-Proxy-Server/4.0
----------------------------------------------------------
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

Da kommt vom Webserver ein falscher Content-Type zurück. Das blogpdf Plugin setzt eigentlich einen application-Header. Warum kommt der nicht durch? Setzt ihr eine spezielle Proxy-Umgebung ein, forciert ihr spezielle header, habt ihr PHP-headerüberschreibung deaktiviert o.ä.?

Viele Grüße,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
svenf
Regular
Posts: 20
Joined: Sat Jul 29, 2006 1:56 pm
Location: Germany

Post by svenf »

Jetzt ohne Proxy (derselbe Effekt):

http://ptagy.germany/ptanews/index.php? ... ticlepdf_2

GET /ptanews/index.php?/plugin/articlepdf_2 HTTP/1.1
Host: ptagy.germany
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.0.5) Gecko/20060719 Firefox/1.5.0.5
Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Accept-Language: de-de,de;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://ptagy.germany/ptanews/index.php? ... -News.html
Cookie: serendipity[old_session]=frqggkjnmov9t4euitr8i7n9q4; PHPSESSID=80a79vk8vls2btq844ns0bkv70

HTTP/1.x 200 OK
Date: Wed, 02 Aug 2006 10:50:14 GMT
Server: Apache/2.0.54 (Unix) PHP/5.0.5
X-Powered-By: PHP/5.0.5
X-blog: Serendipity
Set-Cookie: PHPSESSID=80a79vk8vls2btq844ns0bkv70; path=/
Expires: Wed, 02 Aug 2006 11:50:16 GMT
Cache-Control: public
X-serendipity-interfacelang: de
Last-Modified: Wed, 02 Aug 2006 10:50:16 GMT
Etag: "Wed, 02 Aug 2006 10:50:16 GMT"
X-serendipity-cache: false
Content-Length: 2472
Keep-Alive: timeout=15, max=99
Connection: Keep-Alive
Content-Type: text/html; charset=UTF-8
----------------------------------------------------------
Was ist PHP-Headerüberschreibung?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

Nun, eigentlich sorgt das Plugin mit dieser Zeile für einen anderen Header:

fpdf.php, Zeile 1015 - 1040 ist dafür da, unterschiedliche Content-Type Header zu schicken. Diese werden bei Dir aber nicht ausgegeben, und die Frage ist warum.

Hast Du an der Installation Dateien manuell editiert? Wie erwähnt können Zeilenumbrüche vor dem ersten <? oder nach dem letzten ?> einen solchen Effekt hervorrufen. Evtl. hast Du z.B. falsch Banner in der index.php ausgegeben, die jetzt auch in externen Plugins wiedergegeben werden...

Viele Grüße,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
svenf
Regular
Posts: 20
Joined: Sat Jul 29, 2006 1:56 pm
Location: Germany

Post by svenf »

Also, ich habs aufgegeben. Ich kann den Fehler nicht finden. PDFs werden unter archives erzeugt, kann ich mir auch mit dem Browser angucken, wenn ich ihn direkt darauf lenke. Sehen aber leider recht erbärmlich aus (sorry).
Mich interessiert eh nur die PDF-Konvertierung eines einzelnen Artikels, den leite ich jetzt auf einen PDF-Printer, das geht ganz prima.
Vielleicht liegt die etwas disappointing Qualität daran, dass der Server unter Solaris läuft und ich ein paar Tools oder Libraries nicht installiert habe.

Thans für Eure Mühe!
Sven
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

Nun, leider gibt es nach wie vor keine Möglichkeit, HTML Formatierung in PDF zu übernehmen. HTML und PDF Anweisungen sind halt untereinander absolut nicht kompatibel. Auch Bilder zu übernehmen etc. ist derzeit fast unmöglich; man könnte höchstens alle Bilder ausfiltern und sie nacheinander vor oder nach den Eintrag packen. Aber ihn mit floating u.ä. so einzubauen wie es original aussieht ist mit einer PHP-Bibliothek einfach nicht gegeben - denn PHP weiß ja vom Rendering von HTML nichts. Anders da ein PDF-Treiber der vom Browser aus angesprochen wird; der kann Pixel-positionierungen einfach durchreichen, weil er ja das HTML schon gerendert hat.

Viele Grüße,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Jeffrey35
Regular
Posts: 44
Joined: Thu Oct 26, 2006 7:38 am

Post by Jeffrey35 »

I just totally agree with that ;-)

Greetz,
Jef
Post Reply