Click or drag to resize

SQL Server Setup (optional)

RAD PDF requires access to a database when using PdfWebControl. (A database is not needed for Lite Documents / PdfWebControlLite usage.)

Database Setup

RAD PDF uses a database which can be accessed by the ASP.NET user as well as the Local System account (or other user account which the RAD PDF System Service has designated to "Log In As"). These users must be granted permission on all tables to:

  • CONNECT
  • DELETE
  • INSERT
  • SELECT
  • UPDATE
It is recommended to name this database RadPdf.

Table Creation

This section contains the following subsections:

RAD PDF requires 5 dbo tables. These tables are explained below and can be created with the provided SQL scripts.

Note: These scripts do not create indices for these tables which may be required for high volume implementations

docs Table Creation

This table stores all information about documents which have been opened by users.

Note: Documents are not the same as PDFs in RAD PDF. PDFs refer to the actual PDF files on the server. Documents are instances of these PDFs, each allowing allowing one user access. This allows multiple documents to exist on the server which represent the same PDF file without excessive data duplication.

t-sql
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[docs](
        [docID] [int] IDENTITY(1,1) NOT NULL,
        [pdfID] [int] NOT NULL,
        [docDate] [datetime] NOT NULL,
        [docDateModified] [datetime] NULL,
        [docStatus] [int] NOT NULL,
        [docSettings] [int] NOT NULL,
        [docFileName] [nvarchar](200) NOT NULL,
        [docXml] [nvarchar](max) NOT NULL,
        [docOutputData] [varbinary](max) NULL,
 CONSTRAINT [PK_docs] PRIMARY KEY CLUSTERED 
(
        [docID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

keys Table Creation

This table is used to store document keys (long hashes similar to cookie session hashes) used to access documents

t-sql
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[keys](
        [keyID] [int] IDENTITY(1,1) NOT NULL,
        [docID] [int] NOT NULL,
        [keyData] [char](25) COLLATE Latin1_General_CS_AS NOT NULL,
        [keyExpires] [datetime] NOT NULL,
        [keySettings] [int] NOT NULL,
 CONSTRAINT [PK_keys] PRIMARY KEY CLUSTERED 
(
        [keyID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO

objs Table Creation

This table is used to store document objects referenced by documents

t-sql
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[objs](
        [objID] [int] IDENTITY(1,1) NOT NULL,
        [docID] [int] NOT NULL,
        [objType] [int] NOT NULL,
        [objSettings] [int] NOT NULL,
        [objData] [varbinary](max) NOT NULL,
        [objDataLength] [int] NOT NULL,
 CONSTRAINT [PK_objs] PRIMARY KEY CLUSTERED 
(
        [objID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO

pdfs Table Creation

This table is used to store all opened PDF files

t-sql
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[pdfs](
        [pdfID] [int] IDENTITY(1,1) NOT NULL,
        [pdfDate] [datetime] NOT NULL,
        [pdfStatus] [int] NOT NULL,
        [pdfVersion] [int] NOT NULL,
        [pdfPageLoaded] [int] NOT NULL,
        [pdfPageCount] [int] NOT NULL,
        [pdfUserRights] [int] NOT NULL,
        [pdfDpi] [int] NOT NULL,
        [pdfDpiHigh] [int] NOT NULL,
        [pdfData] [varbinary](max) NOT NULL,
        [pdfDataLength] [int] NOT NULL,
        [pdfDataHash] [binary](64) NOT NULL,
        [pdfPassHash] [binary](64) NULL,
        [pdfXml] [nvarchar](max) NOT NULL,
        [pdfText] [nvarchar](max) NOT NULL,
 CONSTRAINT [PK_pdfs] PRIMARY KEY CLUSTERED 
(
        [pdfID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO

pges Table Creation

This table is used to store the rendered representations of a document's pages

t-sql
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[pges](
        [pdfID] [int] NOT NULL,
        [docID] [int] NOT NULL,
        [keyID] [int] NOT NULL,
        [pgeDate] [datetime] NOT NULL,
        [pgeStatus] [int] NOT NULL,
        [pgeNumber] [int] NOT NULL,
        [pgeImageType] [int] NOT NULL,
        [pgeImageData] [varbinary](max) NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
See Also