AccessViolationException in optimize operation

PDF-XChange Editor SDK for Developers

Moderators: Tracker Support, TrackerSupp-Daniel, Paul - Tracker Supp, Chris - Tracker Supp, Vasyl-Tracker Dev Team, Sean - Tracker, 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
chavas
User
Posts: 111
Joined: Tue Mar 15, 2016 12:21 pm

AccessViolationException in optimize operation

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

Hi,

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
op.Do()
resDoc.WriteTo(srcIStream1, Nothing, 1)
resDoc.Close()
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 'op.do' . This does not happen immediately, but after some time of calling 'op.do'.

Rgds
Charu

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

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.

Cheers,
Alex
Join us at Google+:
https://plus.google.com/+PDFXChangeEditorTS
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ

Post Reply