Click here to Skip to main content
15,894,343 members

Comments by Gary SC59 (Top 3 by date)

Gary SC59 7-Dec-23 19:22pm View    
I am accepting your solution because your comment pointed me in the right direction, even if the specifics were a bit different. Thanks for the input.
Gary SC59 7-Dec-23 19:20pm View    
UPDATE: I was approaching it the wrong way. The Base64 string I have merely needs to be decoded back to a file, not an image or a pdf. I stripped away the header "data:application/pdf;base64," and then I was able to convert the remaining base64 string to a file on the hard drive using System.IO.File. I was making it more difficult than it needed to be.
Gary SC59 7-Dec-23 19:17pm View    
Thank You for replying.
Yes, I have tried that. In order to get the byte[] array object to accept the string I have to remove the "data:application/pdf,Base64," header from the string (which comes that way from an SQL table), otherwise I get an error about non-Base64 characters in the string. But then I never get an image to show up in the pdf body. I opened the pdf in Acrobat and it did show me a big square that looked like a sea of QR codes all pasted together where the image was supposed to be, nothing recognizable as an image. So it's putting something there, but browsers and FoxIt apparently will not render it. I was surprised to see Acrobat show it to me at all.

It is apparently putting something there, but it is not recognized as an image.

I am trying to use iText7, since itextsharp is deprecated and no longer recommended.

using System directives do not have any methods for working with pdf as far as I can tell.