Thu Mar 14, 2024 9:11 am
I dont know how insert and image here, I was trying to insert an image to show the problem.
Let me try yo explain better:
Step 1) I have a Word document that I generate using the SpireDoc library, the document is generated well, and the header and footer images are placed correctly, so that they look a little transparent.
Step 2 ) Then I have a PDF document that I generate using the SpirePDF library, it generates fine.
Now I want to join both documents, the Word and the PDF, if I convert the WORD to PDF using the following method
using (MemoryStream ms3 = new())
{
try
{
Document document = new Document();
document.LoadFromStream(streamPDF, Spire.Doc.FileFormat.Docx);
document.SaveToStream(ms3, Spire.Doc.FileFormat.PDF);
var pdfToInsert = new PdfDocument(ms3);
return SaveData(pdfToInsert, pdfDocument, startIndex);
}
catch (Exception ex) { var a = ex.Message; }
}
return (pdfDocument, 0);
The resulting PDF document is well generated, only that the images of the footer and header look darker, they are no longer shown with the transparency that they appeared when it was a WORD.
Then I tried to convert the PDF from step 2 into a WORD, it converts fine but when I join it with the WORD from step 1, I am using the InsertTextFromStream method and then it generates a document in WORD where the PDF sheets take the WORD footers and headers.
I want that when I join the PDF from step 2, the PDF sheets do not take the footers or headers of the Word from step 1, which is with the document that I am inserting it.
I would like to have a WORD document with the union of the WORD and the PDF