Used to create templates to be used by PDF Document: Static PDF mode. This component lets users place predefined placeholders (text or images) on a pdf document template.
Binary data of the pdf document.
The fonts to use for the text placeholders.
Binary true type data of the font. See SoftadminApi.PdfFont for easier managing of the fonts.
The id of the font.
The font name displayed to the user.
Optional groups to separate the available placeholders into
The id of the group.
The displayed name of the group.
The list of text placeholders that the user may place on the document.
Extra information about the placeholder.
Example text to display on the document when the user has placed the placeholder.
Id of the font to use.
The default font size.
Id of the group that the text belongs to. Must be set when using groups.
The id of the text.
Maximum width of the text before it inserts line breaks.
Descriptive title for the placeholder.
The list of text placeholders that the user may place on the document.
Whether or not the user may resize the image placeholder.
Id of the group that the image belongs to. Must be set when using groups.
The height of the image.
The content type of the example image. Must be used when ImageData is set.
The binary data of the example image.
The id of the image.
Descriptive title for the placeholder.
The width of the image.
Retrieves the existing placeholders that has already been placed on the document.
Id of the font used.
The font size used.
The page that the placeholder is placed on.
Id of the placeholder.
Id of the available placeholder that it is based on.
Maximum width of the text before it inserts line breaks.
X coordinate of the placeholder.
Y coordinate of the placeholder.
The height of the image.
Id of the available placeholder that it is based on.
The width of the image.
Called when the user places an available text placeholder on the document. This call will receive the following temporary table with one row.
CREATE TABLE #TextPlaceholder
(
PlaceholderId nvarchar(max) NULL, -- Will be set to NULL.
TextId nvarchar(max) NOT NULL,
PageNumber int NOT NULL,
X decimal(38, 1) NOT NULL,
Y decimal(38, 1) NOT NULL,
FontId nvarchar(max) NOT NULL,
FontSize decimal(38, 1) NOT NULL,
TextWidth decimal(38, 1) NULL
)
The id given to the placeholder.
Called when the user places an available image placeholder on the document. This call will receive the following temporary table with one row.
CREATE TABLE #ImagePlaceholder
(
PlaceholderId nvarchar(max) NULL, -- Will be set to NULL.
ImageId nvarchar(max) NOT NULL,
PageNumber int NOT NULL,
X decimal(38, 1) NOT NULL,
Y decimal(38, 1) NOT NULL,
Width decimal(38, 1) NOT NULL,
Height decimal(38, 1) NOT NULL
)
Called when the user changes existing placeholders on the document. This call will receive the following temporary tables with zero to many rows.
CREATE TABLE #TextPlaceholder
(
PlaceholderId nvarchar(max) NOT NULL,
TextId nvarchar(max) NOT NULL,
PageNumber int NOT NULL,
X decimal(38, 1) NOT NULL,
Y decimal(38, 1) NOT NULL,
FontId nvarchar(max) NOT NULL,
FontSize decimal(38, 1) NOT NULL,
TextWidth decimal(38, 1) NULL
)
CREATE TABLE #ImagePlaceholder
(
PlaceholderId nvarchar(max) NOT NULL,
ImageId nvarchar(max) NOT NULL,
PageNumber int NOT NULL,
X decimal(38, 1) NOT NULL,
Y decimal(38, 1) NOT NULL,
Width decimal(38, 1) NOT NULL,
Height decimal(38, 1) NOT NULL
)
Called when the user deletes existing placeholders on the document. This call will receive the following temporary tables with zero to many rows.
CREATE TABLE #DeletedTextPlaceholder
(
PlaceholderId nvarchar(max) NOT NULL
)
CREATE TABLE #DeletedImagePlaceholder
(
PlaceholderId nvarchar(max) NOT NULL
)
Allows you to validate the SQL parameters before any other SQL is run in the component. This call is only made if the SQL is a stored procedure and Validate parameters is checked.
Use this call to restrict which entries a user is allowed to view and edit, and to log which entries a user views.
Access to a menu item is normally controlled through functions and roles alone but some entities need more fine grained control. For example, a user may have access to the View Member menu item for normal members but not for members with a protected identity.
The menu items a user visits are always logged (in ADMINLogMenuItem) but for sensitive data you may need to log exactly what entries are viewed. Do the logging in this call as the common ways of viewing data (grid and InfoSQL) are not allowed to modify the database.
If you bind a scalar function instead of a stored procedure to this call then its name must end with '_GrantAccess'.
ALTER PROCEDURE Example.PdfTemplateEditor
@Action VARCHAR(50) = NULL,
@PDFTemplateId int
AS
BEGIN
SET NOCOUNT, XACT_ABORT ON;
IF @Action = 'Init'
BEGIN
SELECT
PDF
FROM
Example.PDFTemplate
WHERE
PDFTemplateId = @PDFTemplateId;
SELECT
F.FontId,
F.FontData AS Font,
F.FontName AS FriendlyName
FROM
SoftadminApi.Font F
WHERE
F.FontId = '<guid>';
SELECT
TextId,
FontId,
FontSize,
Title,
ExampleText,
TextWidth,
Description
FROM
Example.PDFTemplateAvailableTextPlaceholder
WHERE
PDFTemplateId = @PDFTemplateId;
SELECT
ImageId,
Width,
Height,
Title,
ImageData,
ImageContentType,
CanResize,
GroupId,
Description
FROM
Example.PDFTemplateAvailableImagePlaceholder
WHERE
PDFTemplateId = @PDFTemplateId;
END;
ELSE IF @Action = 'GetPlaceholders'
BEGIN
SELECT
PlaceHolderId,
TextId,
PageNumber,
X,
Y,
FontSize,
TextWidth,
FontId
FROM
Example.PDFTemplateTextPlaceholder
WHERE
PDFTemplateId = @PDFTemplateId;
SELECT
PlaceHolderId,
ImageId,
PageNumber,
X,
Y,
Width,
Height
FROM
Example.PDFTemplateImagePlaceholder
WHERE
PDFTemplateId = @PDFTemplateId;
END;
ELSE IF @Action = 'UpdatePlaceholders'
BEGIN
UPDATE t1
SET
t1.X = t2.X,
t1.Y = t2.Y,
t1.FontId = t2.FontId,
t1.FontSize = t2.FontSize,
t1.TextWidth = t2.TextWidth
FROM
Example.PDFTemplateTextPlaceholder t1
JOIN #TextPlaceholder t2
ON t1.PlaceholderId = t2.PlaceholderId;
UPDATE t1
SET
t1.X = t2.X,
t1.Y = t2.Y,
t1.Width = t2.Width,
t1.Height = t2.Height
FROM
Example.PDFTemplateImagePlaceholder t1
JOIN #ImagePlaceholder t2
ON t1.PlaceholderId = t2.PlaceholderId;
END;
ELSE IF @Action = 'InsertTextPlaceholder'
BEGIN
INSERT INTO Example.PDFTemplateTextPlaceholder
(
PDFTemplateId,
TextId,
PageNumber,
X,
Y,
FontId,
FontSize,
TextWidth
)
SELECT
@PDFTemplateId,
TextId,
PageNumber,
X,
Y,
FontId,
FontSize,
TextWidth
FROM
#TextPlaceholder;
SELECT SCOPE_IDENTITY() AS PlaceHolderId;
END;
ELSE IF @Action = 'InsertImagePlaceholder'
BEGIN
INSERT INTO Example.PDFTemplateImagePlaceholder
(
PDFTemplateId,
PredefinedImageId,
PageNumber,
X,
Y,
Width,
Height
)
SELECT
@PDFTemplateId,
ImageId,
PageNumber,
X,
Y,
Width,
Height
FROM
#ImagePlaceholder;
SELECT SCOPE_IDENTITY() AS PlaceHolderId;
END;
ELSE IF @Action = 'DeletePlaceholders'
BEGIN
DELETE Example.PDFTemplateTextPlaceholder WHERE Id IN (SELECT PlaceholderId FROM #DeletedTextPlaceholder);
DELETE Example.PDFTemplateImagePlaceholder WHERE Id IN (SELECT PlaceholderId FROM #DeletedImagePlaceholder);
END;
END;