pdfjs-serverless 0.4.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/README.md +10 -3
  2. package/dist/index.mjs +1 -1
  3. package/dist/types/src/display/api.d.ts +8 -7
  4. package/dist/types/src/display/display_utils.d.ts +3 -2
  5. package/dist/types/src/display/draw_layer.d.ts +40 -0
  6. package/dist/types/src/display/editor/alt_text.d.ts +21 -0
  7. package/dist/types/src/display/editor/annotation_editor_layer.d.ts +23 -2
  8. package/dist/types/src/display/editor/color_picker.d.ts +19 -0
  9. package/dist/types/src/display/editor/editor.d.ts +29 -15
  10. package/dist/types/src/display/editor/highlight.d.ts +54 -0
  11. package/dist/types/src/display/editor/ink.d.ts +3 -3
  12. package/dist/types/src/display/editor/outliner.d.ts +26 -0
  13. package/dist/types/src/display/editor/toolbar.d.ts +11 -0
  14. package/dist/types/src/display/editor/tools.d.ts +3 -1
  15. package/dist/types/src/pdf.d.ts +5 -1
  16. package/dist/types/src/shared/util.d.ts +5 -1
  17. package/dist/types/web/annotation_editor_layer_builder.d.ts +4 -0
  18. package/dist/types/web/draw_layer_builder.d.ts +23 -0
  19. package/dist/types/web/genericl10n.d.ts +3 -3
  20. package/dist/types/web/interfaces.d.ts +3 -3
  21. package/dist/types/web/l10n.d.ts +4 -2
  22. package/dist/types/web/pdf_link_service.d.ts +5 -5
  23. package/dist/types/web/pdf_page_view.d.ts +2 -1
  24. package/dist/types/web/pdf_scripting_manager.d.ts +6 -6
  25. package/dist/types/web/pdf_single_page_viewer.d.ts +2 -2
  26. package/dist/types/web/pdf_thumbnail_view.d.ts +1 -1
  27. package/dist/types/web/pdf_thumbnail_viewer.d.ts +1 -1
  28. package/dist/types/web/pdf_viewer.d.ts +52 -13
  29. package/dist/types/web/ui_utils.d.ts +1 -1
  30. package/package.json +12 -12
package/README.md CHANGED
@@ -33,6 +33,7 @@ declare function resolvePDFJS(): Promise<typeof PDFJS>
33
33
  So, instead of importing the named exports directly:
34
34
 
35
35
  ```ts
36
+ // This will NOT work at the moment
36
37
  import { getDocument } from 'pdfjs-serverless'
37
38
  ```
38
39
 
@@ -45,7 +46,7 @@ const { getDocument } = await resolvePDFJS()
45
46
  ```
46
47
 
47
48
  > [!NOTE]
48
- > Once Cloudflare workers support top-level await, we can remove this wrapper and pass all named exports directly again.
49
+ > Once Cloudflare workers support top-level await, we can remove this wrapper and re-export all PDF.js named exports directly again.
49
50
 
50
51
  ### 🦕 Deno
51
52
 
@@ -55,7 +56,10 @@ import { resolvePDFJS } from 'https://esm.sh/pdfjs-serverless'
55
56
  // Initialize PDF.js
56
57
  const { getDocument } = await resolvePDFJS()
57
58
  const data = Deno.readFileSync('sample.pdf')
58
- const doc = await getDocument(data).promise
59
+ const doc = await getDocument({
60
+ data,
61
+ useSystemFonts: true,
62
+ }).promise
59
63
 
60
64
  console.log(await doc.getMetadata())
61
65
 
@@ -86,7 +90,10 @@ async function handleRequest(request) {
86
90
 
87
91
  // Initialize PDF.js
88
92
  const { getDocument } = await resolvePDFJS()
89
- const doc = await getDocument(data).promise
93
+ const doc = await getDocument({
94
+ data,
95
+ useSystemFonts: true,
96
+ }).promise
90
97
 
91
98
  // Get metadata and initialize output object
92
99
  const metadata = await doc.getMetadata()