I receive two PDFs, each as a byte array. So now I have 2 arrays, a[] and b[]. I concatenate them and save them to c[]. When I convert c[] to a PDF, only the 2nd file shows up. When I check the length of c[], it is len(a[]) + len(b[]).
I found other questions about this for different programming languages, and they say that I can't just concatenate them like this, we need to use a PDF authoring library. Since I receive byte arrays to begin with, is there anything else that could work in my situation?
You can't just concatenate the byte arrays.
You can find a couple of solutions for merging PDF files here How to merge two PDF files into one in Java?
If you have the PDF files, you can just use PDFMergerUtility of pdfbox.
If the PDF files are not available, you can just use the other solution with itext