Tips and Tricks HQ Support

Support site for Tips and Tricks HQ premium products

  • Home
  • Contact Us
  • Documentation
  • Forum Home
    • Forum
    • Forum Search
    • Forum Login
    • Forum Registration

PDF Stamper – "dynamic" stamp on different pdfs

by

Tips and Tricks HQ Support Portal › Forums › WP PDF Stamper › PDF Stamper – "dynamic" stamp on different pdfs

  • This topic has 10 replies, 2 voices, and was last updated 6 years, 9 months ago by admin.
Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • July 23, 2018 at 6:49 pm #14981
    support2
    Spectator

    Saw this link: https://www.tipsandtricks-hq.com/wp-pdf-stamper/pdf-stamper-dynamically-modifying-the-text-to-stamp-data but not sure how to implement into our current code.

    Does anyone have any sample for the above? Basically what we are trying to achieve is to stamp different text(not only different values) to different pdfs. For example, for certain pdfs, like type A we want to stamp this text: “Thank you [username]. This pdf is type A”. For pdfs, like type B we want to stamp this text: “Congratulations [username]. You won this pdf type B!”.

    Is this possible?

    July 24, 2018 at 9:40 am #78223
    admin
    Keymaster

    This will need some customization. Are you going to be doing it on a per product basis? So different products will have different stamp? If you are, is WP eStore plugin being used for the products?

    July 24, 2018 at 5:25 pm #78224
    support2
    Spectator

    Yes, we want to use it ‘per product’ basis so different products have different stamp depending on the pdf.

    We actually are using the plugin using the “integration code” and not the WP eStore:


    /*** Mandatory data ***/

    // Post URL

    $postURL = “https://www.yourwebsite.com/wp-content/plugins/wp-pdf-stamper/api/stamp_api.php”;

    // The Secret key

    $secretKey = “1234567890.11144468”;

    //The source file URL (The file that you want to stamp)

    $fileURL = “http://www.example.com/wp-content/uploads/test-ebook.pdf”;

    /*** Optional Data ***/

    //Customers Name

    $customerName = “John Doe”;

    //Customer Email address

    $customerEmail = “john.doe@gmail.com”;

    //Customer’s Address

    $customerAddress = “123 Some Street, San Jose, CA – 95130, U.S.A.”;

    // prepare the data

    $data = array ();

    $data = $secretKey;

    $data = $fileURL;

    $data = $customerName;

    $data = $customerEmail;

    $data = $customerAddress;

    // send data to post URL

    $ch = curl_init ($postURL);

    curl_setopt ($ch, CURLOPT_POST, true);

    curl_setopt ($ch, CURLOPT_POSTFIELDS, $data);

    curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);

    $returnValue = curl_exec ($ch);

    // Process the return values

    list ($status, $value) = explode (“n”, $returnValue);

    if(strpos($status,”Success!”) !== false)

    {

    $file_url = trim($value);

    echo “The URL of the stamped file is: “.$file_url;

    }

    else

    {

    echo “An error occured while trying to stamp the file! Error details: “.$value;

    }


    Is it possible to do what we want using the integration code?

    Let me know if you want to see our full code as the above is just the sample from the plugin but basically our code is based off of it.

    July 25, 2018 at 7:46 am #78225
    admin
    Keymaster

    Yeah. Basiclaly, you are executing the API query to stamp a file from your custom code. Your code in charge of what gets stamped. The $data variable is where you specify which file to be stamped.

    I don’t know the full scope of your custom code but you will need to add condition there so you send different PDF file based on whatever criteria you have.

    Are you a PHP coder though? This type of customization really requires good coding knowledge. This is not going to be just a couple of lines of code changes type of customization.

    July 25, 2018 at 7:08 pm #78226
    support2
    Spectator

    The $data variable – i understand that, yes you need a condition and based on that condition the variable will be set.

    What im looking for assistance here is to tell me how/what code to use to ‘manipulate’ the text to stamp code. (As this code is somewhat ‘hardcoded’ into the plugin – from the Settings menue of the plugin in wordpress)

    I can create the conditions, etc. in php no problem, but like i said, i need to know what code it is to use and in what file, etc.

    July 26, 2018 at 3:15 am #78227
    admin
    Keymaster

    okay, the following filter is what you used to customize the stamping text

    filter_stamper_text_after_replacing_tags

    This filter passes two parameters. The 2nd parameter is an array that contains the product name. You can read it like the following:

    $product_name = $additional_params;

    Then use it to add your condition and change the stamping text value.

    Now, normally when you use WP eStore’s standard integration, we pass the product name value to the API so it will be available in the above mentioned filter. In your case, you are doing a custom integration. So from your customer code, you will need to pass the product name using the “product_name” parameter. Below is an example of what you add to the $data array before making the cURL request:

    $data = array ();

    $data = $secretKey;

    $data = $fileURL;

    $data = $customerName;

    $data = $customerEmail;

    $data = $customerAddress;

    $data = $productName;

    July 31, 2018 at 11:24 pm #78228
    support2
    Spectator

    I set this code for testing:

    $data = array ();

    $data = $secretKey;

    $data = $fileURL;

    $customerName = “John Smith”;

    $data = $customerName;

    $customerBusinessName = “PizzaRUs”;

    $data = $customerBusinessName;

    $data = $customerEmail;

    $data = $customerAddress;

    $productName = “Hello world stamper”;

    $data = $productName;

    but it is not stamping anything, only the default parameters.

    Also, within the plugin settings(wp->PDF Stamper->Settings) in the “Stamp Text Layout Settings” section I added this to the “Text to Stamp” field box: “{customer_business_name} : {customer_name} {product_name}”. The pdf gets stamped but it stamps this: “PizzaRUs : John Smith {product_name}”, so it does not recognize the ‘product_name’ parameter as a parameter so it stamps it as text.

    August 2, 2018 at 5:10 pm #78229
    support2
    Spectator

    help anyone?

    August 2, 2018 at 11:38 pm #78230
    admin
    Keymaster

    Did you also add code that uses that parameter in the following filter?

    https://www.tipsandtricks-hq.com/wp-pdf-stamper/pdf-stamper-dynamically-modifying-the-text-to-stamp-data

    Can you show me the code for what you have done with that filter?

    August 3, 2018 at 10:41 pm #78231
    support2
    Spectator

    I have not done anything with any filter(even with our working integrated custom code). From my original question, Im not sure what files/code needs to be edited to ‘add’ or edit any filter.

    Due to the lack of options/functionality of the forum, we cant attach images. Looking at the directories of the plugin using ftp, I am listing some of the files that I think need to be edited:

    In the wp-content/plugins/wp-pdf-stamper/api folder:

    -clickbank-config.php

    -dc.php

    -ipn_customization_config.php

    -ipn_handler.php

    -stamp-api-include-3.php

    -stamp_api.php

    -stamp_api_function.php

    -stamp_api_internal.php

    -stamper_class_includes.php

    What files need to be edited and where/how to add the code from the link?

    https://www.tipsandtricks-hq.com/wp-pdf-stamper/pdf-stamper-dynamically-modifying-the-text-to-stamp-data

    August 4, 2018 at 11:42 pm #78232
    admin
    Keymaster

    That needs to go in your custom code. Normally, a good idea is to create a small plugin and then put your custom code in there. I will need to send you an email for it.

  • Author
    Posts
Viewing 11 posts - 1 through 11 (of 11 total)
  • You must be logged in to reply to this topic.
Log In

Forum Related

  • Forum Home
  • Forum Search
  • Forum Registration
  • Forum Login

Support Related Forms

  • Contact Us
  • Customer Support
  • Request a Plugin Update
  • Request Fresh Download Links

Useful Links

  • Plugin Upgrade Instructions
  • WP eStore Documentation
  • WP eMember Documentation
  • WP Affiliate Platform Documentation
  • Tips and Tricks HQ Home Page
  • Our Projects

Quick Setup Video Tutorials

  • WP eStore Video Tutorial
  • WP eMember Video Tutorial
  • WP Affiliate Platform Video Tutorial
  • Lightbox Ultimate Video Tutorial

Our Other Plugins

  • WP Express Checkout
  • Stripe Payments Plugin
  • Simple Shopping Cart Plugin
  • Simple Download Monitor

Copyright © 2025 | Tips and Tricks HQ