Hi ,
we are facing an issue on Mac/Linux OS but we dont see this on windows.
we see this error when we initiate a Aspose.Pdf.Document object
Exception thrown: ‘#=zmCt58VVTArynDYd5szOzBClkVXX7mWfZAG05QpM=’ in Aspose.PDF.dll: ‘Permissions check failed (invalid Perms value).’
at #=qJCdvRVy2nxc$Y_Ag9SqbQYZ2cOYQ2tnJrWSFvCb7qxo=.#=zieP5zFVq9tXG$Fn5VhmrsPvDA7ul(Object #=zjo6$C14=) at #=qJCdvRVy2nxc$Y_Ag9SqbQYZ2cOYQ2tnJrWSFvCb7qxo=.#=zOyuOG0tIAwcQiHdz2CGN9R5_231irTuWJg==() at #=qJCdvRVy2nxc$Y_Ag9SqbQYZ2cOYQ2tnJrWSFvCb7qxo=.#=zkVVCjkyABsz9ISkGG8D1D_9IHEctdpVe6tzUdpiEe6Ia(Object #=zjo6$C14=, UInt32 #=z1p8oORg=) at #=qJCdvRVy2nxc$Y_Ag9SqbQYZ2cOYQ2tnJrWSFvCb7qxo=.#=zH9beOp65e3W3SoUroxUuOec=(Boolean #=zjo6$C14=) at #=qJCdvRVy2nxc$Y_Ag9SqbQYZ2cOYQ2tnJrWSFvCb7qxo=.#=zrRz1NH9NkCNPHACXtwLbRWxYOubuNNJmFQ==(Object[] #=zjo6$C14=, Type[] #=z1p8oORg=, Type[] #=ze$KApdk=, Object[] #=zFYOAtH4=) at #=qJCdvRVy2nxc$Y_Ag9SqbQYZ2cOYQ2tnJrWSFvCb7qxo=.#=zYAEJ5tb_2NIH0eg8$d9HkR0=(Stream #=zjo6$C14=, String #=z1p8oORg=, Object[] #=ze$KApdk=) at #=qJCdvRVy2nxc$Y_Ag9SqbQYZ2cOYQ2tnJrWSFvCb7qxo=.#=za35TKea8cAPSg61WsKfm8nua3DMHRD4m__pd_8Z2F6Ia(Stream #=zjo6$C14=, String #=z1p8oORg=, Object[] #=ze$KApdk=) at #=zn0tASNbiy9KomFNecu48IQRzih7stK4XFQ==.#=zjJHosdK57nZS(String #=zoEd8jFY=, Boolean #=zojsUSaVlbwU9, StringBuilder #=zIOIU$Dw=, #=zLbJE4Thqp$AoD7iO7NY$LwN0tu$shPigQAduEQA= #=zBixbJZs=) at #=zn0tASNbiy9KomFNecu48IQRzih7stK4XFQ==…ctor(Stream #=zVodcYws=, String #=zoEd8jFY=, Boolean #=zojsUSaVlbwU9) at #=zAW5t8folFKyP5Qxn3TXnewk8OIICzVmjr$l6BS0=.#=zC89Ubs0=(Stream #=zVodcYws=) at Aspose.Pdf.Document.#=zJTyIvcU=(Stream #=zOL$RYgQ=, String #=zoEd8jFY=) at Aspose.Pdf.Document…ctor(Stream input) at AsposeRepository.CompressPDF(Stream fileStream)
this is our code
public Stream CompressPDF(Stream fileStream)
{
try
{
var stream = new MemoryStream();
Aspose.Pdf.Document pdfDocument = new Aspose.Pdf.Document(fileStream); // error here
// Set RemoveUsedObject option
var optimizeOptions = new Aspose.Pdf.Optimization.OptimizationOptions
{
RemoveUnusedObjects = true,
RemoveUnusedStreams = true,
LinkDuplcateStreams = true,
AllowReusePageContent = true,
UnembedFonts = true,
ImageCompressionOptions = { CompressImages = true, ImageQuality = 75, ResizeImages = true, MaxResolution = 300 }
};
// Optimize PDF document using OptimizationOptions
pdfDocument.OptimizeResources(optimizeOptions);
pdfDocument.Save(stream);
stream.Position = 0;
return stream;
}
catch (Exception ex)
{
Log.Error("CompressPDF failed", ex.StackTrace);
throw;
}
}