How to add multiple Watermarks & Stamps to generated PDF file using DOC to Any Converter Command Line software? How to use "-watermarkfile" option?

Questions:

1) We are converting HTML to PDF. The software we replacing took care of paginating if extra pages were needed. Does your software do this?
2) The software we are replacing also allowed us to add headers (images, etc.) and footers (html, and page numbers)

Please provide instructions in VB.
Customer
-----------------------------------------------
>>1) We are converting HTML to PDF. The software we replacing took care of paginating if extra pages were needed. Does your software do this?

Thanks for your message, what is your meaning for the "took care of paginating if extra pages were needed"? do you need to add additional blank pages if necessary?

>>2) The software we are replacing also allowed us to add headers (images, etc.) and footers (html, and page numbers)

You can use following C# code to convert HTML file to PDF file using doc2any SDK,
----------------------------
string appPath = Path.GetDirectoryName(Application.ExecutablePath);
string strInFile = "D:\\downloads\\verypdf.html";
string strOutFile = "D:\\downloads\\_test_out.pdf";

string strCmd = "-webkit -$ XXXX-XXXX-XXXX-XXXX";
strCmd += " \"" + strInFile + "\" \"" + strOutFile + "\"";
MessageBox.Show(strCmd);

System.Type VeryPDFType = System.Type.GetTypeFromProgID("VeryPDF.doc2anyCom");
VeryPDF.doc2anyCom VeryPDFCom = (VeryPDF.doc2anyCom)System.Activator.CreateInstance(VeryPDFType);
string strReturn = VeryPDFCom.doc2any(strCmd);
MessageBox.Show("Processing finished.");
----------------------------

You can use "-webkit" option to convert HTML file to PDF file.

You can use following options to add page headers and footers to generated PDF files,

-wtext <string> : Watermark text on printed document
-wtext does support following dynamic values:
%PageCount%, %PageNumber%, %PageCountRoman%, %PageCountRoman2%,
%PageNumberRoman%, %PageNumberRoman2%, %Author%, %Keywords%,
%Subject%, %Title%, %Filename%, %Date%, %Time%
-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
-wu : specify an underlined font
-ws : specify a strikeout font
-wa <int> : angle of watermark
-wbox <string> : a rectangle to output formatted text, it is only useful for "-walign" option, eg:
-wbox "0,0,595,842"
-wbox "0,0,612,792"
-wbox "auto"
-walign <int> : set text align
            1 : left
            2 : center
            3 : right
-wc <string> : color of watermark,
       FF0000: Red color
       00FF00: Green color
       0000FF: Blue color
       HexNum: Other colors
-wx <int>    : X offset of watermark
-wy <int>    : Y offset of watermark
-wpagebegin <int>  : first page to add the watermark
-wpageend <int>    : last page to add the watermark
-wpageoffset <int> : a value to be added to page number
-watermarkfile <string> : a .ini file which contain information for multiple watermarks

Add watermarks into PDF files:
doc2any.exe -wtext "VeryPDF" "C:\in.doc" C:\out.pdf
doc2any.exe -wtext "VeryPDF" -wc "0000FF" "C:\in.doc" C:\out.pdf
doc2any.exe -wtext "VeryPDF" -wx 100 -wy 100 "C:\in.doc" C:\out.pdf
doc2any.exe -wtext "VeryPDF" -wtype 1 "C:\in.doc" C:\out.pdf
doc2any.exe -wtext "VeryPDF" -wtype 2 "C:\in.doc" C:\out.pdf
doc2any.exe -wtext "VeryPDF" -wtype 0 -wa 45 "C:\in.doc" C:\out.pdf
doc2any.exe -wtext "VeryPDF" -wf "Arial" "C:\in.doc" C:\out.pdf
doc2any.exe -wtext "VeryPDF" -wf "Arial" -wh 20 "C:\in.doc" C:\out.pdf
doc2any.exe -wtext "VeryPDF" -wf "Arial" -wh 20 -wb -wi -wu -ws "C:\in.doc" C:\out.pdf
doc2any.exe -wtext "VeryPDF" -wf "Arial" -walign 3 -wh 20 -wbox "0,770,612,792" "C:\in.doc" C:\out.pdf
doc2any.exe -wtext "Watermark %PageNumber% of %PageCount%" "C:\in.doc" C:\out.pdf
doc2any.exe -wtext "Watermark %PageNumber% of %PageCount%" -wpagebegin 10 -wpageend 20 -wpageoffset 100 "C:\in.doc" C:\out.pdf
doc2any.exe -wtext "Watermark %PageNumberRoman% of %PageCountRoman%" "C:\in.doc" C:\out.pdf
doc2any.exe -wtext "Watermark %PageNumberRoman2% of %PageCountRoman2%" "C:\in.doc" C:\out.pdf
doc2any.exe -wtext "Watermark %PageNumber% of %PageCount%" -walign 3 -wtype 1 "C:\in.doc" C:\out.pdf
doc2any.exe -wtext "Watermark %PageNumber% of %PageCount%" -walign 2 -wtype 2 "C:\in.doc" C:\out.pdf
doc2any.exe -wtext "%Filename% %Date% %Time% %PageNumber% of %PageCount%" "C:\in.doc" C:\out.pdf

