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

Free Support Forum - aspose.com

Aspose PDF Out of Memory Problem

Hi ;

i have a problem "out of memory " when i want convert to pdf to html.

my code block is here :
string original_book_path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, “PDFs”, “Original_Files”, pBookId + “.pdf”);
string highlighted_image_path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, “PDFs”, “Book_Images”, pBookId, pPageNumber.ToString() + “.png”);
string highlighted_image_thumb_path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, “PDFs”, “Book_Images”, pBookId, “thumbs”, pPageNumber.ToString() + “.png”);
string temp_path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, “Temp”, Utilities.CreateGUID());
if (Directory.Exists(temp_path) == false)

            original_book = new Document(original_book_path);// original book file
            obj_pdf_info = new Aspose.Pdf.Facades.PdfFileInfo(original_book);

            lly = (int)(lly * obj_pdf_info.GetPageHeight(1)) / page_height;
            llx = (int)(llx * obj_pdf_info.GetPageWidth(1)) / page_width;
            ury = (int)(ury * obj_pdf_info.GetPageHeight(1)) / page_height;
            urx = (int)(urx * obj_pdf_info.GetPageWidth(1)) / page_width;

            //lly =(int) (lly * original_book.PageInfo.Height) / page_height;
            //llx= (int)(llx * original_book.PageInfo.Width) / page_width;

            //ury= (int)(ury * original_book.PageInfo.Height) / page_height;
            //urx = (int)(urx * original_book.PageInfo.Width) / page_width;

            //****************************************************Croppy Region Operation Start***************************************************************
            cropped_area = new Document();       // cropped area pdf

            Aspose.Pdf.Rectangle pageRect = new Aspose.Pdf.Rectangle(llx, lly, urx, ury);
            original_book.Pages[pPageNumber].CropBox = pageRect;

            //****************************************************Get Text of cropped pdf file such as question text***************************************************************
            Aspose.Pdf.Text.TextAbsorber absorber = new Aspose.Pdf.Text.TextAbsorber();
            absorber.TextSearchOptions.LimitToPageBounds = true;
            string content_text = absorber.Text;

            HtmlSaveOptions opt = new HtmlSaveOptions();
            opt.CompressSvgGraphicsIfAny = false;
            opt.AntialiasingProcessing = HtmlSaveOptions.AntialiasingProcessingType.TryCorrectResultHtml;
            opt.UseZOrder = true;
            cropped_area.Save(Path.Combine(Cropped_Folder_Path, "Output.html"), opt);
            //****************************************************Croppy Region Operation End***************************************************************

when procces come to “cropped_area.Save(Path.Combine(Cropped_Folder_Path, “Output.html”), opt);”
151.jpg (95.0 KB)
i was take a “Out of Memory” exception.
i will send problematic pdf page as image, because an error occured only specific pages.
MyAspose Version :


Thanks for contacting support.

We request you to please try your scenario using Aspose.PDF for .NET 18.10 which is latest version. Please note that you are using a quite old version of the API and it is strongly recommended to use latest version because it contains more fixes and enhancements. In case you face any issue while using latest version of the API, please share your sample PDF document with us so that we can test the scenario in our environment and address it accordingly.