Difference between revisions of "Attach a PDF to a Web Page View"
From SmartWiki
Line 7: | Line 7: | ||
To attach a PDF file to the beginning or the end of the [[Web Page View]]: | To attach a PDF file to the beginning or the end of the [[Web Page View]]: | ||
:<font size="3">'''<!--@ssattach(''position'';''pdf file location'')-->'''</font> | :<font size="3">'''<!--@ssattach(''position'';''pdf file location'')-->'''</font> | ||
+ | |||
To attach a PDF file to a defined page location within the [[Web Page View]]: | To attach a PDF file to a defined page location within the [[Web Page View]]: | ||
:<font size="3">'''<!--@ssattach(insert;''pdf file location'';''page number'')-->'''</font> | :<font size="3">'''<!--@ssattach(insert;''pdf file location'';''page number'')-->'''</font> | ||
+ | |||
'''Where:''' | '''Where:''' | ||
− | * ''position'' is either '''before''' or ''' | + | * ''position'' is either '''before''', '''after''' or '''insert''' |
+ | * ''page number'' is the page at which the file should be inserted into the PDF document. | ||
+ | ::'''Note:''' The ''page number'' is '''only''' specified when using ''insert'' as the position. | ||
* ''pdf file location'' is: | * ''pdf file location'' is: | ||
:{|cellpadding="5" cellspacing="0" border="1" | :{|cellpadding="5" cellspacing="0" border="1" | ||
Line 29: | Line 33: | ||
− | + | '''Notes:''' | |
− | + | * When a [[Multiple Files]] field is specified, all PDF files stored in that field will be attached where specified. | |
+ | * Single or Multiple file fields on parent levels can be access using: | ||
::* @parent.''Custom Field Name''.value@ | ::* @parent.''Custom Field Name''.value@ | ||
::* @parent.parent.''Custom Field Name''.files@ | ::* @parent.parent.''Custom Field Name''.files@ | ||
− | + | * The ''page number'' is only specified when using ''insert'' as the position. | |
− | + | * To obtain the file location for a PDF file stored in a [[Smart Folder]] go to the relevant [[Smart Folder]] and select '''View URL''' from the '''File Options''' combo box next to the relevant PDF file. The first part of the URL should be omitted: the location specified should begin with "/files/..." as in the examples below. | |
Line 57: | Line 62: | ||
:* '''Note:''' Don't forget to include '''.value''' | :* '''Note:''' Don't forget to include '''.value''' | ||
+ | |||
+ | |||
+ | * Insert all PDF files stored in a [[Custom Field Type: Link – Multiple Files|Multiple Files Custom Field]] called ''"AttachManyPDFFiles"'' at page 4 of the current [[Web Page View Field]] page:. | ||
+ | |||
+ | <pre> | ||
+ | <!--@ssattach(insert;@AttachManyPDFFiles.files@;4)--> | ||
+ | </pre> | ||
+ | |||
+ | :* '''Note:''' Don't forget to include '''.files''' | ||
Revision as of 14:46, 17 May 2010
You can use the ssattach function to append one or more PDF documents stored in either a Single File Field or Smart Folder to a Web Page View Field.
Note: The attached PDF file(s) will not be visible when viewing the web page in HTML mode, but will be appended when exported as a PDF, saved as a PDF, emailed as PDF or created by a Workflow as attachment.
Syntax
To attach a PDF file to the beginning or the end of the Web Page View:
- <!--@ssattach(position;pdf file location)-->
To attach a PDF file to a defined page location within the Web Page View:
- <!--@ssattach(insert;pdf file location;page number)-->
Where:
- position is either before, after or insert
- page number is the page at which the file should be inserted into the PDF document.
- Note: The page number is only specified when using insert as the position.
- pdf file location is:
File Source Syntax Smart Folder /files/folder1/folder2/File_Name.pdf Single File Custom Field @Custom Field Name.value@ Multiple Files Custom Field @Custom Field Name.files@
Notes:
- When a Multiple Files field is specified, all PDF files stored in that field will be attached where specified.
- Single or Multiple file fields on parent levels can be access using:
- @parent.Custom Field Name.value@
- @parent.parent.Custom Field Name.files@
- The page number is only specified when using insert as the position.
- To obtain the file location for a PDF file stored in a Smart Folder go to the relevant Smart Folder and select View URL from the File Options combo box next to the relevant PDF file. The first part of the URL should be omitted: the location specified should begin with "/files/..." as in the examples below.
Examples
- Append a PDF file from a Smart Folder before the current Web Page View Field page:
<!--@ssattach(before;/files/1234/123/myfile.pdf )-->
- Append a PDF file from a Smart Folder after the current Web Page View Field page:
<!--@ssattach(after;/files/1234/123/myfile.pdf )-->
- Append a PDF file from a Single File Custom Field called "AttachPDFFile" before the current Web Page View Field page:.
<!--@ssattach(before;@AttachPDFFile.value@)-->
- Note: Don't forget to include .value
- Insert all PDF files stored in a Multiple Files Custom Field called "AttachManyPDFFiles" at page 4 of the current Web Page View Field page:.
<!--@ssattach(insert;@AttachManyPDFFiles.files@;4)-->
- Note: Don't forget to include .files
- Attach PDF files to a Level 1 Web Page View from the UTA Role Custom Fields on the contact section:
[#(?object=contact;)<!--@ssattach(after;$?opr_123456.value$)-->#]
Where 123456 is the Custom Field ID
- You can also control the format settings of the PDF that is output by using the following syntax. The PDF file referenced should be a blank one-page pdf file which has the format settings you wish your PDF document to have. The Web Page View will be inserted onto this template:
<!--@ssattach(setting;/files/1234/123/myfile.pdf)-->
Additional Information
- The ssattach function can be placed anywhere inside the Web Page View Field
- All PDF page settings will driven by the first PDF document file, whether it is a static file or one generated by SmartSimple
- Multiple PDF files can be attached from different sources by using multiple ssattach statements:
<!--@ssattach(before;/files/1234/123/myfileheader.pdf )--> <!--@ssattach(after;/files/1234/123/myfilefooter.pdf )--> <!--@ssattach(after;/files/1234/123/myfileappendix.pdf )--> <html><body> My Pdf file </body></html>
- SSlogic can be used if the PDF file(s) to be attached needs to be varied using conditional statments:
<!--@sslogic('@type@'='contact')--> <!--@ssattach(after;@parent.contract.value@)--> <!--@else--> <!--@ssattach(after;@parent.othercontract.value@)--> <!--@end-->