php-windows Digest 9 Sep 2003 14:38:28 -0000 Issue 1903
Topics (messages 21329 through 21332):
Re: PDF and FDF
21329 by: Cesar Cordovez
Need to call VB from PHP script. Is this hard to do?
21330 by: karen97214.yahoo.com
21331 by: Sek-Mun Wong
Problem writing to a file
21332 by: George Pitcher
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[EMAIL PROTECTED]
----------------------------------------------------------------------
--- Begin Message ---
Hi List,
Answering my own question... I found this user comment at
php.net/pdf_open_file. As you can see is dated feb 2002 (kind of old)
Is this still true? Does anyone knows [EMAIL PROTECTED]
Help! =)
Thanks.
Cesar
gbl at bso2001 dot com
19-Feb-2002 08:30
Appending to PDF files: plainly, you can't. PDF files have an internal
structure that would get corrupted by just appending to the file. You'd
need to parse the PDF, create a new PDF and mix your additions with the
old PDF. Just creating a new one should be *much* easier.
Reading back the results: do a fopen() on the temporary file and use
fgets() to read it. In your example where you just want to output the
file, passthru should do the trick.
Cesar Cordovez wrote:
Hi List!
I'm using the following code to open a pdf form, place a picture and
then save it. This is very new for me, and the code is giving me some
errors like (Fatal error: PDFlib error: Empty document in
c:\Inetpub\wwwroot\pdf_forms\dbtree.php on line 415
). Can somebody help? (line 415 is empty, line 414 is "pdf_close")
TIA.
Cesar
// Begin ------------------
$pdf = pdf_new();
pdf_open_file($pdf);
$pdi = pdf_open_pdi($pdf, $formfile, NULL, 0);
$page= pdf_open_pdi_page($pdf, $pdi, 1, "");
// write the commands to place the image here.
pdf_close_pdi_page($pdf, $page);
// pdf_end_page($pdf);
pdf_close($pdf);
// end ------------------
$formfile is "c:/Inetpub/wwwroot/pdfforms/aform.pdf"
--- End Message ---
--- Begin Message ---
Have visual basic script to open text file and
validate contents. I would like to call this vb from
PHP page after a .txt if uploaded but before it makes
it too far into the process.
Can a use a stored procedure (SQL Server) to call the
vb script? Or is there a slicker way.
Thanks,
Karen
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com
--- End Message ---
--- Begin Message ---
you can use the ill-named "fopen".
eg,
$fp = fopen (http://www.example.com/vbscript.asp?a=1&b=2, "r");
you then have to parse the output of the asp to determine the result of the
script execution.
ie,
$contents = fread ($fd, filesize ($filename));
fclose ($fd);
then preg_match $contents for success or failure code.
It's not elegant, but I've used this brute force approach and it works.
<[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Have visual basic script to open text file and
> validate contents. I would like to call this vb from
> PHP page after a .txt if uploaded but before it makes
> it too far into the process.
>
> Can a use a stored procedure (SQL Server) to call the
> vb script? Or is there a slicker way.
>
> Thanks,
> Karen
>
> __________________________________
> Do you Yahoo!?
> Yahoo! SiteBuilder - Free, easy-to-use web site design software
> http://sitebuilder.yahoo.com
--- End Message ---
--- Begin Message ---
Hi all,
I'm having a problem writing to a text file.
This is the error message:
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
Warning: fwrite():
supplied argument is not a valid stream resource in
C:\Inetpub\wwwroot\packtracker\lse\pub_req_start2.php on line 276
Cannot write to file
(C:\inetpub\wwwroot\packtracker\LSE\IR201_1770.txt)
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
This is the code:
-----------------------------------------------------------------
$fp2 = "C:\\inetpub\\wwwroot\packtracker\\LSE\\".$cr.".txt";
$fp3 = "C:\\inetpub\\wwwroot\packtracker\\LSE\\".$cr.".doc";
$fn1 = file_get_contents("pub_letter.txt");
// replace some of the content placeholders with variables <<<
$content = $fn1;
if (!$fp = fopen($fp2, 'w')) {
print "Cannot open the bloody file ($fp2)";
exit;
}
// chmod($fp2,222); tried this - no effect
if (!fwrite($fp2, $content)) {
print "Cannot write to file ($fp2)";
exit;
}
rename($fp2,$fp3);
fclose($fp3);
fclose($fp2);
if($contact_route == 'Email' | $contact_route == 'email') {
----------------------------------------------------------------
So as you can see, I load a text file (actually its RTF saved as text),
parse it then write it to an open txt file, then rename that as a Word doc.
I'm running this on NT with PHP 4.3.2. The folder has write access for the
web user.
Any suggestions?
Cheers
George
===
George Pitcher
HERON Technical Manager
Ingenta plc
23-38 Hythe Bridge Street, Oxford, OX1 2ET
T +44 (0)1865 799051 direct
T +44 (0)1865 799000 switchboard
F +44 (0)1865 799134
E [EMAIL PROTECTED]
www.ingenta.com
Ingenta: Empowering the exchange of academic and professional content
online.
--- End Message ---