Skip to content

checkersoftware/embed-pdf-viewer

 
 

Repository files navigation

For DiffChecker PDFium Build

So this is basically us 'stealing' an entire open source project just to build PDFium for DiffChecker.

To build, just navigate to the packages/pdfium directory and run make build. The pdfium.js and .wasm files will be in docker/dist.

Other Info:

Compared to the repo we forked off of, this repo also includes the methods and functions we want to export in the txt files (which were previously hidden by .gitignore).

Runtime methods

Taken directly from our fork of pdfium-lib; the old build process, in the wasm.py file.

Functions

This is more complicated to find, but in pdfium-lib, the Python build script would read from an XML file and put essentially all the tags that contain functions names as exported functions. I'm 100% sure there are much better ways of getting this list of functions.

  • We filtered it down slightly to the relevant functions for our uses. Most likely doesn't save much space if at all; I believe it only affects the .js export size.
  • Refer to Diffchecker repo's PR history for scripts to parse our code for this information.
  • That basically just means you'll have to figure out yourself what functions to export for the build. The easiest method is to just include everything in the list below.

To add a function to the build, add the name to the exported-functions.txt file.

The full list of these functions from searching the XML
Text='FPDFAnnot_IsSupportedSubtype'
Text='FPDFPage_CreateAnnot'
Text='FPDFPage_GetAnnotCount'
Text='FPDFPage_GetAnnot'
Text='FPDFPage_GetAnnotIndex'
Text='FPDFPage_CloseAnnot'
Text='FPDFPage_RemoveAnnot'
Text='FPDFAnnot_GetSubtype'
Text='FPDFAnnot_IsObjectSupportedSubtype'
Text='FPDFAnnot_UpdateObject'
Text='FPDFAnnot_AddInkStroke'
Text='FPDFAnnot_RemoveInkList'
Text='FPDFAnnot_AppendObject'
Text='FPDFAnnot_GetObjectCount'
Text='FPDFAnnot_GetObject'
Text='FPDFAnnot_RemoveObject'
Text='FPDFAnnot_SetColor'
Text='FPDFAnnot_GetColor'
Text='FPDFAnnot_HasAttachmentPoints'
Text='FPDFAnnot_SetAttachmentPoints'
Text='FPDFAnnot_AppendAttachmentPoints'
Text='FPDFAnnot_CountAttachmentPoints'
Text='FPDFAnnot_GetAttachmentPoints'
Text='FPDFAnnot_SetRect'
Text='FPDFAnnot_GetRect'
Text='FPDFAnnot_GetVertices'
Text='FPDFAnnot_GetInkListCount'
Text='FPDFAnnot_GetInkListPath'
Text='FPDFAnnot_GetLine'
Text='FPDFAnnot_SetBorder'
Text='FPDFAnnot_GetBorder'
Text='FPDFAnnot_GetFormAdditionalActionJavaScript'
Text='FPDFAnnot_HasKey'
Text='FPDFAnnot_GetValueType'
Text='FPDFAnnot_SetStringValue'
Text='FPDFAnnot_GetStringValue'
Text='FPDFAnnot_GetNumberValue'
Text='FPDFAnnot_SetAP'
Text='FPDFAnnot_GetAP'
Text='FPDFAnnot_GetLinkedAnnot'
Text='FPDFAnnot_GetFlags'
Text='FPDFAnnot_SetFlags'
Text='FPDFAnnot_GetFormFieldFlags'
Text='FPDFAnnot_GetFormFieldAtPoint'
Text='FPDFAnnot_GetFormFieldName'
Text='FPDFAnnot_GetFormFieldAlternateName'
Text='FPDFAnnot_GetFormFieldType'
Text='FPDFAnnot_GetFormFieldValue'
Text='FPDFAnnot_GetOptionCount'
Text='FPDFAnnot_GetOptionLabel'
Text='FPDFAnnot_IsOptionSelected'
Text='FPDFAnnot_GetFontSize'
Text='FPDFAnnot_GetFontColor'
Text='FPDFAnnot_IsChecked'
Text='FPDFAnnot_SetFocusableSubtypes'
Text='FPDFAnnot_GetFocusableSubtypesCount'
Text='FPDFAnnot_GetFocusableSubtypes'
Text='FPDFAnnot_GetLink'
Text='FPDFAnnot_GetFormControlCount'
Text='FPDFAnnot_GetFormControlIndex'
Text='FPDFAnnot_GetFormFieldExportValue'
Text='FPDFAnnot_SetURI'
Text='FPDFAnnot_GetFileAttachment'
Text='FPDFAnnot_AddFileAttachment'
Text='FPDFDoc_GetAttachmentCount'
Text='FPDFDoc_AddAttachment'
Text='FPDFDoc_GetAttachment'
Text='FPDFDoc_DeleteAttachment'
Text='FPDFAttachment_GetName'
Text='FPDFAttachment_HasKey'
Text='FPDFAttachment_GetValueType'
Text='FPDFAttachment_SetStringValue'
Text='FPDFAttachment_GetStringValue'
Text='FPDFAttachment_SetFile'
Text='FPDFAttachment_GetFile'
Text='FPDFCatalog_IsTagged'
Text='FPDFCatalog_SetLanguage'
Text='FPDFAvail_Create'
Text='FPDFAvail_Destroy'
Text='FPDFAvail_IsDocAvail'
Text='FPDFAvail_GetDocument'
Text='FPDFAvail_GetFirstPageNum'
Text='FPDFAvail_IsPageAvail'
Text='FPDFAvail_IsFormAvail'
Text='FPDFAvail_IsLinearized'
Text='FPDFBookmark_GetFirstChild'
Text='FPDFBookmark_GetNextSibling'
Text='FPDFBookmark_GetTitle'
Text='FPDFBookmark_GetCount'
Text='FPDFBookmark_Find'
Text='FPDFBookmark_GetDest'
Text='FPDFBookmark_GetAction'
Text='FPDFAction_GetType'
Text='FPDFAction_GetDest'
Text='FPDFAction_GetFilePath'
Text='FPDFAction_GetURIPath'
Text='FPDFDest_GetDestPageIndex'
Text='FPDFDest_GetView'
Text='FPDFDest_GetLocationInPage'
Text='FPDFLink_GetLinkAtPoint'
Text='FPDFLink_GetLinkZOrderAtPoint'
Text='FPDFLink_GetDest'
Text='FPDFLink_GetAction'
Text='FPDFLink_Enumerate'
Text='FPDFLink_GetAnnot'
Text='FPDFLink_GetAnnotRect'
Text='FPDFLink_CountQuadPoints'
Text='FPDFLink_GetQuadPoints'
Text='FPDF_GetPageAAction'
Text='FPDF_GetFileIdentifier'
Text='FPDF_GetMetaText'
Text='FPDF_GetPageLabel'
Text='FPDF_CreateNewDocument'
Text='FPDFPage_New'
Text='FPDFPage_Delete'
Text='FPDF_MovePages'
Text='FPDFPage_GetRotation'
Text='FPDFPage_SetRotation'
Text='FPDFPage_InsertObject'
Text='FPDFPage_RemoveObject'
Text='FPDFPage_CountObjects'
Text='FPDFPage_GetObject'
Text='FPDFPage_HasTransparency'
Text='FPDFPage_GenerateContent'
Text='FPDFPageObj_Destroy'
Text='FPDFPageObj_HasTransparency'
Text='FPDFPageObj_GetType'
Text='FPDFPageObj_GetIsActive'
Text='FPDFPageObj_SetIsActive'
Text='FPDFPageObj_Transform'
Text='FPDFPageObj_TransformF'
Text='FPDFPageObj_GetMatrix'
Text='FPDFPageObj_SetMatrix'
Text='FPDFPage_TransformAnnots'
Text='FPDFPageObj_NewImageObj'
Text='FPDFPageObj_GetMarkedContentID'
Text='FPDFPageObj_CountMarks'
Text='FPDFPageObj_GetMark'
Text='FPDFPageObj_AddMark'
Text='FPDFPageObj_RemoveMark'
Text='FPDFPageObjMark_GetName'
Text='FPDFPageObjMark_CountParams'
Text='FPDFPageObjMark_GetParamKey'
Text='FPDFPageObjMark_GetParamValueType'
Text='FPDFPageObjMark_GetParamIntValue'
Text='FPDFPageObjMark_GetParamStringValue'
Text='FPDFPageObjMark_GetParamBlobValue'
Text='FPDFPageObjMark_SetIntParam'
Text='FPDFPageObjMark_SetStringParam'
Text='FPDFPageObjMark_SetBlobParam'
Text='FPDFPageObjMark_RemoveParam'
Text='FPDFImageObj_LoadJpegFile'
Text='FPDFImageObj_LoadJpegFileInline'
Text='FPDFImageObj_SetMatrix'
Text='FPDFImageObj_SetBitmap'
Text='FPDFImageObj_GetBitmap'
Text='FPDFImageObj_GetRenderedBitmap'
Text='FPDFImageObj_GetImageDataDecoded'
Text='FPDFImageObj_GetImageDataRaw'
Text='FPDFImageObj_GetImageFilterCount'
Text='FPDFImageObj_GetImageFilter'
Text='FPDFImageObj_GetImageMetadata'
Text='FPDFImageObj_GetImagePixelSize'
Text='FPDFImageObj_GetIccProfileDataDecoded'
Text='FPDFPageObj_CreateNewPath'
Text='FPDFPageObj_CreateNewRect'
Text='FPDFPageObj_GetBounds'
Text='FPDFPageObj_GetRotatedBounds'
Text='FPDFPageObj_SetBlendMode'
Text='FPDFPageObj_SetStrokeColor'
Text='FPDFPageObj_GetStrokeColor'
Text='FPDFPageObj_SetStrokeWidth'
Text='FPDFPageObj_GetStrokeWidth'
Text='FPDFPageObj_GetLineJoin'
Text='FPDFPageObj_SetLineJoin'
Text='FPDFPageObj_GetLineCap'
Text='FPDFPageObj_SetLineCap'
Text='FPDFPageObj_SetFillColor'
Text='FPDFPageObj_GetFillColor'
Text='FPDFPageObj_GetDashPhase'
Text='FPDFPageObj_SetDashPhase'
Text='FPDFPageObj_GetDashCount'
Text='FPDFPageObj_GetDashArray'
Text='FPDFPageObj_SetDashArray'
Text='FPDFPath_CountSegments'
Text='FPDFPath_GetPathSegment'
Text='FPDFPathSegment_GetPoint'
Text='FPDFPathSegment_GetType'
Text='FPDFPathSegment_GetClose'
Text='FPDFPath_MoveTo'
Text='FPDFPath_LineTo'
Text='FPDFPath_BezierTo'
Text='FPDFPath_Close'
Text='FPDFPath_SetDrawMode'
Text='FPDFPath_GetDrawMode'
Text='FPDFPageObj_NewTextObj'
Text='FPDFText_SetText'
Text='FPDFText_SetCharcodes'
Text='FPDFText_LoadFont'
Text='FPDFText_LoadStandardFont'
Text='FPDFText_LoadCidType2Font'
Text='FPDFTextObj_GetFontSize'
Text='FPDFFont_Close'
Text='FPDFPageObj_CreateTextObj'
Text='FPDFTextObj_GetTextRenderMode'
Text='FPDFTextObj_SetTextRenderMode'
Text='FPDFTextObj_GetText'
Text='FPDFTextObj_GetRenderedBitmap'
Text='FPDFTextObj_GetFont'
Text='FPDFFont_GetBaseFontName'
Text='FPDFFont_GetFamilyName'
Text='FPDFFont_GetFontData'
Text='FPDFFont_GetIsEmbedded'
Text='FPDFFont_GetFlags'
Text='FPDFFont_GetWeight'
Text='FPDFFont_GetItalicAngle'
Text='FPDFFont_GetAscent'
Text='FPDFFont_GetDescent'
Text='FPDFFont_GetGlyphWidth'
Text='FPDFFont_GetGlyphPath'
Text='FPDFGlyphPath_CountGlyphSegments'
Text='FPDFGlyphPath_GetGlyphPathSegment'
Text='FPDFFormObj_CountObjects'
Text='FPDFFormObj_GetObject'
Text='FSDK_SetUnSpObjProcessHandler'
Text='FSDK_SetTimeFunction'
Text='FSDK_SetLocaltimeFunction'
Text='FPDFDoc_GetPageMode'
Text='FPDFPage_Flatten'
Text='FPDFDOC_InitFormFillEnvironment'
Text='FPDFDOC_ExitFormFillEnvironment'
Text='FORM_OnAfterLoadPage'
Text='FORM_OnBeforeClosePage'
Text='FORM_DoDocumentJSAction'
Text='FORM_DoDocumentOpenAction'
Text='FORM_DoDocumentAAction'
Text='FORM_DoPageAAction'
Text='FORM_OnMouseMove'
Text='FORM_OnMouseWheel'
Text='FORM_OnFocus'
Text='FORM_OnLButtonDown'
Text='FORM_OnRButtonDown'
Text='FORM_OnLButtonUp'
Text='FORM_OnRButtonUp'
Text='FORM_OnLButtonDoubleClick'
Text='FORM_OnKeyDown'
Text='FORM_OnKeyUp'
Text='FORM_OnChar'
Text='FORM_GetFocusedText'
Text='FORM_GetSelectedText'
Text='FORM_ReplaceAndKeepSelection'
Text='FORM_ReplaceSelection'
Text='FORM_SelectAllText'
Text='FORM_CanUndo'
Text='FORM_CanRedo'
Text='FORM_Undo'
Text='FORM_Redo'
Text='FORM_ForceToKillFocus'
Text='FORM_GetFocusedAnnot'
Text='FORM_SetFocusedAnnot'
Text='FPDFPage_HasFormFieldAtPoint'
Text='FPDFPage_FormFieldZOrderAtPoint'
Text='FPDF_SetFormFieldHighlightColor'
Text='FPDF_SetFormFieldHighlightAlpha'
Text='FPDF_RemoveFormFieldHighlight'
Text='FPDF_FFLDraw'
Text='FPDF_GetFormType'
Text='FORM_SetIndexSelected'
Text='FORM_IsIndexSelected'
Text='FPDF_LoadXFA'
Text='FPDFDoc_GetJavaScriptActionCount'
Text='FPDFDoc_GetJavaScriptAction'
Text='FPDFDoc_CloseJavaScriptAction'
Text='FPDFJavaScriptAction_GetName'
Text='FPDFJavaScriptAction_GetScript'
Text='FPDF_ImportPagesByIndex'
Text='FPDF_ImportPages'
Text='FPDF_ImportNPagesToOne'
Text='FPDF_NewXObjectFromPage'
Text='FPDF_CloseXObject'
Text='FPDF_NewFormObjectFromXObject'
Text='FPDF_CopyViewerPreferences'
Text='FPDF_RenderPageBitmapWithColorScheme_Start'
Text='FPDF_RenderPageBitmap_Start'
Text='FPDF_RenderPage_Continue'
Text='FPDF_RenderPage_Close'
Text='FPDF_SaveAsCopy'
Text='FPDF_SaveWithVersion'
Text='FPDFText_GetCharIndexFromTextIndex'
Text='FPDFText_GetTextIndexFromCharIndex'
Text='FPDF_GetSignatureCount'
Text='FPDF_GetSignatureObject'
Text='FPDFSignatureObj_GetContents'
Text='FPDFSignatureObj_GetByteRange'
Text='FPDFSignatureObj_GetSubFilter'
Text='FPDFSignatureObj_GetReason'
Text='FPDFSignatureObj_GetTime'
Text='FPDFSignatureObj_GetDocMDPPermission'
Text='FPDF_StructTree_GetForPage'
Text='FPDF_StructTree_Close'
Text='FPDF_StructTree_CountChildren'
Text='FPDF_StructTree_GetChildAtIndex'
Text='FPDF_StructElement_GetAltText'
Text='FPDF_StructElement_GetActualText'
Text='FPDF_StructElement_GetID'
Text='FPDF_StructElement_GetLang'
Text='FPDF_StructElement_GetStringAttribute'
Text='FPDF_StructElement_GetMarkedContentID'
Text='FPDF_StructElement_GetType'
Text='FPDF_StructElement_GetObjType'
Text='FPDF_StructElement_GetTitle'
Text='FPDF_StructElement_CountChildren'
Text='FPDF_StructElement_GetChildAtIndex'
Text='FPDF_StructElement_GetChildMarkedContentID'
Text='FPDF_StructElement_GetParent'
Text='FPDF_StructElement_GetAttributeCount'
Text='FPDF_StructElement_GetAttributeAtIndex'
Text='FPDF_StructElement_Attr_GetCount'
Text='FPDF_StructElement_Attr_GetName'
Text='FPDF_StructElement_Attr_GetValue'
Text='FPDF_StructElement_Attr_GetType'
Text='FPDF_StructElement_Attr_GetBooleanValue'
Text='FPDF_StructElement_Attr_GetNumberValue'
Text='FPDF_StructElement_Attr_GetStringValue'
Text='FPDF_StructElement_Attr_GetBlobValue'
Text='FPDF_StructElement_Attr_CountChildren'
Text='FPDF_StructElement_Attr_GetChildAtIndex'
Text='FPDF_StructElement_GetMarkedContentIdCount'
Text='FPDF_StructElement_GetMarkedContentIdAtIndex'
Text='FPDF_GetDefaultTTFMap'
Text='FPDF_GetDefaultTTFMapCount'
Text='FPDF_GetDefaultTTFMapEntry'
Text='FPDF_AddInstalledFont'
Text='FPDF_SetSystemFontInfo'
Text='FPDF_GetDefaultSystemFontInfo'
Text='FPDF_FreeDefaultSystemFontInfo'
Text='FPDFText_LoadPage'
Text='FPDFText_ClosePage'
Text='FPDFText_CountChars'
Text='FPDFText_GetUnicode'
Text='FPDFText_GetTextObject'
Text='FPDFText_IsGenerated'
Text='FPDFText_IsHyphen'
Text='FPDFText_HasUnicodeMapError'
Text='FPDFText_GetFontSize'
Text='FPDFText_GetFontInfo'
Text='FPDFText_GetFontWeight'
Text='FPDFText_GetFillColor'
Text='FPDFText_GetStrokeColor'
Text='FPDFText_GetCharAngle'
Text='FPDFText_GetCharBox'
Text='FPDFText_GetLooseCharBox'
Text='FPDFText_GetMatrix'
Text='FPDFText_GetCharOrigin'
Text='FPDFText_GetCharIndexAtPos'
Text='FPDFText_GetText'
Text='FPDFText_CountRects'
Text='FPDFText_GetRect'
Text='FPDFText_GetBoundedText'
Text='FPDFText_FindStart'
Text='FPDFText_FindNext'
Text='FPDFText_FindPrev'
Text='FPDFText_GetSchResultIndex'
Text='FPDFText_GetSchCount'
Text='FPDFText_FindClose'
Text='FPDFLink_LoadWebLinks'
Text='FPDFLink_CountWebLinks'
Text='FPDFLink_GetURL'
Text='FPDFLink_CountRects'
Text='FPDFLink_GetRect'
Text='FPDFLink_GetTextRange'
Text='FPDFLink_CloseWebLinks'
Text='FPDFPage_GetDecodedThumbnailData'
Text='FPDFPage_GetRawThumbnailData'
Text='FPDFPage_GetThumbnailAsBitmap'
Text='FPDFPage_SetMediaBox'
Text='FPDFPage_SetCropBox'
Text='FPDFPage_SetBleedBox'
Text='FPDFPage_SetTrimBox'
Text='FPDFPage_SetArtBox'
Text='FPDFPage_GetMediaBox'
Text='FPDFPage_GetCropBox'
Text='FPDFPage_GetBleedBox'
Text='FPDFPage_GetTrimBox'
Text='FPDFPage_GetArtBox'
Text='FPDFPage_TransFormWithClip'
Text='FPDFPageObj_TransformClipPath'
Text='FPDFPageObj_GetClipPath'
Text='FPDFClipPath_CountPaths'
Text='FPDFClipPath_CountPathSegments'
Text='FPDFClipPath_GetPathSegment'
Text='FPDF_CreateClipPath'
Text='FPDF_DestroyClipPath'
Text='FPDFPage_InsertClipPath'
Text='FPDF_InitLibraryWithConfig'
Text='FPDF_InitLibrary'
Text='FPDF_DestroyLibrary'
Text='FPDF_SetSandBoxPolicy'
Text='FPDF_LoadDocument'
Text='FPDF_LoadMemDocument'
Text='FPDF_LoadMemDocument64'
Text='FPDF_LoadCustomDocument'
Text='FPDF_GetFileVersion'
Text='FPDF_GetLastError'
Text='FPDF_DocumentHasValidCrossReferenceTable'
Text='FPDF_GetTrailerEnds'
Text='FPDF_GetDocPermissions'
Text='FPDF_GetDocUserPermissions'
Text='FPDF_GetSecurityHandlerRevision'
Text='FPDF_GetPageCount'
Text='FPDF_LoadPage'
Text='FPDF_GetPageWidthF'
Text='FPDF_GetPageWidth'
Text='FPDF_GetPageHeightF'
Text='FPDF_GetPageHeight'
Text='FPDF_GetPageBoundingBox'
Text='FPDF_GetPageSizeByIndexF'
Text='FPDF_GetPageSizeByIndex'
Text='FPDF_RenderPageBitmap'
Text='FPDF_RenderPageBitmapWithMatrix'
Text='FPDF_ClosePage'
Text='FPDF_CloseDocument'
Text='FPDF_DeviceToPage'
Text='FPDF_PageToDevice'
Text='FPDFBitmap_Create'
Text='FPDFBitmap_CreateEx'
Text='FPDFBitmap_GetFormat'
Text='FPDFBitmap_FillRect'
Text='FPDFBitmap_GetBuffer'
Text='FPDFBitmap_GetWidth'
Text='FPDFBitmap_GetHeight'
Text='FPDFBitmap_GetStride'
Text='FPDFBitmap_Destroy'
Text='FPDF_VIEWERREF_GetPrintScaling'
Text='FPDF_VIEWERREF_GetNumCopies'
Text='FPDF_VIEWERREF_GetPrintPageRange'
Text='FPDF_VIEWERREF_GetPrintPageRangeCount'
Text='FPDF_VIEWERREF_GetPrintPageRangeElement'
Text='FPDF_VIEWERREF_GetDuplex'
Text='FPDF_VIEWERREF_GetName'
Text='FPDF_CountNamedDests'
Text='FPDF_GetNamedDestByName'
Text='FPDF_GetNamedDest'
Text='FPDF_GetXFAPacketCount'
Text='FPDF_GetXFAPacketName'
Text='FPDF_GetXFAPacketContent'

