Author Topic: Add a stamper on download pdf  (Read 5058 times)

Leflou

  • Beginner
  • *
  • Posts: 4
Add a stamper on download pdf
« on: May 19, 2009, 12:48:17 pm »
Hi, i don't know if it's the right section for that but i found it was the most appropriate for my question

I want to add the mail of clients purchasing pdf with VirtueMart on the pdf. I look for a lot of things about that and juste find a php script. I'd like to modify it for fitting with VirtueMart download feature.

Is someone is able to tell me if this script can work for the feature i want to add and if it's possible to modify it ? Thanks in advance

Quote
<?php
// Make sure that the Joomla stuff will not give you a warning saying Restricted access
define( '_VALID_MOS', 1 );

// Include Joomla core stuff
include_once( 'globals.php' );
require_once( 'configuration.php' );
require_once( 'includes/joomla.php' );

if (!$my->id) {
   // In case the user is not loged in redirect him to the index page
   $redirectURL = sprintf("%s/index.php", $mosConfig_live_site);
   mosRedirect($redirectURL);
   exit;
} else {
     // Incase the user is loged in get name and email address
   $email = $my->email;
    $name = $my->name;
 
    // The PDF is only included when it needs to be
    require_once('includes/PDF_Wrapper.php');
   // Create new object from CLASS
    $SetaPDF =& new PDF_Wrapper();
    $SetaPDF->setFile('test.pdf');
    $SetaPDF->setOwnerPassword('owner');
   // Create test string
    $stamp = sprintf("My username is %s, and my email address is %s.", $name, $email);
   // Send string to PDF object
    $SetaPDF->setStampText($stamp);
    $res = $SetaPDF->StampAndEncrypt('test.pdf', 'D' /* D=Download, F=Filesysten, I=Inline */);
}
?>

Leflou

  • Beginner
  • *
  • Posts: 4
Re: Add a stamper on download pdf
« Reply #1 on: May 25, 2009, 16:08:05 pm »
Hi there,

I manage to do my pdf stamp in a local way with fpdf and fpdi. Here's the code for those who are interested with. I'm not a "real" php developper so, perhaps my code is not really "clean".

Quote
<?php
require('fpdf.php');
require('fpdi.php');

//Ouverture du pdf existant
$pdf=new fpdi();
$emel = "xxx@xxx.xx";

//Compte le nombre de page du document existant
$pagecount=$pdf->setSourceFile("yourpdf.pdf");
//Boucle pour afficher chaque page du document
for($nbp=1;$nbp<=$pagecount;$nbp++)
{
$pdf->AliasNbPages();
$pdf->AddPage();
$tplidx = $pdf->ImportPage($nbp);
$pdf->useTemplate($tplidx,5,5,200,250);
$pdf->SetFont('Times','',12);
$pdf->Cell(20,10,'Titre',1,1,'C');
$pdf->SetFont('Arial','I',20);
$pdf->Cell(0,10,'Acheté par '.$emel,0,0,'C');
}

$pdf->Output();
?>

I'm trying now to find a specific php file in VirtueMart. The one who say that the payement is ok and send a download code. I want to try to include my php code at this moment. Can someone know the name of the php file i'm looking for ? Thanks for your help

imtechnology

  • Beginner
  • *
  • Posts: 1
Re: Add a stamper on download pdf
« Reply #2 on: July 08, 2009, 03:20:49 am »
Hi!

Did you ever work this out?

I am trying to do the exact same thing!

Pyno

  • Jr. Member
  • **
  • Posts: 52
Re: Add a stamper on download pdf
« Reply #3 on: February 24, 2011, 02:03:01 am »
I am also interested to a watermark system for downloadable pdf to sell, did anybody worked this out?