Very Long time for conversion of PDF to HTML

HI Team,

I am trying to convert Pdf files to Html using Aspose.PDF but this conversion is taking so long for 13-20 mb files

I am trying to optimise the PDF files using following code…but PDF of 13 mb got optimised to 11 mb and for same task it took more then 1 minute.

This is the code I am using…

pdf.OptimizeResources(new Document.OptimizationOptions()
{
LinkDuplcateStreams = true,
RemoveUnusedObjects = true,
AllowReusePageContent = true,
RemoveUnusedStreams = true,
UnembedFonts = false,
CompressImages = true,
ImageQuality = 12,
ResizeImages = true
}

Please can you provide some solution to optimise PDF file to larger extent or reduce Conversion time…

@kotharib2

Thank you for contacting support.

Would you please share the source and generated PDF files with us via Google Drive, Dropbox etc so that we may try to reproduce and investigate it in our environment. Before sharing requested data, please ensure using Aspose.PDF for .NET 18.9.1 in your environment.

HI @Farhan.Raza

I am using 18.9.1,

Is there any other way to send document…because I am bounded with my client network and not allowed to send document via drive or dropbox

@kotharib2

We understand your data privacy concerns, so you may edit your very first post in this thread and make it a private topic which will only be visible to you and Aspose staff. We can also update the privacy for your thread if that satisfies you. Or alternatively, you may upload the files to any platform and then share the download link with me in a private message by clicking on my username and then message icon.

Hi @Farhan.Raza,

I am sending you the PDF File and HTML generated File from same pdf…This conversion took more then 8 minutes…can you please provide best way to reduce conversion timings

Drive Link:-
https://drive.google.com/drive/folders/1CO3YffXSxnvK5GmtIWtVr9N4FIfqS35P?usp=sharing

@kotharib2

Thank you for sharing requested data.

Please note there are hundreds of PNG and SVG images generated while rendering the PDF file to HTML so some time is consumed during this operation and other necessary operations. However, we have logged a ticket with ID PDFNET-45405 in our issue management system for further investigation and resolution. We will let you know as soon as some significant update will be available in this regard.

Hi @Farhan.Raza

I am sending you one PDF in which size of first page is different from all other pages…can you guide me to set pagesize of first page same as others.

Data (1).pdf (1.7 MB)

@kotharib2

Please always create separate topic for separate inquiry.

We have noticed that the size of pages is same in your PDF document. However, the contents of first page are comparatively smaller. Aspose.PDF for .NET API ResizeContents method which resizes all pages in a PDF document and not specific pages only. So you need to split your document and then delete first page from it. Resize first page and then concatenate that resized page with source document from which the page is deleted.

Below is a code snippet that implements suggested approach, you may concatenate final documents as explained over Concatenate PDF documents.

        Document document = new Document(dataDir + "Data (1).pdf");
        Document split = new Document();
        split.Pages.Add(document.Pages[1]);
        split.Save(dataDir + "ResizePage.pdf");

        // Create PdfFileEditor object
        PdfFileEditor pdfEditor = new PdfFileEditor();
        // Array of pages to delete
        int[] pagesToDelete = new int[] {1};
        //Delete page
        pdfEditor.Delete(dataDir + "Data (1).pdf", pagesToDelete, dataDir + "PagesUpdated_out.pdf");



        Document doc = new Document(dataDir + "ResizePage.pdf");
        var fileEditor = new Aspose.Pdf.Facades.PdfFileEditor();
        var parameters = new Aspose.Pdf.Facades.PdfFileEditor.ContentsResizeParameters(
            Aspose.Pdf.Facades.PdfFileEditor.ContentsResizeValue.Percents(-10),
            null,
            Aspose.Pdf.Facades.PdfFileEditor.ContentsResizeValue.Percents(-10),
            Aspose.Pdf.Facades.PdfFileEditor.ContentsResizeValue.Percents(-30),
            null,
            Aspose.Pdf.Facades.PdfFileEditor.ContentsResizeValue.Percents(-50)
            );

        fileEditor.ResizeContents(doc, parameters);
        doc.Save(dataDir + "Resize_18.9.1.pdf");

We hope this will be helpful. Please feel free to contact us if you need any further assistance.

The issues you have found earlier (filed as PDFNET-45405) have been fixed in Aspose.PDF for .NET 21.5.