## pdfjsControl

pdfjsControl allow to control the pdf loaded.
It's the minimal class to manipulate a pdf.
PdfjsControl implements pdfjsCommand.
For methods inherited see PdfjsCommand documentation.

- Create an instance of pdfjsControl
- Load a pdf
- Manipulate it

### Example

// In controller
pdfjsControl: PdfjsControl = new PdfjsControl();
ngOnInit():void {
this.pdfjsControl.load('assets/pdfs/conditions.pdf');
}

## Pdf methods

pdfjsControl.load(source: PdfSource, autoSelect: boolean = false): PDFPromise<number>
Define source as current pdf managed by pdfjsControl
Argument | Default value | Description
--- | --- | ---
source: PdfSource |  | The pdf
autoSelect: boolean | false | Should the first page be selected
Return
PDFPromise<number> | Promise of number of pages loaded

pdfjsControl.unload(): void
Unload the pdf loaded

## Item methods

pdfjsControl.addItem(item: PdfjsItem, idx?: number): void
Add PdfjsItem to index
Argument | Default value | Description
--- | --- | ---
item: PdfjsItem |  | The item to add
idx: number |  | The index where the item should be insert, if undefined, insert at the end

pdfjsControl.removeItem(item: PdfjsItem): void
Remove PdfjsItem in items array
Argument | Default value | Description
--- | --- | ---
item: PdfjsItem |  | The item to remove

pdfjsControl.getPdfPages(): PdfPage[]
Get all page from Pdf loaded in pdfjsControl
Return
PdfPage[] | An array of PdfPage

pdfjsControl.getItemByIndex(idx: number): PdfjsItem
Get a pdfjsItem by its index
Argument | Default value | Description
--- | --- | ---
idx: number |  | The index
Return
PdfjsItem | A PdfjsItem

pdfjsControl.containsItem(item: PdfjsItem): boolean
Is the items array contained the item
Argument | Default value | Description
--- | --- | ---
item: PdfjsItem |  | The item research
Return
boolean | true if the items array contains it, else false.

pdfjsControl.indexOfItem(item: PdfjsItem): number
Get the index item, the 0 based position in array.
Argument | Default value | Description
--- | --- | ---
item: PdfjsItem |  | The item research
Return
number | The index of pdfjsITem.