Using Aspose PDF version 24.6.0
<PackageVersion Include="Aspose.Pdf" Version="24.6.0" />
Using .Net 8.0.302
test.zip (9.9 MB)
Using the PDF inside the ZIP file
public void FromPdf()
{
var sourcePath = "TestData/test.pdf";
using var document = new Document(File.OpenRead(sourcePath));
var output = new MemoryStream();
var options = new HtmlSaveOptions(HtmlDocumentType.Html5)
{
RasterImagesSavingMode = HtmlSaveOptions.RasterImagesSavingModes.AsEmbeddedPartsOfPngPageBackground,
PartsEmbeddingMode = HtmlSaveOptions.PartsEmbeddingModes.EmbedAllIntoHtml,
};
document.Save(output, options);
}
Error:
System.IO.IOException : Stream was too long.
at System.IO.MemoryStream.Write(ReadOnlySpan`1 buffer)
at System.IO.StreamWriter.Flush(Boolean flushStream, Boolean flushEncoder)
at System.IO.StreamWriter.Write(ReadOnlySpan`1 buffer)
at System.Xml.XmlTextEncoder.Write(ReadOnlySpan`1 text)
at System.Xml.XmlTextWriter.WriteString(String text)
at #=zlZRZ8k4rbMt5rkdY1M9kuvhuQEftV$bmSg==.#=zB2mcaro=(#=zdJ1BInqz1s8ewexlVzKCxx$8w1cQ #=zP4iLffY=, String #=zD3NRrrQ=)
at #=zaOuPY2S$kLzGSEyFCkr9VATNk1F5bvuDiA==.#=zB2mcaro=(#=zdJ1BInqz1s8ewexlVzKCxx$8w1cQ #=zP4iLffY=, String #=zD3NRrrQ=)
at #=zaOuPY2S$kLzGSEyFCkr9VATNk1F5bvuDiA==.#=zqpayHbnOZlKs(String #=z1ql8Y1M=, RectangleF #=zfgVWzdc=, String #=zhH4TCjg=, Nullable`1 #=z6urq_Ps=)
at #=zc_Et3jdb2PmT7$19CpheuLaRBRFJP1DX2g==.#=zpc$NZVq7Gg2s(#=zT3XfZjHdjoIRcPwKFr903wE= #=zEuuKCkNxr3ax, String #=zOEFQJgE=)
at #=zc_Et3jdb2PmT7$19CpheuLaRBRFJP1DX2g==.#=zpc$NZVq7Gg2s(#=zT3XfZjHdjoIRcPwKFr903wE= #=zEuuKCkNxr3ax, Dictionary`2 #=zWbRJ$CJ8B6Hd)
at #=z6npI2ag0BDl8t1HNLXiy8EvIguzstZWp1w==.#=z0LysSXQ=(#=zk$HG36KaKcuUNm531cn2cYXL3RsoqJ_yug== #=zCv0d5Fg=)
at #=ztYxUbbF6M2Jb8tsAoq6eEQFJlgOoEjCzaQ==.#=z0LysSXQ=(#=zk$HG36KaKcuUNm531cn2cYXL3RsoqJ_yug== #=zCv0d5Fg=)
at #=zCEOo$08uX2xpzDdq6JMllDZhOrAqSsiOHA==.#=z0LysSXQ=(#=zk$HG36KaKcuUNm531cn2cYXL3RsoqJ_yug== #=zCv0d5Fg=)
at #=zS_glje$znPoa01DgmAc3kwOqbmvC9$s2R0t8CVA=.#=zqtnKSZI=(IList`1 #=zbCNSfu1dqJmz, #=zk$HG36KaKcuUNm531cn2cYXL3RsoqJ_yug== #=zCv0d5Fg=, #=z5fLsnLvIIZvhB90imZMS39ty_ggSQ5UkjVn9les= #=zRR4mkcQ=)
at #=z8dTh0$vpG6EWweAsRNk39z$RMg1G.#=zqtnKSZI=(String #=zJRJbySQmZ55X, #=zU$LwWfECrGd1t2y0R9rqEj0goBf9_0dSuw== #=zRR4mkcQ=, IList`1 #=zbCNSfu1dqJmz, #=z25MsMA2AecUYAU7L_pyfVHNREuGM678Ju_i0B_8= #=zpBtKLdc=, #=z0zZrzzRqc11SlDb_96l0L0PIUf5q #=zM2hLIRlPlPOq)
at #=zD_kAuqk9z0Zs617zfA76Q8c=.#=zXvWYnXO_58UpmM2$Yg==(Document #=z5s7FhlA=, #=z_XulVZErxPgt #=zbCNSfu1dqJmz, String #=zqgSaC2KvzshNg0joJQ==, Stream #=zyf2kdnv_d6za, HtmlSaveOptions #=zRR4mkcQ=)
at #=zD_kAuqk9z0Zs617zfA76Q8c=.#=zG8imGb4=(Document #=z5s7FhlA=, String #=zqgSaC2KvzshNg0joJQ==, Stream #=zyf2kdnv_d6za, HtmlSaveOptions #=zRR4mkcQ=)
at Aspose.Pdf.Document.#=zDw3jK1COurbA(Stream #=zgUCURbktTRnA, SaveOptions #=zRR4mkcQ=)
at Aspose.Pdf.Document.#=zLC9J6YS6p5Pa(Stream #=z_72GXKC3Ybnl, SaveOptions #=zRR4mkcQ=)
at Aspose.Pdf.Document.Save(Stream outputStream, SaveOptions options)
at HtmlTests.FromPdf()