AccessViolationException in optimize operation

PDF-XChange Editor SDK for Developers

Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Sean - Tracker, Paul - Tracker Supp, Chris - Tracker Supp, Tracker Supp-Stefan, Ivan - Tracker Software

Forum rules
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.

When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
Post Reply
Posts: 111
Joined: Tue Mar 15, 2016 12:21 pm

AccessViolationException in optimize operation

Post by chavas » Thu Feb 07, 2019 1:49 pm


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 ''.


User avatar
Sasha - Tracker Dev Team
Posts: 4855
Joined: Fri Nov 21, 2014 8:27 am

Re: AccessViolationException in optimize operation

Post by Sasha - Tracker Dev Team » Thu Feb 07, 2019 3:43 pm

Hello Charu,

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

Join us at Google+:
Subscribe at:

Post Reply