Page 1 of 1

AccessViolationException in optimize operation

Posted: Thu Feb 07, 2019 1:49 pm
by chavas

I get 'AccessViolationException' in optimize operation when optimizing a 200mb file. This exception crashes my application. Here is the code that I wrote-
Function PDFOptimize_stream(ByRef _memstream As MemoryStream, ByRef _memstream1 As MemoryStream, ByRef m_Inst As PDFXEdit.PXV_Inst, ByRef m_pxcInst As PDFXEdit.IPXC_Inst) As Integer
Dim srcIStream As IStreamWrapper = New IStreamWrapper(_memstream)
Dim srcIStream1 As IStreamWrapper = New IStreamWrapper(_memstream1)
Dim nID As Integer = m_Inst.Str2ID("op.document.optimize", False)
Dim op As PDFXEdit.IOperation = m_Inst.CreateOp(nID)
Dim input As PDFXEdit.ICabNode = op.Params.Root("Input")
Dim pxcInst As PDFXEdit.IPXC_Inst = CType(m_Inst.GetExtension("PXC"), PDFXEdit.IPXC_Inst)
Dim resDoc As PDFXEdit.IPXC_Document = pxcInst.OpenDocumentFrom(srcIStream, Nothing)
input.Add().v = resDoc
Dim options As PDFXEdit.ICabNode = op.Params.Root("Options")
Dim images As PDFXEdit.ICabNode = options("Images")
images("Enabled").v = True
images("ReducedOnly").v = True
Dim comp As PDFXEdit.ICabNode = images("Comp")
comp("Color.JPEGQuality").v = 1
comp("Grayscale.JPEGQuality").v = 0
resDoc.WriteTo(srcIStream1, Nothing, 1)
srcIStream = Nothing
end function

I am passing memorystream to this function which contains the source file and after optimizing, I save it in the second memory stream.
I get exception in '' . This does not happen immediately, but after some time of calling ''.


Re: AccessViolationException in optimize operation

Posted: Thu Feb 07, 2019 3:43 pm
by Sasha - Tracker Dev Team
Hello Charu,

We will need the exception details, and also the version of the dll that you are using.