Crash when Loading a PDF File as an Asset (linked to an APK)

Discuss PDF file handling with the Polybios plugin here
Post Reply
PEB
Posts: 184
Joined: Sun Feb 21, 2010 2:28 am

Crash when Loading a PDF File as an Asset (linked to an APK)

Post by PEB » Tue Aug 28, 2018 11:33 pm

My Android app (made with the Hollywood APK Compiler) crashes when I use pdf.OpenDocument() to load a PDF linked as an asset using GetAsset().

PEB
Posts: 184
Joined: Sun Feb 21, 2010 2:28 am

Re: Crash when Loading a PDF File as an Asset (linked to an APK)

Post by PEB » Wed Aug 29, 2018 11:35 pm

A related question (possibly a work-around):
Is there a way to link a PDF file to an executable with a preprocessor command, such as @FILE?

User avatar
airsoftsoftwair
Posts: 2616
Joined: Fri Feb 12, 2010 3:33 pm
Location: Germany
Contact:

Re: Crash when Loading a PDF File as an Asset (linked to an APK)

Post by airsoftsoftwair » Thu Aug 30, 2018 10:06 pm

Thanks for the report, I'll check what's wrong there.

As for a workaround, you could try something like this:

Code: Select all

@FILE 1, "test.pdf"
data$ = ReadBytes(1)
vfile$ = DefineVirtualFileFromString(data$, "test.pdf")
pdf.OpenDocument(1, vfile$)
data$ = Nil
vfile$ = Nil
I haven't tested it but it should work... if it doesn't file another bug report :)

PEB
Posts: 184
Joined: Sun Feb 21, 2010 2:28 am

Re: Crash when Loading a PDF File as an Asset (linked to an APK)

Post by PEB » Fri Aug 31, 2018 2:02 am

Thanks! (That work-around works perfectly.)

Post Reply