Class Index

Classes


Class PDFNet.ContentReplacer

PDFNet.ContentReplacer

Class Summary
Constructor Attributes Constructor Name and Description
 
ContentReplacer is a utility class for replacing content (text and images) in existing PDF (template) documents.
Method Summary
Method Attributes Method Name and Description
 
AddImage(target_region, replacement_image)
Replace the image that best fits into 'target_region' with 'replacement_image'.
 
AddString(template_text, replacement_text)
Any text of the form "[template_text]" will be replaced by "replacement_text".
 
AddText(target_region, replacement_text)
All text inside 'target_region' will be deleted and replaced with 'replacement_text'.
<static>  
PDFNet.ContentReplacer.create()
Create a new ContentReplacer object, to which replacement rules will be added.
 
Frees the native memory of the object.
 
Process(page)
Apply the replacement instructions to the target page.
 
SetMatchStrings(start_str, end_str)
Change the delimiters from '[' and ']' to arbitary strings.
Class Detail
PDFNet.ContentReplacer(id)
ContentReplacer is a utility class for replacing content (text and images) in existing PDF (template) documents. Users can replace content in a PDF page using the following operations: - Replace an image that exists in a target rectangle with a replacement image. - Replace text that exists in a target rectangle with replacement text. - Replace all instances of a specially marked string with replacement string. The following code replaces an image in a target region. This code also replaces the text "[NAME]" and "[JOB_TITLE]" with "John Smith" and "Software Developer" respectively. Notice the square braces ('[' and ']') on the target strings in the original PDFDoc. These square braces are not included in the actual function calls below, as they're implicitly added.
Parameters:
id
Method Detail
AddImage(target_region, replacement_image)
Replace the image that best fits into 'target_region' with 'replacement_image'.
Parameters:
{rect} target_region
The rectangle defining the area in which an image that best fits the rectangle will be replaced by 'replacement_image'.
{Obj} replacement_image
The 'SDF.Obj' of a 'PDF.Image' object.

AddString(template_text, replacement_text)
Any text of the form "[template_text]" will be replaced by "replacement_text".
Parameters:
{string} template_text
The text to remove.
{string} replacement_text
The new text that will appear in place of 'template_text'.

AddText(target_region, replacement_text)
All text inside 'target_region' will be deleted and replaced with 'replacement_text'.
Parameters:
{rect} target_region
The rectangle defining the area in which all text will be replaced by 'replacement_text'.
{string} replacement_text
The new text that will replace the existing text in 'target_region'.

<static> {ContentReplacer} PDFNet.ContentReplacer.create()
Create a new ContentReplacer object, to which replacement rules will be added. The same object can be used to 'Process' multiple pages.
Returns:
{ContentReplacer} A promise that resolves to an object of type: "ContentReplacer" (generated documentation)

destroy()
Frees the native memory of the object.

Process(page)
Apply the replacement instructions to the target page. Subsequent calls to 'Process' can be made on other pages, and it will apply the same rules.
Parameters:
{Page} page
The page to apply the content replacement instructions to.

SetMatchStrings(start_str, end_str)
Change the delimiters from '[' and ']' to arbitary strings.
Parameters:
{string} start_str
The starting delimiter string.
{string} end_str
The ending delimiter string.

Documentation generated by JsDoc Toolkit 2.4.0 on Fri Sep 09 2016 14:32:38 GMT-0700 (PDT)