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

Free Support Forum - aspose.com

'System.OutOfMemoryException' error thrown while splitting large PDF file into new pages based on number of bookmark

Hi,

I am trying to split PDF files into the new pdf’s. pages based on bookmark available within the pdf.

When I am using a larger file (file size- 250 MB, total page count 1400) and split pdf page range 200 pages, I am getting out of memory exception “System.OutOfMemoryException” multiple times.

I tried using “newDocument.OptimizeSize = true;” and Dispose() too within the method but still getting the same issue.

Can anyone suggest any resolution for this?

Exception: Exception of type ‘System.OutOfMemoryException’ was thrown.

Stack trace:
at #=zjSJp7f_4zBIpCMJkBMW9ee_oC3LcD$MxLW$7DgkIx_8S4DEJow==.#=z$kIiwsu8v38jwXvfKg==(#=zwyvmN1$DmWob85vVhZ4ORON_PeWG3FNjYJ6iCEdEHHuZhRHfNbpSGFs= #=zLROPTzlWXy_E, Int32 #=z5hzA$X8=, Int32 #=zwUvKpWI=, Int32 #=zpM_f6zx3z__5, Int32 #=zSW_sV9cUTLhv, Int32 #=z29ypgi0=)
at #=zjSJp7f_4zBIpCMJkBMW9ee_oC3LcD$MxLW$7DgkIx_8S4DEJow==.#=zjqwrleoREup1Ly7uCw==(#=zwyvmN1$DmWob85vVhZ4ORON_PeWG3FNjYJ6iCEdEHHuZhRHfNbpSGFs= #=zLROPTzlWXy_E, Int32 #=z5hzA$X8=, Int32 #=zqnI59Bo=)
at #=zwyvmN1$DmWob85vVhZ4ORON_PeWG3FNjYJ6iCEdEHHuZhRHfNbpSGFs=.#=z_iX3HozVM60m(Int32 #=z5hzA$X8=, Int32 #=zqnI59Bo=, Boolean #=zwvmuo_xEp3V1)
at #=zwyvmN1$DmWob85vVhZ4ORON_PeWG3FNjYJ6iCEdEHHuZhRHfNbpSGFs=.#=z_iX3HozVM60m(Int32 #=z5hzA$X8=, Boolean #=zwvmuo_xEp3V1)
at #=zzl9GCbBV_TZWpZlpYaVoPSZCh5xY41PELwna_tY0Koi$Il$CbXSxMesZJrVIqFHoGA==…ctor(Stream #=zaMl0$opuHw4L, Int32 #=z5hzA$X8=, Boolean #=zwvmuo_xEp3V1)
at #=zzl9GCbBV_TZWpZlpYaVoPSZCh5xY41PELwna_tY0Koi$Il$CbXSxMesZJrVIqFHoGA==…ctor(Stream #=zaMl0$opuHw4L)
at #=z0xt75os3Bp6siYfrKbaN8N0h8nngNspq7zZDj4T8eD_UCGQEGg==.#=zt8hMqmE=(Byte[] #=z_o6C8Es=, Object[] #=zpXr5MYU=)
at Aspose.Pdf.OperatorCollection.#=zvzEVVN8=()
at Aspose.Pdf.OperatorCollection.ResumeUpdate()
at #=zZue$WINdUg3oHRscG064rpGHBkEj3UraMpp8H_2syDPwJP6oZUyCIUo=.#=zCO7Fz8WUCF0L()
at #=z5QJuHd8g$YZKXXM2p9$2ur3CUHUe3vRt$7PTtKAGIBTcyzNYFKZ$3Ag=.#=zifAmK3U=(Single #=zrTbEoAY=, Single #=zhsnFiO4=, #=z8E6sfPfruhOHxqT0VnXFWUYPTHbH2dsbsJiqZR2$jDmh$7KEKw== #=zMPPfSjc=)
at Aspose.Pdf.Text.TextSegment.set_Position(Position value)
at Aspose.Pdf.Text.TextFragment.set_Position(Position value)
at Aspose.Pdf.TextStamp.Put(Page page)
at Aspose.Pdf.PageNumberStamp.Put(Page page)
at Aspose.Pdf.Page.AddStamp(Stamp stamp)
at Discovery_Omnia_Integration.BusinessServices.Processor.GeneratePDF(Document pdfDocument, Bookmark bookmark, String extractFolder) in C:\Users\jayprakash\Downloads\Omnia\Dev Branch\Discovery Omnia Integration\BusinessServices\Processor.cs:line 446

@kumar25

Would you kindly share your sample PDF document along with sample code snippet? We will test the scenario in our environment and address it accordingly. You can please upload your file to Dropbox or Google Drive and share the link with us. Also, please share your complete environment details i.e. OS Name and Version, Installed RAM size, etc.