Skip to content

Text.Pdf.Mod crashes main app, when access to pdf is not possible #61

@MidimasterSoft

Description

@MidimasterSoft

When you try to save a PDF ( TPdf.Save() ), which you already opened before in any PDF-reader, everything works fine.

But if the default PDF-reader is a PDF-Creator it could be possible, that the creator prevents the next writing access.
In this case BlitzMax crashes instead of reporting a catchable error.

Here you can see more about the circumstances and how I got the crash:
https://discord.com/channels/613699895139762176/679291789840089108/1432022303000231998

The google gemini suggested to test with a WriteStream(), whether another writing access is possible before using TPdf.Save()

test:TStream = WriteStream("mydoc.pdf")
If test=NULL
   Notify "first close the PDF Creator"
   ' followed by a strategy to continue...
Else
   CloseStream test
   pdf.Save("mydoc.pdf")
   pdf.Free()
   OpenUrl path + "mydoc.pdf"
Endif

My suggestion is to also implement this into the PDF module. Better reporting an error message than crashing with
WINDOWS EXCEPTION: EXCEPTION_ACCESS_VIOLATION

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions