Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: wojtekmaj/react-pdf
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v7.0.2
Choose a base ref
...
head repository: wojtekmaj/react-pdf
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v7.0.3
Choose a head ref
  • 2 commits
  • 3 files changed
  • 1 contributor

Commits on Jun 1, 2023

  1. Copy the full SHA
    2025587 View commit details
  2. v7.0.3

    wojtekmaj committed Jun 1, 2023
    Copy the full SHA
    bade2a6 View commit details
Showing with 43 additions and 10 deletions.
  1. +1 −1 package.json
  2. +26 −1 src/Document.tsx
  3. +16 −8 src/shared/types.ts
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-pdf",
"version": "7.0.2",
"version": "7.0.3",
"description": "Display PDFs in your React app as easily as if they were images.",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
27 changes: 26 additions & 1 deletion src/Document.tsx
Original file line number Diff line number Diff line change
@@ -499,11 +499,36 @@ Document.propTypes = {
onSourceError: PropTypes.func,
onSourceSuccess: PropTypes.func,
options: PropTypes.shape({
cMapUrl: PropTypes.string,
canvasFactory: PropTypes.any,
canvasMaxAreaInBytes: PropTypes.number,
cMapPacked: PropTypes.bool,
CMapReaderFactory: PropTypes.any,
cMapUrl: PropTypes.string,
disableAutoFetch: PropTypes.bool,
disableFontFace: PropTypes.bool,
disableRange: PropTypes.bool,
disableStream: PropTypes.bool,
docBaseUrl: PropTypes.string,
enableXfa: PropTypes.bool,
filterFactory: PropTypes.any,
fontExtraProperties: PropTypes.bool,
httpHeaders: PropTypes.object,
isEvalSupported: PropTypes.bool,
isOffscreenCanvasSupported: PropTypes.bool,
length: PropTypes.number,
maxImageSize: PropTypes.number,
ownerDocument: PropTypes.any,
password: PropTypes.string,
pdfBug: PropTypes.bool,
rangeChunkSize: PropTypes.number,
StandardFontDataFactory: PropTypes.any,
standardFontDataUrl: PropTypes.string,
stopAtErrors: PropTypes.bool,
useSystemFonts: PropTypes.bool,
useWorkerFetch: PropTypes.bool,
verbosity: PropTypes.number,
withCredentials: PropTypes.bool,
worker: PropTypes.any,
}),
rotate: PropTypes.number,
};
24 changes: 16 additions & 8 deletions src/shared/types.ts
Original file line number Diff line number Diff line change
@@ -4,11 +4,20 @@ import type {
PDFPageProxy,
PasswordResponses,
} from 'pdfjs-dist';

import type { BinaryData, RefProxy, TextContent, TextItem } from 'pdfjs-dist/types/src/display/api';
import type {
BinaryData,
DocumentInitParameters,
RefProxy,
TextContent,
TextItem,
} from 'pdfjs-dist/types/src/display/api';
import type { AnnotationLayerParameters } from 'pdfjs-dist/types/src/display/annotation_layer';
import type LinkService from '../LinkService';

type NullableObject<T extends object> = { [P in keyof T]: T[P] | null };

type KeyOfUnion<T> = T extends unknown ? keyof T : never;

/* Primitive types */
export type Annotations = AnnotationLayerParameters['annotations'];

@@ -106,12 +115,11 @@ export type OnRenderTextLayerSuccess = () => void;

export type PasswordResponse = (typeof PasswordResponses)[keyof typeof PasswordResponses];

export type Options = {
cMapPacked?: boolean | null;
cMapUrl?: string | null;
httpHeaders?: object | null;
standardFontDataUrl?: string | null;
withCredentials?: boolean | null;
export type Options = NullableObject<
Omit<DocumentInitParameters, KeyOfUnion<Source> | 'canvasMaxAreaInBytes'>
> & {
// See https://github.com/mozilla/pdf.js/issues/16503
canvasMaxAreaInBytes?: number | null;
};

/* Context types */