We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Exception"An item with same key has already been added" using Aspose.PDF for .NET

I am using latest version of Aspose.PDF. I am trying to convert the attached PDF file to Html. It throws error while saving the doc as html. The code I am using is given below:

PdfFileEditor pdfEditor = new PdfFileEditor();
MemoryStream[] pdfPageStreams = pdfEditor.SplitToPages(pdfStream);
for (int i = 0; i < pdfPageStreams.Length; i++)
{
	MemoryStream pdfPageStream = pdfPageStreams[i];
	string outFilePath = $"{guid}_{i}.html";
	using (Document doc = new Document(pdfPageStream))
	{
		doc.Save(outFilePath, new HtmlSaveOptions
				{
					FixedLayout = true,
					SplitIntoPages = false,
					RasterImagesSavingMode = RasterImagesSavingModes.AsEmbeddedPartsOfPngPageBackground,
					FontSavingMode = FontSavingModes.SaveInAllFormats,
					PartsEmbeddingMode = PartsEmbeddingModes.EmbedAllIntoHtml,
					LettersPositioningMethod = LettersPositioningMethods.UseEmUnitsAndCompensationOfRoundingErrorsInCss
				});
	}
}

sample.pdf (152.0 KB)
sample.pdf (152.0 KB)

Please resolve the issue at the earliest.

@Sri79,

Thanks for contacting support.

I have observed your issue and like to inform that I have created investigation ticket with ID PDFNET-47612 in our issue tracking system to investigate and resolve this issue as soon possible.

Its been few months. Any update on this?

@Sri79,

I regret to inform that issue is still unresolved. I request for your patience and we will share good news with you soon.