Page 1 of 2 12 LastLast
Results 1 to 10 of 18

Hybrid View

  1. #1
    Join Date
    Apr 2011
    Location
    UK
    Posts
    33
    Plugin Contributions
    0

    Default Automatically Stamping Customer Name on PDF eBooks?

    I'm using v1.3.9h

    I recently bought an eBook in PDF format from pactpub.com and I was able to download it to my PC straight away. When I did, details of my name and where I had bought the book from had been written into the footer of each page.

    I intend selling PDF eBooks in a new store, and would like to use the same method to protect customers copying and distributing the products they've purchased.

    Presumably, the code would take the purchaser's input (name) and "simply" write it to the footer of the file being downloaded. I would have an idea of the code if it was a text file, but unsure with it being a PDF file.

    Does anyone know if this is possible with Zen Cart?
    Is anyone doing this?
    Is there a module (free or paid) that can do this?

    Can anyone help please?

  2. #2
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,755
    Plugin Contributions
    9

    Default Re: Automatically Stamping Customer Name on PDF eBooks?

    I recently bought an eBook in PDF format from pactpub.com and I was able to download it to my PC straight away. When I did, details of my name and where I had bought the book from had been written into the footer of each page.
    Send me the file!!!
    I intend selling PDF eBooks in a new store, and would like to use the same method to protect customers copying and distributing the products they've purchased.
    I really do not see where this prevents it from being shared as long as I do not care if your name is on it

  3. #3
    Join Date
    Feb 2008
    Posts
    1,336
    Plugin Contributions
    1

    Default Re: Automatically Stamping Customer Name on PDF eBooks?

    Maybe ask the site that sells Zen Cart ebook. When you buy the Ebook your name is also watermarked on the page.

  4. #4
    Join Date
    Jan 2004
    Posts
    66,446
    Plugin Contributions
    81

    Default Re: Automatically Stamping Customer Name on PDF eBooks?

    Stamping the pages of the file requires finding a tool that will do that watermarking on-the-fly each time the visitor clicks to download the file they've purchased.
    You'll need to find a vendor which provides a PHP-driven tool to do that on-the-fly-watermarking, and customize the code to make use of that tool where needed.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  5. #5
    Join Date
    Apr 2011
    Location
    UK
    Posts
    33
    Plugin Contributions
    0

    Default Re: Automatically Stamping Customer Name on PDF eBooks?

    Kobra
    I really do not see where this prevents it from being shared as long as I do not care if your name is on it
    It says "This material is copyright and is licensed for the sole use by (IT'S THEN GOT MY FULL NAME AND ADDRESS". You buy one, get your name on it, copy it to a friend or two, they copy it to their friends, who copy to their friends (all with YOUR name and address on it). How long till the publishers get hold of a copy being advertised on eBay? You are obviously rich enough to not bother about being sued by the publishers. In that case, buy your own copy.

    CoolCarPartsOnline / DrByte

    Thanks for your more helpful answers, and for pointing me in the right direction. I'll follow those suggestions up and add the results here.

  6. #6
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    13,948
    Plugin Contributions
    96

    Default Re: Automatically Stamping Customer Name on PDF eBooks?

    I purchased a license for SetaPdf-Stamper (setasign.de/products/pdf-php-solutions/setapdf-stamper/) for my ZC store and it works like a charm.

  7. #7
    Join Date
    Apr 2011
    Location
    UK
    Posts
    33
    Plugin Contributions
    0

    Default Re: Automatically Stamping Customer Name on PDF eBooks?

    http://www.hotscripts.com/category/p...ipulation/pdf/ has links to 17 different programmes ranging from free to expensive, and including the programme mentioned by late9 above. I've just checked through them all.

    lat9
    Not sure, about the SetaPdf-Stamper. Looks as though I can ask it to add anything to an existing PDF file, but not sure this would allow me to add something DIFFERENT each time someone bought an eBook. On your site, does it just add that "This eBook was purchased From ..." or something similar (The same each time), or do you use it to add something like "This eBook was purchased BY ..." or something similar (Different each time) ?

  8. #8
    Join Date
    Mar 2009
    Posts
    108
    Plugin Contributions
    0

    Default Re: Automatically Stamping Customer Name on PDF eBooks?

    Quote Originally Posted by kobra View Post
    I really do not see where this prevents it from being shared as long as I do not care if your name is on it
    I agree , it wont matter to a lot of people if your name is there or not.

    I am sitting here thinking if this weekend one of my brother-in-laws was over and I told him about this eBook I just read that was great and he should read it , but then I tell him the author's name is on my copy so you will have to go to the website and buy your own copy........

    Not trying to make you mad and I know you deserve to get paid for what you are doing. just saying your name on the page wont make a big difference to some people.

  9. #9
    Join Date
    Apr 2011
    Location
    UK
    Posts
    33
    Plugin Contributions
    0

    Default Re: Automatically Stamping Customer Name on PDF eBooks?

    And your brother in law passes it to someone else ... who passes it on to someone else ... who passes it to someone else ... who puts it as a free download on their website ... AND you get thousands of spam emails AND I take you to court.
    Of course, having your email on the bottom won't stop it being passed round (just like any book that you may have written your name on the cover may be given away), and with some effort it would be possible to take the stamping off. The deterrent is having YOUR email on it. The email your PayPal account is registered to. It will, if nothing else, make people think twice.

  10. #10
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    13,948
    Plugin Contributions
    96

    Default Re: Automatically Stamping Customer Name on PDF eBooks?

    For those that might be interested, here's the modified version that I'm using for /includes/modules/pages/downloads/header_php.php to work with the SetaPDF functions:

    Code:
    <?php
    /**
     * download header_php.php
     *
     * @package page
     * @copyright Copyright 2003-2011 Zen Cart Development Team
     * @copyright Portions Copyright 2003 osCommerce
     * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
     * @version $Id: header_php.php 18964 2011-06-22 19:58:38Z drbyte $
     */
    // This should be first line of the script:
    $zco_notifier->notify('NOTIFY_HEADER_START_DOWNLOAD');
    
    define('SYMLINK_GARBAGE_COLLECTION_THRESHOLD', 1*60*60); // 1 hour default
    
    
    require(DIR_WS_MODULES . zen_get_module_directory('require_languages.php'));
    
    // if the customer is not logged on, redirect them to the time out page
    if (!$_SESSION['customer_id']) {
      zen_redirect(zen_href_link(FILENAME_TIME_OUT));
    }
    
    // Check download.php was called with proper GET parameters
    if ((isset($_GET['order']) && !is_numeric($_GET['order'])) || (isset($_GET['id']) && !is_numeric($_GET['id'])) ) {
      // if the paramaters are wrong, redirect them to the time out page
      zen_redirect(zen_href_link(FILENAME_TIME_OUT));
    }
    
    // Check that order_id, customer_id and filename match
    $sql = "SELECT date_format(o.date_purchased, '%Y-%m-%d')
              AS date_purchased_day, opd.download_maxdays, opd.download_count, opd.download_maxdays, opd.orders_products_filename, o.customers_email_address
              FROM " . TABLE_ORDERS . " o, " . TABLE_ORDERS_PRODUCTS . " op, " . TABLE_ORDERS_PRODUCTS_DOWNLOAD . " opd
              WHERE o.customers_id = customersID
              AND o.orders_id = ordersID
              AND o.orders_id = op.orders_id
              AND op.orders_products_id = opd.orders_products_id
              AND opd.orders_products_download_id = downloadID
              AND opd.orders_products_filename != ''";
    
    $sql = $db->bindVars($sql, 'customersID', $_SESSION['customer_id'], 'integer');
    $sql = $db->bindVars($sql, 'downloadID', $_GET['id'], 'integer');
    $sql = $db->bindVars($sql, 'ordersID', $_GET['order'], 'integer');
    $downloads = $db->Execute($sql);
    if ($downloads->RecordCount() <= 0 ) die;
    
    $zco_notifier->notify('NOTIFY_CHECK_DOWNLOAD_HANDLER', array($downloads));
    
    // MySQL 3.22 does not have INTERVAL, so must calculate dates with PHP:
    list($dt_year, $dt_month, $dt_day) = explode('-', $downloads->fields['date_purchased_day']);
    $download_timestamp = mktime(23, 59, 59, $dt_month, $dt_day + $downloads->fields['download_maxdays'], $dt_year);
    
    // Die if time expired (maxdays = 0 means no time limit)
    if (($downloads->fields['download_maxdays'] != 0) && ($download_timestamp <= time())) {
      zen_redirect(zen_href_link(FILENAME_DOWNLOAD_TIME_OUT));
    }
    // Die if remaining count is <=0 (maxdays = 0 means no time limit)
    if ($downloads->fields['download_count'] <= 0 and $downloads->fields['download_maxdays'] != 0) {
      zen_redirect(zen_href_link(FILENAME_DOWNLOAD_TIME_OUT));
    }
    
    $zco_notifier->notify('NOTIFY_DOWNLOAD_DAYS_COUNT_OK');
    // FIX HERE AND GIVE ERROR PAGE FOR MISSING FILE
    // Die if file is not there
    if (!file_exists(DIR_FS_DOWNLOAD . $downloads->fields['orders_products_filename'])) die('Sorry. File not found. Please contact the webmaster to report this error.<br />c/f: ' . $downloads->fields['orders_products_filename']);
    
    $zco_notifier->notify('NOTIFY_DOWNLOAD_FILE_OK');
    
    // Now decrement counter (probably should skip this if download_maxdays = 0, ie: unlimited) -- move it up to lines 48-54?
    $sql = "UPDATE " . TABLE_ORDERS_PRODUCTS_DOWNLOAD . "
              SET download_count = download_count-1
              WHERE orders_products_download_id = :downloadID";
    
    $sql = $db->bindVars($sql, ':downloadID', $_GET['id'], 'integer');
    $db->Execute($sql);
    
    // Returns a random name, 16 to 20 characters long
    // There are more than 10^28 combinations
    // The directory is "hidden", i.e. starts with '.'
    function zen_random_name()
    {
      $letters = 'abcdefghijklmnopqrstuvwxyz';
      $dirname = '.';
      $length = floor(zen_rand(16,20));
      for ($i = 1; $i <= $length; $i++) {
        $q = floor(zen_rand(1,26));
        $dirname .= $letters[$q];
      }
      return $dirname;
    }
    
    // Unlinks all subdirectories and files in $dir
    // Works only on one subdir level, will not recurse
    function zen_unlink_temp_dir($dir)
    {
      $h1 = opendir($dir);
      while ($subdir = readdir($h1)) {
        // Ignore non directories
        if (!is_dir($dir . $subdir)) continue;
        // Ignore . and .. and .svn
        if ($subdir == '.' || $subdir == '..' || $subdir == '.svn') continue;
        // Loop and unlink files in subdirectory
        $h2 = opendir($dir . $subdir);
        list($fn, $exptime) = explode('-', $subdir);
        if ($exptime + SYMLINK_GARBAGE_COLLECTION_THRESHOLD > time()) continue;
        while ($file = readdir($h2)) {
          if ($file == '.' || $file == '..') continue;
          @unlink($dir . $subdir . '/' . $file);
        }
        closedir($h2);
        @rmdir($dir . $subdir);
      }
      closedir($h1);
    }
    
    // disable gzip output buffering if active:
    @ob_end_clean();
    if (@ini_get('zlib.output_compression')) @ini_set('zlib.output_compression', 'Off');
    
    // determine filename for download
    $origin_filename = $downloads->fields['orders_products_filename'];
    $browser_filename = str_replace(' ', '_', $origin_filename);
    if (strstr($browser_filename, '/')) $browser_filename = substr($browser_filename, strrpos($browser_filename, '/')+1);
    if (strstr($browser_filename, '\\')) $browser_filename = substr($browser_filename, strrpos($browser_filename, '\\')+1);
    if (substr(DIR_FS_DOWNLOAD, -1) != '/') $origin_filename = '/' . $origin_filename;
    if (!file_exists(DIR_FS_DOWNLOAD . $origin_filename)) {
      $msg = 'DOWNLOAD PROBLEM: Problems detected with download for ' . DIR_FS_DOWNLOAD . $origin_filename . ' because the file could not be found on the server. If the file exists, then its permissions are too low for PHP to access it. Contact your hosting company for specific help in determining correct permissions to make the file readable by PHP.';
      zen_mail('', STORE_OWNER_EMAIL_ADDRESS, ERROR_CUSTOMER_DOWNLOAD_FAILURE, $msg, STORE_NAME, EMAIL_FROM);
    }
    $downloadFilesize = @filesize(DIR_FS_DOWNLOAD . $origin_filename);
    if (!isset($downloadFilesize) || ($downloadFilesize < 1)) {
      $msg = 'DOWNLOAD PROBLEM: Problem detected with download for ' . DIR_FS_DOWNLOAD . $origin_filename . ' because the server is preventing PHP from reading the file size attributes, or the file is actually 0 bytes in size (which suggests the uploaded file is damaged or incomplete). Perhaps its permissions are too low for PHP to access it? Contact your hosting company for specific help in determining correct permissions to allow PHP to stat the file using the filesize() function.';
      zen_mail('', STORE_OWNER_EMAIL_ADDRESS, ERROR_CUSTOMER_DOWNLOAD_FAILURE, $msg, STORE_NAME, EMAIL_FROM);
    }
    
    
    /* ---- Start lat9 PDF Stamper ---
    **
    ** Stamped file is of the format:  originalname_ordernum_downloadcount.pdf
         */
    $stamp_fn_out = basename($origin_filename, '.pdf') . '_' . $_GET['order'] . '_' . $downloads->fields['download_count'] . '.pdf';
    
    $stamp_fn_out = str_replace(' ', '_', $stamp_fn_out);
    
    $stamp_file_out = DIR_FS_DOWNLOAD_PUBLIC . $stamp_fn_out;
    $stamp_file_in = DIR_FS_DOWNLOAD . $origin_filename;
    
        /**
     * set the includepath for SetaPDF APIs
     * You have to point to the root directory "SetaPDF"
         */
    set_include_path(get_include_path() . PATH_SEPARATOR . DIR_FS_SETAPDF);
    
    
    $zco_notifier->notify('NOTIFY_DOWNLOAD_PATH', get_include_path());
    
    // require the SetaPDF_Stamper-class
    require_once("Stamper/SetaPDF_Stamper.php");
    
    
    $zco_notifier->notify('NOTIFY_DOWNLOAD_STAMP_LOADED');
    
    // Define the path, where the SetaPDF-Stamper will find the font-definition files
    define('SetaPDF_STAMPER_FONTPATH', 'Stamper/font/');
    
    // Create a new instance of SetaPDF_Stamper with output method "Download" w/buffering
    $stamper =& SetaPDF_Stamper::factory('D', true);
    
    $stamper->addFile( 
    	array(
    		"in"  => $stamp_file_in,
    		"out" => $stamp_file_out, 
    		"compression" => true
    	) 
    ); 
    
    // Let's create the text stamp
    // require the SetaPDF_TextStamp-class
    require_once("Stamper/SetaPDF_Stamp/SetaPDF_TextStamp.php");
    // Initiate a new instance of text_stamp 
    $textstamp =& new SetaPDF_TextStamp();
    // Set the text 
    $textstamp->setText("Licensed to:" . "\n" . $downloads->fields['customers_email_address']); 
    // Set font definitions 
    $textstamp->setFont("Arial", "B", 20, 20, "C"); 
    // Set text color to red 
    $textstamp->SetFontColor(255, 0, 0); 
    // Set the charspacing 
    $textstamp->setCharSpacing(15); 
    // Set the rendering mode 
    $textstamp->setRenderingMode(2); 
    // Set the opacity 
    $textstamp->setAlpha(0.2); 
    
        /**
    * Now we assign the text stamp to our stamper 
    * - we define the position on the center and middle of a page (CM) 
    * - the stamp should appear on "all" pages 
    * - no translation of the x-axis nor the y-axis will be done 
    * - we rotate the stamp about 60 degree 
         */
    $stamper->setStamp($textstamp,"CM", "all", 0, 0, 60); 
    
    // Let's stamp! 
    $stamper->stampit(); 
    $stamper->cleanUp();
    
    // This should be last line of the script:
    $zco_notifier->notify('NOTIFY_HEADER_END_DOWNLOAD');
    
    // finally, upon completion of the download, the script should end here and not attempt to display any template components etc.
    zen_exit();

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. Automatically Include Customer Name in Newsletter Salutation?
    By rebelman in forum Discounts/Coupons, Gift Certificates, Newsletters, Ads
    Replies: 1
    Last Post: 8 Sep 2011, 07:07 PM
  2. Automatically Include customer name in E Mail
    By Axon in forum General Questions
    Replies: 3
    Last Post: 19 Jan 2011, 11:57 PM
  3. Add Order ID# and Customer Name to PDF Download
    By chrismarie in forum All Other Contributions/Addons
    Replies: 6
    Last Post: 26 Feb 2010, 02:24 PM
  4. Automatically Add products to category by name or attribute
    By divaboutiques in forum Setting Up Categories, Products, Attributes
    Replies: 1
    Last Post: 2 Feb 2010, 01:14 PM
  5. Automatically generate PDF invoices for customers – need something faster!
    By apemusic in forum Managing Customers and Orders
    Replies: 14
    Last Post: 6 Oct 2007, 10:39 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg