Write an Existing PDF using PHP

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

plodos
New php-forum User
New php-forum User
Posts: 1
Joined: Sun Apr 21, 2013 11:54 pm

Write an Existing PDF using PHP

Postby plodos » Mon Apr 22, 2013 12:18 am

sample.php

Code: Select all

<?php require_once('../r/fpdf16/fpdf.php');    require_once('../r/fpdi/fpdi.php');
$pdf = new FPDI(); 
$pdf->AddPage(); 
$pdf->setSourceFile('SAMPLE.pdf'); 
$tplIdx = $pdf->importPage(1); 
$pdf->useTemplate($tplIdx, 10, 10, 200); 
$pdf->SetTextColor(0,0,0);
$pdf->SetFont('Arial','B',8); 
$pdf->SetXY(35, 146); 
$pdf->Write(1, "Sample Text");
$pdf->Output();   ?>

If user enter the xxx.com/sample.php .. link shows the manipulated pdf file in the php page.

If user enter the xxx.com/SAMPLE.pdf .. link shows the original pdf file...

How can I write the PDF file during downloading ?

Should I write special code in the httpdocs file ?

For Example;
If user call .pdf extension from special directory like directory/SAMPLE.pdf
execute the special function to process pdf file.

How do I solve this problem ?

I thank you for your interest in my question.

johnj
php-forum Super User
php-forum Super User
Posts: 1805
Joined: Thu Mar 10, 2011 5:07 pm

Re: Write an Existing PDF using PHP

Postby johnj » Mon Apr 22, 2013 6:34 am

1). Good to convert all PDF file names to lower case.
2). When the user enters the file name, convert the file name to lower case and fetch the file.


Return to “PHP coding => General”

Who is online

Users browsing this forum: No registered users and 1 guest