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

Free Support Forum - aspose.com

We are using ASPOSE and unable to unzip, view watermarks and view pdf files

We are using ASPOSE license to view pdf files, unzip a file and view watermarks on a file.
We are facing issues and errors while viewing these files.

We are using the following details

  1. Environment - Linux
  2. net core 3.1, c#
  3. Code that we are calling -
    var stripper = new PdfJavaScriptStripper();
    stripper.Strip(srcStream, dstStream);
    NEW1.pdf (2.0 KB)

Trace

Stack trace:

Request: POST /clean/pdf

  User: 

  Exception: System.Exception: The root object missing or invalid

     at #=q311qrwenFolnMievRmUg2x9dhCoSC7FNW1jMAX5lHbY=.#=zEwHJn3t5ZGpfzGRWBLNyYlQGJMMiJZhQpLFBVyY=(Object #=zX5nKl38=)

     at #=q311qrwenFolnMievRmUg2x9dhCoSC7FNW1jMAX5lHbY=.#=zZaPSulpSbkggGH70TLkrvfp3nSUGVt4$DsM22YM=(#=q311qrwenFolnMievRmUg2x9dhCoSC7FNW1jMAX5lHbY= #=zX5nKl38=, #=qMi4WIDoKgo3qlHdQL$cKRqA88pWh71n6$CDvyLwFkYY= #=zmVr7LIQ=)

     at #=q311qrwenFolnMievRmUg2x9dhCoSC7FNW1jMAX5lHbY=.#=zMUTBhOL6_6FKk1BKxBY50XKlf4QMM5uhXg==()

     at #=q311qrwenFolnMievRmUg2x9dhCoSC7FNW1jMAX5lHbY=.#=zXCmSsX91A9wVB81F8mPb6xcd9BCGc_$1PkDSQqo=(Boolean #=zX5nKl38=)

     at #=q311qrwenFolnMievRmUg2x9dhCoSC7FNW1jMAX5lHbY=.#=zEwHJn3t5ZGpfzGRWBLNyYlQGJMMiJZhQpLFBVyY=(Object #=zX5nKl38=)

     at #=q311qrwenFolnMievRmUg2x9dhCoSC7FNW1jMAX5lHbY=.#=zXDbFIDlAYZKSSf6x3L$gccvzgnQspdJNrVMb7_s=()

     at #=q311qrwenFolnMievRmUg2x9dhCoSC7FNW1jMAX5lHbY=.#=zSoouLHrOq4$6K3CQ6geraPWB7yPvOeEmPVIsMiZ3m5Hm(Object #=zX5nKl38=, UInt32 #=zmVr7LIQ=)

     at #=q311qrwenFolnMievRmUg2x9dhCoSC7FNW1jMAX5lHbY=.#=zXCmSsX91A9wVB81F8mPb6xcd9BCGc_$1PkDSQqo=(Boolean #=zX5nKl38=)

     at #=q311qrwenFolnMievRmUg2x9dhCoSC7FNW1jMAX5lHbY=.#=zXCmSsX91A9wVB81F8mPb6xcd9BCGc_$1PkDSQqo=(Boolean #=zX5nKl38=)

     at #=q311qrwenFolnMievRmUg2x9dhCoSC7FNW1jMAX5lHbY=.#=zM7OyK7rqEAIb7KSZ_NOm90s=()

     at #=q311qrwenFolnMievRmUg2x9dhCoSC7FNW1jMAX5lHbY=.#=zfHrjQohU1gCR2c830LhJofC4F15BMBh$1w==(Object[] #=zX5nKl38=, Type[] #=zmVr7LIQ=, Type[] #=zNjmogpc=, Object[] #=ziBeFMlc=)

     at #=q311qrwenFolnMievRmUg2x9dhCoSC7FNW1jMAX5lHbY=.#=zqL5upDZEIQ4behKYykBo7mAXq8nr(Stream #=zX5nKl38=, Int32 #=zmVr7LIQ=, Object[] #=zNjmogpc=, Type[] #=ziBeFMlc=, Type[] #=z70K3bOY=, Object[] #=z1rJOARE=)

     at #=q311qrwenFolnMievRmUg2x9dhCoSC7FNW1jMAX5lHbY=.#=zFfNPH4UdVgZtYz_ybM8aRS8=(Int32 #=zX5nKl38=, Type[] #=zmVr7LIQ=, Type[] #=zNjmogpc=, Boolean #=ziBeFMlc=)

     at #=q311qrwenFolnMievRmUg2x9dhCoSC7FNW1jMAX5lHbY=.#=zMUTBhOL6_6FKk1BKxBY50XKlf4QMM5uhXg==()

     at #=q311qrwenFolnMievRmUg2x9dhCoSC7FNW1jMAX5lHbY=.#=zXCmSsX91A9wVB81F8mPb6xcd9BCGc_$1PkDSQqo=(Boolean #=zX5nKl38=)

     at #=q311qrwenFolnMievRmUg2x9dhCoSC7FNW1jMAX5lHbY=.#=zEwHJn3t5ZGpfzGRWBLNyYlQGJMMiJZhQpLFBVyY=(Object #=zX5nKl38=)

     at #=q311qrwenFolnMievRmUg2x9dhCoSC7FNW1jMAX5lHbY=.#=zXDbFIDlAYZKSSf6x3L$gccvzgnQspdJNrVMb7_s=()

     at #=q311qrwenFolnMievRmUg2x9dhCoSC7FNW1jMAX5lHbY=.#=zSoouLHrOq4$6K3CQ6geraPWB7yPvOeEmPVIsMiZ3m5Hm(Object #=zX5nKl38=, UInt32 #=zmVr7LIQ=)

     at #=q311qrwenFolnMievRmUg2x9dhCoSC7FNW1jMAX5lHbY=.#=zXCmSsX91A9wVB81F8mPb6xcd9BCGc_$1PkDSQqo=(Boolean #=zX5nKl38=)

     at #=q311qrwenFolnMievRmUg2x9dhCoSC7FNW1jMAX5lHbY=.#=zM7OyK7rqEAIb7KSZ_NOm90s=()

     at #=q311qrwenFolnMievRmUg2x9dhCoSC7FNW1jMAX5lHbY=.#=zfHrjQohU1gCR2c830LhJofC4F15BMBh$1w==(Object[] #=zX5nKl38=, Type[] #=zmVr7LIQ=, Type[] #=zNjmogpc=, Object[] #=ziBeFMlc=)

     at #=q311qrwenFolnMievRmUg2x9dhCoSC7FNW1jMAX5lHbY=.#=z5t7fImqhwUE11AnBR9Onik83yqAOnTiBzQ==(Stream #=zX5nKl38=, String #=zmVr7LIQ=, Object[] #=zNjmogpc=, Type[] #=ziBeFMlc=, Type[] #=z70K3bOY=, Object[] #=z1rJOARE=)

     at #=q311qrwenFolnMievRmUg2x9dhCoSC7FNW1jMAX5lHbY=.#=zIqHDP9oIdf5h9hHLv9wcP92EcbSOZLgr1w==(Stream #=zX5nKl38=, String #=zmVr7LIQ=, Object[] #=zNjmogpc=)

     at #=q311qrwenFolnMievRmUg2x9dhCoSC7FNW1jMAX5lHbY=.#=z0tE8Ye5BLRDhK2hw74g6JHOe3s9U$iRSc5UYqCi5Movz(Stream #=zX5nKl38=, String #=zmVr7LIQ=, Object[] #=zNjmogpc=)

     at #=ztbI98D3PO5f$Mdhi2bmH9kWRJpynyT98Vg==.#=z1mYFAxCOlAWa(String #=zhBw7Yrk=, Boolean #=zj3olUu4mcdd2, StringBuilder #=znwzdOKo=, #=zzxHSk8pkItNMreRtyfkouEgvJbMDibWmk1lu0jg= #=zttKwk98=)

     at #=ztbI98D3PO5f$Mdhi2bmH9kWRJpynyT98Vg==..ctor(Stream #=zPTRy0vU=, String #=zhBw7Yrk=, Boolean #=zj3olUu4mcdd2)

     at #=ztbI98D3PO5f$Mdhi2bmH9kWRJpynyT98Vg==..ctor(Stream #=zPTRy0vU=)

     at #=zK9FEIoyaDxuzPl42VzY_nA9qc34mZ$AJfRAHohs=.#=z66CZhVA=(Stream #=zPTRy0vU=)

     at #=zMbjyE$GwdWvgas9gXsGTRdPUDHYk17z_Nw==..ctor(Stream #=zPTRy0vU=)

     at #=zK9FEIoyaDxuzPl42VzY_nA9qc34mZ$AJfRAHohs=.#=zRLt8CWIDyaio(Stream #=zPTRy0vU=)

     at #=zXTetUpDhf7g1ZnA1KQ9xcZzQhjEL.#=zsgVAyV0=(Stream #=zPTRy0vU=)

     at #=zXTetUpDhf7g1ZnA1KQ9xcZzQhjEL..ctor(Stream #=zPTRy0vU=)

     at Aspose.Pdf.Document.#=z68FK36A=(Stream #=zy2PiOCY=, String #=zhBw7Yrk=)

     at Aspose.Pdf.Document..ctor(Stream input)

     at Aspose.Pdf.Facades.PdfJavaScriptStripper.Strip(Stream inStream, Stream outStream)

     at Deloitte.Cortex.ConverterService.Services.PdfManipulators.PdfCleaning.PdfCleaningService.Clean(Stream srcStream, Stream dstStream) in /build/services/Converter/src/Deloitte.Cortex.ConverterService/Services/PdfManipulators/PdfCleaning/PdfCleaningService.cs:line 23

     at Deloitte.Cortex.ConverterService.Services.PdfManipulators.PdfCleaning.PdfCleaningService.Clean(Stream srcStream) in /build/services/Converter/src/Deloitte.Cortex.ConverterService/Services/PdfManipulators/PdfCleaning/PdfCleaningService.cs:line 14

     at Deloitte.Cortex.ConverterService.Controllers.CleanPdfController.<>c__DisplayClass5_0.<<CleanPdf>g__WriteCallback|0>d.MoveNext() in /build/services/Converter/src/Deloitte.Cortex.ConverterService/Controllers/CleanPdfController.cs:line 45

  --- End of stack trace from previous location where exception was thrown ---

     at Deloitte.Cortex.Shared.AspNetCore.FileStreaming.FileCallbackResult.FileCallbackResultExecutor.ExecuteAsync(ActionContext context, FileCallbackResult result) in /build/common/dotnet/shared/src/Deloitte.Cortex.Shared/AspNetCore/FileStreaming/FileCallbackResult.cs:line 92

     at Deloitte.Cortex.Shared.AspNetCore.FileStreaming.FileCallbackResult.ExecuteResultAsync(ActionContext context) in /build/common/dotnet/shared/src/Deloitte.Cortex.Shared/AspNetCore/FileStreaming/FileCallbackResult.cs:line 51

     at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeResultAsync>g__Logged|21_0(ResourceInvoker invoker, IActionResult result)

     at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResultFilterAsync>g__Awaited|29_0[TFilter,TFilterAsync](ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)

     at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResultExecutedContextSealed context)

     at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.ResultNext[TFilter,TFilterAsync](State& next, Scope& scope, Object& state, Boolean& isCompleted)

     at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeResultFilters()

  --- End of stack trace from previous location where exception was thrown ---

     at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|24_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)

     at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)

     at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)

     at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()

  --- End of stack trace from previous location where exception was thrown ---

     at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)

     at Microsoft.AspNetCore.Builder.RouterMiddleware.Invoke(HttpContext httpContext)

     at Deloitte.Cortex.Shared.ExceptionHandling.ExceptionHandlingMiddleware.Invoke(HttpContext context) in /build/common/dotnet/shared/src/Deloitte.Cortex.Shared/ExceptionHandling/ExceptionHandlingMiddleware.cs:line 58

