Receiving Invalid PDF Structure message when converting base64 to blob

Which product are you using?
express plus

PDF.js Express Version
8.7.0

Detailed description of issue
I am trying to load a document from base64 string. I am converting it to a blob but when the document loads I receive an error on the viewer saying " ERROR. Invalid PDF Structure" I am following the documentation and need help deciphering what I am missing.

Expected behaviour
I expect to receive a base64 image string, covert it to a blob, and be able to see it in the pdf viewer

Does your issue happen with every document, or just one?
every document

function base64ToBlob(base64) {
  const parts = base64.split(';base64,')
  const decodedData = window.atob(parts[1]);
  const bytes = new Uint8Array(decodedData.length);
  for (let i = 0; i < decodedData.length; ++i) {
    bytes[i] = decodedData.charCodeAt(i);
    }

  return new Blob([bytes], { type: 'application/pdf' });
};

export const PdfViewer = () => {
 const viewer = useRef(null)
 const sampleImage = '"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4
  //8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=="'
 const imageBlob = base64ToBlob(sampleImage);
  useEffect(() => {
      WebViewer({
       path: '/webviewer/lib'
      },
       viewer.current
      )
        .then(instance => {
          instance.UI.loadDocument(imageBlob, { filename: 'myfile.pdf' });
      
          const { documentViewer } = instance.Core;
          documentViewer.addEventListener('documentLoaded', () => {
            // perform document operations
          });
        });
 }, []);
}

Hi @jessi.0157,

Looks like that string has two different quote styles in it. Please use just one.

Best Regards,
Zach Serviss
Platform Support Engineer

That was a typo while writing the question. Original code does not contain two quote types.

Can you please share the proper string?

Best Regards,
Zach Serviss
Platform Support Engineer

 const sampleImage = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4
  //8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==';

Thank you.

I think the problem here is that the data type is image, it should be application/pdf.

Best Regards,
Zach Serviss
Platform Support Engineer