I am trying to use Aspose.Words to combine two PDFs into a single document then export it as a PDF using the following code:
public static string CombinePDFs(List<string> base64PDFs)
{
var combinedDoc = new Document();
combinedDoc.RemoveAllChildren();
foreach(var base64PDF in base64PDFs)
{
byte[] pdfBytes = Convert.FromBase64String(base64PDF);
using (MemoryStream tempStream = new MemoryStream(pdfBytes))
{
var input = new Document(tempStream);
combinedDoc.AppendDocument(input, ImportFormatMode.KeepSourceFormatting);
}
}
using (MemoryStream ms = new MemoryStream())
{
combinedDoc.Save(ms, SaveFormat.Pdf);
var ba = ms.ToArray();
var retVal = Convert.ToBase64String(ba);
return retVal;
}
}
While this MOSTLY works, the PDFs include barcodes, and the barcodes are not rendered properly in the final document. Also the formatting is off a little bit which is a problem but not nearly as big of a deal as the barcodes. Is there something we can do to get these barcodes to come out right?