Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Mon Jul 04, 2016 10:07 am

Hi Support,

I get an AccessViolationException when using the PdfDocument.SaveAsImage function. the function works and it saves the images but after saving a couple of images it throws me the error.

Here is the code I am using:
Code: Select all
Try
                            Dim image As Image = Nothing

                            image = doc.SaveAsImage(page - 1, PdfImageType.Metafile)
                            image.Save(TestFileName.Replace(".pdf", "_t" + page.ToString + ".png"))
                            image.Dispose()

                        Catch ex As AccessViolationException
                        Catch ex As Exception
                            Console.Write(ex.Message)

                        End Try


And this is the error:
System.AccessViolationException was unhandled
HResult=-2147467261
Message=Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Source=System.Drawing
StackTrace:
at System.Drawing.SafeNativeMethods.Gdip.GdipFillPath(HandleRef graphics, HandleRef brush, HandleRef path)
at System.Drawing.Graphics.FillPath(Brush brush, GraphicsPath path)
at spr6393.0(FillMode A_0)
at spr6393.0(spr5017 A_0)
at spr6393.7(Boolean A_0)
at spr6393.40()
at spr728.0(Single A_0, Boolean A_1)
at Spire.Pdf.PdfDocumentBase.0(Stream A_0, Int32 A_1)
at Spire.Pdf.PdfDocumentBase.0(Int32 A_0, PdfImageType A_1)
at Spire.Pdf.PdfDocument.SaveAsImage(Int32 pageIndex, PdfImageType type)

Tjunas
 
Posts: 18
Joined: Thu Nov 05, 2015 6:40 am

Tue Jul 05, 2016 2:05 am

Dear Tjunas,

Thanks for your inquiry.
I have tested a document with your codes, but I didn't reproduce your issue, so please provide us your sample document which encounterd this issue here, or you can send it to us( [email protected]) via email.

Thanks,
Betsy
E-iceblue support team
User avatar

Betsy
 
Posts: 802
Joined: Mon Jan 19, 2015 6:14 am

Tue Jul 05, 2016 5:52 am

Hi Betsy,

I sent the docs via email as they were to big to upload here. The error only gets thrown after a while and not immediately, and its not always on the same page. It happens after running the code once or twice. I should mention I am using threads to save each image of the page. The threads run for each hundred pages. So with those two documents there are 4 to five threads running at the same time.

Tjunas
 
Posts: 18
Joined: Thu Nov 05, 2015 6:40 am

Tue Jul 05, 2016 6:51 am

Dear Tjunas,

Thanks for your information.
Could you please provide us your entire codes and OS information ( e.g. Win7 64bit) to help us reproduce your issue?

Thanks,
Betsy
E-iceblue support team
User avatar

Betsy
 
Posts: 802
Joined: Mon Jan 19, 2015 6:14 am

Tue Jul 05, 2016 7:01 am

I sent the class files via email.

Tjunas
 
Posts: 18
Joined: Thu Nov 05, 2015 6:40 am

Wed Jul 06, 2016 6:22 am

Dear Tjunas,

Thanks for your file.
I have noticed your issue and posted it to our Dev team, we will inform you once there is any update.
Sorry for inconvenience caused.

Best Regards,
Betsy
E-iceblue support team
User avatar

Betsy
 
Posts: 802
Joined: Mon Jan 19, 2015 6:14 am

Wed Nov 30, 2022 1:20 am

Can you resolved this problem? , currently I am having the same issue

dsacledo
 
Posts: 2
Joined: Wed Nov 30, 2022 1:13 am

Wed Nov 30, 2022 1:30 am

Currently I am using the version Spire.PDF 8.11.0 and I am trying to convert a lot of documents PDF to TIFF with documentation oficial of page e-iceblue, the app works well for a time and after release this exeption PDFDocument.SaveAsImage Access Violation Exception

dsacledo
 
Posts: 2
Joined: Wed Nov 30, 2022 1:13 am

Wed Nov 30, 2022 9:39 am

Hello,

Thanks for your inquiry.
The latest version of Spire.Pdf is V8.11.10, please update to it and have a test. If the issue still exists, please offer the following message to help us reproduce your issue and work out a solution for you.
1) Your input file, you can attach them here or send them via email([email protected]). In addition, if the file is so big, uou could upload your large file via Dropbox or OneDrive server, then share us with the download link.
2) Your test full code that can reproduce your issue.
3) Application type, such as Console App, .NET Framework 4.8.
4) Your test environment, such as OS info (E.g. Windows 7, 64-bit) and region setting (E.g. China, Chinese).

Sincerely
Abel
E-iceblue support team
User avatar

Abel.He
 
Posts: 1010
Joined: Tue Mar 08, 2022 2:02 am

Tue Dec 27, 2022 2:58 am

dsacledo wrote:Currently I am using the version Spire.PDF 8.11.0 and I am trying to convert a lot of documents PDF to TIFF with documentation oficial of page e-iceblue, the app works well for a time and after release this exeption PDFDocument.SaveAsImage Access Violation Exception


Hello,

Greeting from E-iceblue.
Does the latest version of Spire.Pdf 8.12.5 solve your issue? If not, please offer the following message:

1) Your input file, you can attach them here or send them via email([email protected]). In addition, if the file is so big, uou could upload your large file via Dropbox or OneDrive server, then share us with the download link.
2) Your test full code that can reproduce your issue.
3) Application type, such as Console App, .NET Framework 4.8.
4) Your test environment, such as OS info (E.g. Windows 7, 64-bit) and region setting (E.g. China, Chinese).

Sincerely
Abel
E-iceblue support team
User avatar

Abel.He
 
Posts: 1010
Joined: Tue Mar 08, 2022 2:02 am

Return to Spire.PDF

cron