I've done this many times in vb.net and thought I had it working in Delphi but I'm stuck. I'm using Delphi 10.2.
I'm reading a PDF file into a memory stream and then converting it to a byte array so I can store it in an MS SQL file table.
I can't use TByteArray because most of the PDF's my client will deal with are far too large for the size limit of TByteArray.
What I have tried:
baDoc: array of byte;
msDoc := TMemoryStream.Create;
msDoc.LoadFromFile(fPath + fName + '.pdf');
SetLength seems to work fine. When I check the length of baDoc in a watch it's the same size as msDoc.
In the same batch of code I'm working on I'm also trying to pass baDoc to another form. I've set a public varibable in the other form to "array of byte" but that won't even compile. I get an "incompatible types" error.
In the other form:
ADocumentByteArray: array of byte;
And in the form that's doing the passing:
ADocumentByteArray := baDoc;
I guess that's 2 questions but they are sort of related. When I use TByteArray I can pass the value just fine between the 2 forms but again it doesn't have the capacity for my needs.
Hope someone can help!