Hello Doris,
Thanks for your fast reply.
I've just tested it with the latest version, but I got the same error: Message: Object reference not set to an instance of an object.
I'm trying to merge two documents. That works OK, the document gets created without any issues, but when I try to convert it to PDF, it fails.
This is the merge code:
- Code: Select all
// Load the attachment
attachmentDoc.LoadFromFile(HostingEnvironment.MapPath($"~/output/temp.file"), FileFormat.Docx);
// add page break
doc.LastSection.Paragraphs[doc.LastSection.Paragraphs.Count - 1].AppendBreak(BreakType.PageBreak);
// Merge
foreach (Section sec in attachmentDoc.Sections)
{
doc.Sections.Add(sec.Clone());
}
This is the code from where I get the error afterward:
- Code: Select all
doc.SaveToFile(docxOutputPath, FileFormat.Docx); // Works OK
doc.SaveToFile(pdfOutputPath, FileFormat.PDF); // Fails
The only thing that I've found that makes the conversion break, are the shapes. If I remove them from the file (attached), it works.
Can you please check to see if you find the error?
Login to view the files attached to this post.