@abhishekkeswani

Would you please share that are you facing issue with only one document or all PDF documents which you are trying to process under this environment? Also, please share your sample source PDF document so that we can test the scenario in our environment and address it accordingly.

Finance (5).zip (3.3 MB)

I have uploaded the zip file.We are unable to unzip this file

@abhishekkeswani

There are many files in the Archive that you have shared. There is one PDF document as well.

When you say “unzip”, do you mean that you are trying to unzip the file using Aspose.PDF? Would you please explain the issue a bit more so that we can further proceed to assist you.

The code above is used to strip the JavaScript and cannot be used to unzip the file. Aspose.PDF API allows you to work with PDF documents and .zip is not the format supported by it.

Here is exactly what we are trying to do,

We are trying to clean the PDF file from scripts. To do so we call the following code:

var stripper = new PdfJavaScriptStripper();
stripper.Strip(srcStream, dstStream);

where:

  • srcStream is our PDF file
  • dstStream is expected clean source file

Sometimes it works but sometimes it doesn’t work and we get an exception.

Our configuration:

  1. Environment - Linux

  2. Code: .net core 3.1, c#

  3. Aspose.PDF 20.7

  4. The source file that causes the issue is attached

  5. Exception:

    Exception: System.Exception: The root object missing or invalid

      at #=q311qrwenFolnMievRmUg2x9dhCoSC7FNW1jMAX5lHbY=.#=zEwHJn3t5ZGpfzGRWBLNyYlQGJMMiJZhQpLFBVyY=(Object #=zX5nKl38=)
    
      at #=q311qrwenFolnMievRmUg2x9dhCoSC7FNW1jMAX5lHbY=.#=zZaPSulpSbkggGH70TLkrvfp3nSUGVt4$DsM22YM=(#=q311qrwenFolnMievRmUg2x9dhCoSC7FNW1jMAX5lHbY= #=zX5nKl38=, #=qMi4WIDoKgo3qlHdQL$cKRqA88pWh71n6$CDvyLwFkYY= #=zmVr7LIQ=)
    
      at #=q311qrwenFolnMievRmUg2x9dhCoSC7FNW1jMAX5lHbY=.#=zMUTBhOL6_6FKk1BKxBY50XKlf4QMM5uhXg==()
    
      at #=q311qrwenFolnMievRmUg2x9dhCoSC7FNW1jMAX5lHbY=.#=zXCmSsX91A9wVB81F8mPb6xcd9BCGc_$1PkDSQqo=(Boolean #=zX5nKl38=)
    
      at #=q311qrwenFolnMievRmUg2x9dhCoSC7FNW1jMAX5lHbY=.#=zEwHJn3t5ZGpfzGRWBLNyYlQGJMMiJZhQpLFBVyY=(Object #=zX5nKl38=)
    
      at #=q311qrwenFolnMievRmUg2x9dhCoSC7FNW1jMAX5lHbY=.#=zXDbFIDlAYZKSSf6x3L$gccvzgnQspdJNrVMb7_s=()
    
      at #=q311qrwenFolnMievRmUg2x9dhCoSC7FNW1jMAX5lHbY=.#=zSoouLHrOq4$6K3CQ6geraPWB7yPvOeEmPVIsMiZ3m5Hm(Object #=zX5nKl38=, UInt32 #=zmVr7LIQ=)
    
      at #=q311qrwenFolnMievRmUg2x9dhCoSC7FNW1jMAX5lHbY=.#=zXCmSsX91A9wVB81F8mPb6xcd9BCGc_$1PkDSQqo=(Boolean #=zX5nKl38=)
    
      at #=q311qrwenFolnMievRmUg2x9dhCoSC7FNW1jMAX5lHbY=.#=zXCmSsX91A9wVB81F8mPb6xcd9BCGc_$1PkDSQqo=(Boolean #=zX5nKl38=)
    
      at #=q311qrwenFolnMievRmUg2x9dhCoSC7FNW1jMAX5lHbY=.#=zM7OyK7rqEAIb7KSZ_NOm90s=()
    
      at #=q311qrwenFolnMievRmUg2x9dhCoSC7FNW1jMAX5lHbY=.#=zfHrjQohU1gCR2c830LhJofC4F15BMBh$1w==(Object[] #=zX5nKl38=, Type[] #=zmVr7LIQ=, Type[] #=zNjmogpc=, Object[] #=ziBeFMlc=)
    
      at #=q311qrwenFolnMievRmUg2x9dhCoSC7FNW1jMAX5lHbY=.#=zqL5upDZEIQ4behKYykBo7mAXq8nr(Stream #=zX5nKl38=, Int32 #=zmVr7LIQ=, Object[] #=zNjmogpc=, Type[] #=ziBeFMlc=, Type[] #=z70K3bOY=, Object[] #=z1rJOARE=)
    
      at #=q311qrwenFolnMievRmUg2x9dhCoSC7FNW1jMAX5lHbY=.#=zFfNPH4UdVgZtYz_ybM8aRS8=(Int32 #=zX5nKl38=, Type[] #=zmVr7LIQ=, Type[] #=zNjmogpc=, Boolean #=ziBeFMlc=)
    
      at #=q311qrwenFolnMievRmUg2x9dhCoSC7FNW1jMAX5lHbY=.#=zMUTBhOL6_6FKk1BKxBY50XKlf4QMM5uhXg==()
    
      at #=q311qrwenFolnMievRmUg2x9dhCoSC7FNW1jMAX5lHbY=.#=zXCmSsX91A9wVB81F8mPb6xcd9BCGc_$1PkDSQqo=(Boolean #=zX5nKl38=)
    
      at #=q311qrwenFolnMievRmUg2x9dhCoSC7FNW1jMAX5lHbY=.#=zEwHJn3t5ZGpfzGRWBLNyYlQGJMMiJZhQpLFBVyY=(Object #=zX5nKl38=)
    
      at #=q311qrwenFolnMievRmUg2x9dhCoSC7FNW1jMAX5lHbY=.#=zXDbFIDlAYZKSSf6x3L$gccvzgnQspdJNrVMb7_s=()
    
      at #=q311qrwenFolnMievRmUg2x9dhCoSC7FNW1jMAX5lHbY=.#=zSoouLHrOq4$6K3CQ6geraPWB7yPvOeEmPVIsMiZ3m5Hm(Object #=zX5nKl38=, UInt32 #=zmVr7LIQ=)
    
      at #=q311qrwenFolnMievRmUg2x9dhCoSC7FNW1jMAX5lHbY=.#=zXCmSsX91A9wVB81F8mPb6xcd9BCGc_$1PkDSQqo=(Boolean #=zX5nKl38=)
    
      at #=q311qrwenFolnMievRmUg2x9dhCoSC7FNW1jMAX5lHbY=.#=zM7OyK7rqEAIb7KSZ_NOm90s=()
    
      at #=q311qrwenFolnMievRmUg2x9dhCoSC7FNW1jMAX5lHbY=.#=zfHrjQohU1gCR2c830LhJofC4F15BMBh$1w==(Object[] #=zX5nKl38=, Type[] #=zmVr7LIQ=, Type[] #=zNjmogpc=, Object[] #=ziBeFMlc=)
    
      at #=q311qrwenFolnMievRmUg2x9dhCoSC7FNW1jMAX5lHbY=.#=z5t7fImqhwUE11AnBR9Onik83yqAOnTiBzQ==(Stream #=zX5nKl38=, String #=zmVr7LIQ=, Object[] #=zNjmogpc=, Type[] #=ziBeFMlc=, Type[] #=z70K3bOY=, Object[] #=z1rJOARE=)
    
      at #=q311qrwenFolnMievRmUg2x9dhCoSC7FNW1jMAX5lHbY=.#=zIqHDP9oIdf5h9hHLv9wcP92EcbSOZLgr1w==(Stream #=zX5nKl38=, String #=zmVr7LIQ=, Object[] #=zNjmogpc=)
    
      at #=q311qrwenFolnMievRmUg2x9dhCoSC7FNW1jMAX5lHbY=.#=z0tE8Ye5BLRDhK2hw74g6JHOe3s9U$iRSc5UYqCi5Movz(Stream #=zX5nKl38=, String #=zmVr7LIQ=, Object[] #=zNjmogpc=)
    
      at #=ztbI98D3PO5f$Mdhi2bmH9kWRJpynyT98Vg==.#=z1mYFAxCOlAWa(String #=zhBw7Yrk=, Boolean #=zj3olUu4mcdd2, StringBuilder #=znwzdOKo=, #=zzxHSk8pkItNMreRtyfkouEgvJbMDibWmk1lu0jg= #=zttKwk98=)
    
      at #=ztbI98D3PO5f$Mdhi2bmH9kWRJpynyT98Vg==..ctor(Stream #=zPTRy0vU=, String #=zhBw7Yrk=, Boolean #=zj3olUu4mcdd2)
    
      at #=ztbI98D3PO5f$Mdhi2bmH9kWRJpynyT98Vg==..ctor(Stream #=zPTRy0vU=)
    
      at #=zK9FEIoyaDxuzPl42VzY_nA9qc34mZ$AJfRAHohs=.#=z66CZhVA=(Stream #=zPTRy0vU=)
    
      at #=zMbjyE$GwdWvgas9gXsGTRdPUDHYk17z_Nw==..ctor(Stream #=zPTRy0vU=)
    
      at #=zK9FEIoyaDxuzPl42VzY_nA9qc34mZ$AJfRAHohs=.#=zRLt8CWIDyaio(Stream #=zPTRy0vU=)
    
      at #=zXTetUpDhf7g1ZnA1KQ9xcZzQhjEL.#=zsgVAyV0=(Stream #=zPTRy0vU=)
    
      at #=zXTetUpDhf7g1ZnA1KQ9xcZzQhjEL..ctor(Stream #=zPTRy0vU=)
    
      at Aspose.Pdf.Document.#=z68FK36A=(Stream #=zy2PiOCY=, String #=zhBw7Yrk=)
    
      at Aspose.Pdf.Document..ctor(Stream input)
    
      at Aspose.Pdf.Facades.PdfJavaScriptStripper.Strip(Stream inStream, Stream outStream)

@abhishekkeswani

The document that you attached seems to be damaged/corrupted. While opening the document with Adobe Reader, we faced an error. openingerror.png (7.8 KB)

We were also unable to open it using Chrome. The invalidity of the PDF document may be the reason of the issue that you are facing. However, if you are able to open it in Adobe Reader without any error, please share it again (as it might get corrupted during the upload). We will again test it and share our feedback with you accordingly.