1_PDFsam_Law Practice and Procedure of Arbitration.pdf (170.5 KB)
Below is the code that we using. It producing exception only in this PDF.
Document doc = new Document(file);
//PDF optimization
doc.Optimize();
// Instantiate HTML Save options object
//HtmlSaveOptions newOptions = new HtmlSaveOptions();
// Enable option to embed all resources inside the HTML
//newOptions.PartsEmbeddingMode = HtmlSaveOptions.PartsEmbeddingModes.EmbedAllIntoHtml;
//newOptions.PartsEmbeddingMode = HtmlSaveOptions.PartsEmbeddingModes.EmbedCssOnly;
//newOptions.SplitIntoPages = false;
//newOptions.FixedLayout = true;
//This is just optimization for IE and can be omitted
//newOptions.LettersPositioningMethod = Aspose.Pdf.HtmlSaveOptions.LettersPositioningMethods.UseEmUnitsAndCompensationOfRoundingErrorsInCss;
//newOptions.RasterImagesSavingMode = HtmlSaveOptions.RasterImagesSavingModes.AsEmbeddedPartsOfPngPageBackground;
//newOptions.FontSavingMode = HtmlSaveOptions.FontSavingModes.SaveInAllFormats;
// Get the page at a particular index of the Page Collection
//Page pdfPage = doc.getPages().get_Item(1);
// Create a new Document object
//Document newDocument = new Document();
// Add the page to the Pages collection of new document object
//newDocument.getPages().add(pdfPage);
// Save the new file
//newDocument.save("page_" + pdfPage.getNumber() + ".pdf");
//doc.save("page3.htm", newOptions);
//string imagesDir = Path.GetDirectoryName(file) + @"\images";
// string svgimagesDir = Path.GetDirectoryName(file) + @"\svg";
//if (Directory.Exists(imagesDir)) { Directory.Delete(imagesDir, true); };
//Directory.CreateDirectory(imagesDir);
// if (Directory.Exists(svgimagesDir)) { Directory.Delete(svgimagesDir, true); };
// Directory.CreateDirectory(svgimagesDir);
// 3) Tune conversion options
HtmlSaveOptions options = new HtmlSaveOptions();
options.FixedLayout = true;
options.RasterImagesSavingMode = HtmlSaveOptions.RasterImagesSavingModes.AsPngImagesEmbeddedIntoSvg;
options.PartsEmbeddingMode = HtmlSaveOptions.PartsEmbeddingModes.NoEmbedding;
options.ExtractOcrSublayerOnly = true;
//This is just optimization for IE and can be omitted
options.LettersPositioningMethod = Aspose.Pdf.HtmlSaveOptions.LettersPositioningMethods.UseEmUnitsAndCompensationOfRoundingErrorsInCss;
// Split HTML output into pages
options.SplitIntoPages = true;
// Specify to render PDF document layers separately in output HTML
options.ConvertMarkedContentToLayers = true;
options.SaveShadowedTextsAsTransparentTexts = true;
options.SaveTransparentTexts = true;
// Split css into pages
options.SplitCssIntoPages = false;
// 3) Do conversion
doc.Save(Path.Combine(outputDir, Path.GetFileNameWithoutExtension(file.Replace(" ", "_")) + "_page.html"), options);