for example,

doc2any.exe -webkit -wtype 1 -wtext "Watermark %PageNumber% of %PageCount%" http://www.verypdf.com D:\downloads\_out.pdf

Please feel free to let us know if you have any question for above functions.

VeryPDF
-----------------------------------------------
1) If the HTML required > then one page it would page break it for us in the PDF.
2) Are we able to do page 1 of X?
3) Are we able to use the header on the first page only and then change it to just a small text header? Sample attached.
4) Do you have any page break commands?

Please provide samples in VB.

First page has logo header and footer including page number
Second page has different header and same footer with page number.

Please provide samples in VB.

Thanks.
Customer
-----------------------------------------------
>>1) If the HTML required > then one page it would page break it for us in the PDF.
>>2) Are we able to do page 1 of X?
>>3) Are we able to use the header on the first page only and then change it to just a small text header? Sample attached.
>>4) Do you have any page break commands?

Thanks for your message, doc2any SDK can't format the contents during conversion, I suggest you may format the contents in HTML file first, for example, you can include the header on the first, and then change it to text header on the following page, you can use following DIV CSS style to break the pages,

<div style="page-break-before:always;"></div>

after that, you can use following code to convert your HTML file to PDF file easily,

--------------------------
strInFile = "D:\downloads\verypdf.html"
strOutFile = "D:\downloads\out.pdf"
strCmd = "-webkit -$ XXXX-XXXX-XXXX-XXXX -wtype 1 -wtext ""Watermark %PageNumber% of %PageCount%"" " & """" & strInFile & """ """ & strOutFile & """"

Set VeryPDFCom = Server.CreateObject("VeryPDF.doc2anyCom")
strReturn = VeryPDFCom.doc2any(strCmd)
Response.write "Processing finished."
--------------------------

>>First page has logo header and footer including page number
>>Second page has different header and same footer with page number.
>>Please provide samples in VB.

Thanks for your message, you can include different headers into HTML contents itself, and then convert this HTML file to PDF file using doc2any SDK product.

You can also convert a simple HTML file to PDF file first, and then use PDFStamp Command Line to stamp different header and footer contents to the PDF pages, we hope this solution will useful to you too, PDFStamp Command Line can be downloaded from following web page,

http://www.verypdf.com/app/pdf-stamp/try-and-buy.html

VeryPDF
-----------------------------------------------
Support,

Can you provide more information (i.e. help files or samples) on how to utilize the option -watermarkfile?

Also, when I tested the option -wpagebegin , it did not seem to function.  Is it 1-based or 0-based?

Thanks,
Customer
-----------------------------------------------
Thanks for your message, you can run following command line to add more watermarks to DOC converted PDF file,

doc2any.exe -watermarkfile "%CD%\watermark.ini" "%CD%\example.doc" "%CD%\_out_7_watermark.pdf"

"watermark.ini" file is contain following contents,

[watermark1]
type=3
text=image-stamp1.jpg
x=200
y=200
width=80
height=80
opacity=50
angle=45
firstpage=0
lastpage=0

[watermark2]
type=3
text=image-stamp2.jpg
x=100
y=100
width=80
height=80
opacity=50
angle=45
firstpage=0
lastpage=0

[watermark3]
type=1
text=Demo watermark 3
fontname=Times New Roman
x=200
y=200
height=20
width=0
fontbold=0
fontitalic=0
fontunderline=0
fontstrikeout=0
opacity=90
angle=0
color=FF0000
firstpage=1
lastpage=1

[watermark4]
type=2
text=Demo watermark 4
fontname=Times New Roman
x=200
y=0
height=20
width=0
fontbold=0
fontitalic=0
fontunderline=0
fontstrikeout=0
opacity=100
angle=0
color=FF0000
firstpage=1
lastpage=1

[watermark5]
type=0
text=Demo watermark 5
fontname=Times New Roman
x=50
y=50
height=100
width=0
fontbold=0
fontitalic=0
fontunderline=0
fontstrikeout=0
opacity=50
angle=30
color=FF0000
firstpage=1
lastpage=2

You can download the trial version of "DOC to Any Converter Command Line" from this web page,

http://www.verydoc.com/doc-to-any.html
http://www.verydoc.com/doc2any_cmd.zip

after you download and unzip it to a folder, please go to "test" folder, run "test-7-watermark.bat" file to test multiple watermarks function.

>>Also, when I tested the option -wpagebegin , it did not seem to function. Is it 1-based or 0-based?

-wpagebegin is 1-based, you may use following command line to use this parameter,

doc2any.exe -wtext "Watermark %PageNumber% of %PageCount%" -wpagebegin 10 -wpageend 20 -wpageoffset 100 "C:\in.doc" C:\out.pdf

VeryPDF

VN:F [1.9.20_1166]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.20_1166]
Rating: 0 (from 0 votes)

Related Posts

This entry was posted in DOC to Any Converter and tagged , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *


Verify Code   If you cannot see the CheckCode image,please refresh the page again!