"Christmas - the time to fix the computers of your loved ones" « Lord Wyrm

html to pdf mit php (aber nicht eine ganze url)

Neo1010 11.01.2009 - 17:48 980 5
Posts

Neo1010

.
Registered: May 2003
Location: -
Posts: 1209
Hello!

Bräuchte einen PHP CODE mit dem ich aus einem Bestimmten Tag einer Seite (inkl. dessen Inhalt) ein PDF erzeugen könnte:

bsp:
Code: PHP
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 		
<title>HTML to PDF</title> 
</head> 
<body>
<div id="tag1"> 
tag1 text
<div id="tag2">
tag2 text
<div id="to_pdf">
nur dieser text soll ins pdf
</div>
</div>
</div>
</body>
</html>

hoffe ihr wisst was ich meine

mfg Neo1010

jives

And the science gets done
Avatar
Registered: Sep 2001
Location: Baden
Posts: 3548
Was hast du schon? PDFs in PHP funktionieren schon prinzipiell?

Wenn ja, solltest du mit http://at2.php.net/dom oder auch mit RegExp Erfolg haben.

Neo1010

.
Registered: May 2003
Location: -
Posts: 1209
mein problem ist, dass ich nicht eine ganze Seite zu einem PDF machen will sondern zB. nur alles im tag mid der id="to_pdf"

fatmike182

Agnotologe
Registered: Oct 2005
Location: VIE
Posts: 4223
könnte man nicht ein css file verwenden in dem du die anderen Inhalte mit dem display-tag im pdf unsichtbar machst?

jives

And the science gets done
Avatar
Registered: Sep 2001
Location: Baden
Posts: 3548
Zitat von Neo1010
mein problem ist, dass ich nicht eine ganze Seite zu einem PDF machen will sondern zB. nur alles im tag mid der id="to_pdf"
Hast du dir den Link angesehen, konkret http://at2.php.net/manual/en/domdoc...elementbyid.php?
Alternativ könntest du auch mit regular Expressions (vermutlich aber nicht notwendig) oder strstr() arbeiten.

Edit: Hier noch ein bisserl mehr Info
http://at2.php.net/manual/en/class.domelement.php
http://at2.php.net/manual/en/class.domnode.php

Die $nodeValue- oder $textContent-Property wird wohl das sein, was du brauchst.
Bearbeitet von jives am 11.01.2009, 18:48

semteX

Risen from the banned
Avatar
Registered: Oct 2002
Location: Pre
Posts: 14361
what jives said + random php pdf writer bibliothek (http://www.fpdf.org/ z.b.)
Kontakt | Unser Forum | Über overclockers.at | Impressum | Datenschutz