Question:I have an eBook in word that I convert to PDF before distributing to my clients. I'd like to dynamically insert their email address into all links in the eBook to allow them access to the members-only content on my site, and I'd like to do this on the fly, as part of the book download process.I've briefly looked at some software and website, but I was wondering what specific technique I'd use to insert this data.I was thinking I'd insert an email token string where I want the email address to go, and then use some function to update those tokens in the PDF document. Can anyone point me in the right direction? I have PHP experience, but not with editing / generating PDF documents from PHP. Is there any solution on VeryDOC?
Answer: According to your needs, I guess you can convert word to PDF eBook and then stamp PDF by email address then this matter can be solved. You can insert data in the format of stamping PDF. If you feel this solution is good, please refer to the following part. The software I use here is named as VeryDOC DOC to Any Converter, by which you can convert doc to PDF and directly insert email address as stamp. And this is command line version software, you can call it from PHP. If you need to use the SDK version, there is also one available. In the following part, I will show you how to process it.
Step 1. Free download DOC to Any Converter Command Line
- As this is command line version software, when downloading finishes, it is a zip file. Please extract it to some folder then you can call the executable file from MS Dos Windows.
- When you use this software, please refer to the usage and example.
Step 2. Convert word to PDF eBook and inset data as email address.
- When you need to convert word to PDF eBook and insert data as email address, you may need the following parameters and please refer to the following command line templates:
- When you need to call it from PHP, please refer to the following code template:
-useprinter : Convert DOC files to other formats via virtual printer
-width <int> : Set page width to PDF file
-height <int> : Set page height to PDF file
-xres <int> : Set X resolution to image file
-yres <int> : Set Y resolution to image file
-bitcount <int> : Set color depth for image conversion
-compression <int> : Set compression for TIFF image
-wtext <string> : watermark on printed document
-wtype <int> : type of watermark
0 : normal watermark
1 : watermark on header
2 : watermark on footer
-wf <string> : font name of watermark
-wh <int> : font size of watermark
-wb : specify bold font
-wi : specify an italic font
Some examples:
doc2any.exe -wtext "support@verydoc.com" "C:\in.doc" C:\out.pdf
doc2any.exe -wtext "support@verydoc.com" -wc "0000FF" "C:\in.doc" C:\out.pdf
doc2any.exe -wtext "support@verydoc.com" -wx 100 -wy 100 "C:\in.doc" C:\out.pdf
<?php
$exeshell =new COM("exeshell.shell") or die("Can't start exeshell");
$exeshell->RunCommandLine("UserName", "Password", ' "C:\doc2any.exe" "C:\test.doc" "C:\out.pdf" ');
$exeshell = null;
?>
During the using, if you have any question, please contact us as soon as possible.