EmbedPDF logo

EmbedPDF

License Join the community on GitHub Live demo

Open‑Source JavaScript PDF Viewer

EmbedPDF is a framework‑agnostic, MIT‑licensed PDF viewer that drops into any JavaScript project. Whether you build with React, Vue, Svelte, Preact, or vanilla JS, EmbedPDF delivers a smooth, modern reading experience and a clean developer API.


📚 Documentation

The full documentation —including installation guides, API reference, and framework‑specific examples—is hosted on our website:

👉 https://www.embedpdf.com

Tip: Bookmark the docs to stay up‑to‑date with the latest features and release notes.

🚀 Live Demo

Curious how it feels? Open the playground and drop any PDF to test drive EmbedPDF in your browser:

👉 https://snippet.embedpdf.com


✨ Features

  • Smooth, virtualized scrolling for lightning‑fast navigation through large documents
  • Zoom & pan with mouse wheel, pinch, or programmatic control
  • Outline / bookmarks & thumbnail sidebar out‑of‑the‑box
  • Text search with highlighted results
  • Pluggable architecture—extend or replace UI components without forking
  • Tiny core + tree‑shakable plugins: pull in only what you need
  • TypeScript first: full types for a friction‑free DX

🤝 Contributing

We love contributions! To get started, read our contributing guide and jump into the GitHub discussions.

📄 License

This project is licensed under the MIT License. See the LICENSE file for details.

About

A PDF viewer that seamlessly integrates with any JavaScript project

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • TypeScript 80.5%
  • JavaScript 12.9%
  • MDX 5.4%
  • CSS 0.6%
  • C++ 0.2%
  • Dockerfile 0.2%
  • Other 0.2%