I have a binary data (not file path) of pdf file. I need to mail merge it into document.
How can I do it? Please help.
Hi
Thanks for your request. It is not quite clear for me what you would like to achieve. Could you please explain more specific? Do you need to convert PDF to Word or to insert PDF document into Word document as OLE embedded object?
Best regards.
Stream dstStream dstStream = new MemoryStream((byte[])dt.Rows[0]["BinaryPDF"]);
Now I need to mailmerge this pdf data into merge field of document. Please help.
Note: we purchased the total package of Aspose but it did not include PDF recognition. I downloaded recognition and used but it shows “Evaluation”.
Hi
Thanks for your request. I think you can try using the following code:
// Read PDF to stream
byte[] pdfBytes = File.ReadAllBytes(@"Test080\in.pdf");
MemoryStream pdfStream = new MemoryStream(pdfBytes);
// Create recognizer and open PDF from strem
Aspose.Recognition.PdfRecognizer recognizer = new Aspose.Recognition.PdfRecognizer(Aspose.Recognition.RecognitionMode.Flow);
recognizer.Open(pdfStream);
// Save recognized document into memorystream
MemoryStream docStream = new MemoryStream();
recognizer.Save(docStream, Aspose.Recognition.SaveFormat.Doc);
// Now we can create Aspose.Words.Document from stream and insert it at mergefield.
Document srcDoc = new Document(docStream);
// Open a template and create DocumentBuilder
Document doc = new Document(@"Test080\in.doc");
// Documentbuilder is needed to move cursor to the mergefield
DocumentBuilder builder = new DocumentBuilder(doc);
// Move cursor to mergefield
builder.MoveToMergeField("myfield");
// Insert Document
InsertDocument(builder.CurrentParagraph, srcDoc);
// Save output document
doc.Save(@"Test080\out.doc");
InsertDocument method you can find here:
https://docs.aspose.com/words/java/insert-and-append-documents/
I think you should consult with our sales team (in Aspose.Purchase forum) regarding Total license and ask why Aspose.Recognition is not included to Aspose.Total.
Best regards.