template

The PDF Creator enables you to create secure PDF documents and to view, print and process existing PDF documents.
If you have any questions about the installation and usage of the PDF Creator please post them here.
Post Reply
sergio
Posts: 5
Joined: Tue May 03 2005

template

Post by sergio »

How can I use templates? PdfCreator exposes TemplateMode, TemplatePrint, TemplateRepeat and TemplateVisible properties...but how can I load a template?
Joan
Amyuni Team
Posts: 2799
Joined: Wed Sep 11 2002
Contact:

Post by Joan »

Hello,

These properties are new and are not documented yet.
Here is some explanation and a sample code on using the Template properties of the PDF Creator.

In the PDF Creator, opening a file in template mode means that the opened file will be loaded into the Creator control but it will be "read only". This means the user will be able to see the file that was loaded in template mode only. He/she will not be able to modify it or add objects to it.

The user, however, can still add object or modify objects on the main document. Below is an example:

Code: Select all

pdf.TemplateMode = 1; // this tells the Creator that the next file to be opened will be a template document.
pdf.Open("myTemplateFile.pdf", ""); // the Open() method has the same syntax
pdf.TemplateMode = 0; //reset the templateMode flag to false (0). This statement is actually redundant, because after the call to Open() above, the internal flag is always automatically set to 0.
pdf.Open("myNormalFileToWorkWith.pdf", ""); // Open another file but in normal mode, this file will be editable and will be view on top of the other template opened file. ALSO note that it is not necessary to open another file, the user can still work with the blank document over the template document.
...
...// do normal work
...
pdf.Save("myNewNormalFile",0); // This will save the normal file's changes


The properties:
-TemplatePrint: if true, then the template document will print along with the normal document. If false, then only the normal document will print.
-TemplateRepeat: if true then you get the following if for example if the template document is only 2 pages and the normal document has reached 5 pages:

Code: Select all

control    :  template doc   : normal doc
1                    1                          1
2                    2                          2
3                    1                          3
4                    2                          4
5                    1                          5
if false, then you get:
control    :  template doc   : normal doc
1                    1                         1
2                    2                         2
3                                               3
4                                               4
5                                               5
-TemplateVisible: if true, the template documetn always shows, if false it is hidden.

Hope this helps.
Post Reply