File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ import { PDFObject } from 'react-pdfobject'
2020< PDFObject url = " path/to/example.pdf" / >
2121```
2222
23- ### Props
23+ ## Props
2424
2525``` ts
2626interface Props {
@@ -32,7 +32,53 @@ interface Props {
3232 page? : string | number ;
3333 id? : string ;
3434 fallbackLink? : string | false ;
35+ pdfOpenParams? : OpenParams ;
36+ PDFJS_URL? : string ;
37+ forcePDFJS: boolean ;
38+ assumptionMode: boolean ;
3539}
40+
41+ export interface OpenParams {
42+ page? : number ;
43+ zoom? : ZoomMode ;
44+ nameddest? : string ;
45+ pagemode? : PageMode ;
46+ view? : ViewMode ;
47+ }
48+
49+ export type ZoomMode = ' scale' | ' scale,left,top' ;
50+
51+ export type PageMode = ' bookmarks' | ' thumbs' | ' none' ;
52+
53+ export type ViewMode =
54+ | ' Fit'
55+ | ' FitH'
56+ | ' FitH,top'
57+ | ' FitV'
58+ | ' FitV,left'
59+ | ' FitB'
60+ | ' FitBH'
61+ | ' FitBH,top'
62+ | ' FitBV'
63+ | ' FitBV,left' ;
64+ ```
65+
66+ ## API / Static Methods Supported
67+
68+ #### PDFObject.supportsPDFs [ Function]
69+
70+ ``` ts
71+ if (PDFObject .supportsPDFs ){
72+ console .log (" Yay, this browser supports inline PDFs." );
73+ } else {
74+ console .log (" Boo, inline PDFs are not supported by this browser" );
75+ }
76+ ```
77+
78+ #### PDFObject.pdfobjectversion [ Function]
79+
80+ ``` ts
81+ console .log (PDFObject .pdfobjectversion ); // "2.1.1"
3682```
3783
3884ref: https://pdfobject.com/#api
Original file line number Diff line number Diff line change @@ -50,6 +50,14 @@ export class PDFObject extends React.PureComponent<Props> {
5050 assumptionMode : true ,
5151 } ;
5252
53+ public static pdfobjectversion ( ) {
54+ return pdfobject . pdfobjectversion ;
55+ }
56+
57+ public static supportsPDFs ( ) {
58+ return pdfobject . supportsPDFs ;
59+ }
60+
5361 public componentDidMount ( ) {
5462 this . embed ( ) ;
5563 }
Original file line number Diff line number Diff line change @@ -7,3 +7,11 @@ test('should render self and sub-components', () => {
77 const tree = shallow ( < PDFObject url = "path/to/example.pdf" /> ) ;
88 expect ( toJson ( tree ) ) . toMatchSnapshot ( ) ;
99} ) ;
10+
11+ test ( 'should return pdfobjectversion' , ( ) => {
12+ expect ( PDFObject . pdfobjectversion ( ) ) . toBe ( '2.1.1' ) ;
13+ } ) ;
14+
15+ test ( 'should return supportsPDFs' , ( ) => {
16+ expect ( PDFObject . supportsPDFs ( ) ) . toBeFalsy ( ) ;
17+ } ) ;
You can’t perform that action at this time.
0 commit comments