Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] PDF Page 1 loads but other pages are blank #177

Open
UltraDeep opened this issue Mar 10, 2025 · 1 comment
Open

[BUG] PDF Page 1 loads but other pages are blank #177

UltraDeep opened this issue Mar 10, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@UltraDeep
Copy link

📝 Describe the Bug

PDF Page 1 loads but other pages are blank

Tag: PDF_OPEN_TRACKER
Log Level: ERROR

Error: Unable to open page 1 - Current page not closed.

Exception: java.lang.IllegalStateException: Current page not closed
at android.graphics.pdf.PdfRenderer.throwIfPageOpened(PdfRenderer.java:260)
at android.graphics.pdf.PdfRenderer.openPage(PdfRenderer.java:218)
at com.rajat.pdfviewer.PdfRendererCore.openPageSafely(PdfRendererCore.kt:198)
at com.rajat.pdfviewer.PdfRendererCore.access$openPageSafely(PdfRendererCore.kt:26)
at com.rajat.pdfviewer.PdfRendererCore$renderPage$2.invokeSuspend(PdfRendererCore.kt:121)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:115)
at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:103)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684)

And repeats for almost all pages like:
Error: Unable to open page 1 - Current page not closed.
Exception: java.lang.IllegalStateException: Current page not closed
Error: Unable to open page 2 - Current page not closed.
Exception: java.lang.IllegalStateException: Current page not closed
Error: Unable to open page 3 - Current page not closed....

📖 Library Version

  • PDF Viewer Version: [e.g., 2.0.0]
    2.2.1

🚶 Steps to Reproduce

Please follow these steps to reproduce the issue:

  1. Use version 2.2.1
  2. startActivity(PdfViewerActivity.Companion.launchPdfFromUrl(
    getApplicationContext(),
    url,
    fileName,
    saveTo.ASK_EVERYTIME,
    true,
    true,
    headers,
    ToolbarTitleBehavior.MULTI_LINE_ELLIPSIS,
    CacheStrategy.MINIMIZE_CACHE
    ));
  3. Open pdf
  4. Relevant Code/Stack Trace: [Include code snippet or stack trace if applicable]
    Exception: java.lang.IllegalStateException: Current page not closed
    at android.graphics.pdf.PdfRenderer.throwIfPageOpened(PdfRenderer.java:260)
    at android.graphics.pdf.PdfRenderer.openPage(PdfRenderer.java:218)
    at com.rajat.pdfviewer.PdfRendererCore.openPageSafely(PdfRendererCore.kt:198)
    at com.rajat.pdfviewer.PdfRendererCore.access$openPageSafely(PdfRendererCore.kt:26)
    at com.rajat.pdfviewer.PdfRendererCore$renderPage$2.invokeSuspend(PdfRendererCore.kt:121)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
    at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:115)
    at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:103)
    at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697)
    at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684)

🤔 Expected Behavior

What did you expect to happen?
Open pdf and page 1 loads and as i scroll other pages load

🖼️ Screenshots/Videos

If applicable, add screenshots or videos to help explain your problem.

Screen_recording_20250310_101454.mp4

📱 Smartphone Info:

  • Device: [e.g., Samsung Galaxy S10]
  • Xiaomi 12 Lite
  • OS: [e.g., Android 14]
  • Android 14
  • Library Version: [e.g., 2.0.0]
  • 2.2.1

💻 Code Snippets

Include relevant code snippets or links to code repositories.
startActivity(PdfViewerActivity.Companion.launchPdfFromUrl(
getApplicationContext(),
url,
fileName,
saveTo.ASK_EVERYTIME,
true,
true,
headers,
ToolbarTitleBehavior.MULTI_LINE_WRAP,
CacheStrategy.MINIMIZE_CACHE
));

📜 Log Output/Stack Trace

Include any error logs or stack trace for more context.
Exception: java.lang.IllegalStateException: Current page not closed
at android.graphics.pdf.PdfRenderer.throwIfPageOpened(PdfRenderer.java:260)
at android.graphics.pdf.PdfRenderer.openPage(PdfRenderer.java:218)
at com.rajat.pdfviewer.PdfRendererCore.openPageSafely(PdfRendererCore.kt:198)
at com.rajat.pdfviewer.PdfRendererCore.access$openPageSafely(PdfRendererCore.kt:26)
at com.rajat.pdfviewer.PdfRendererCore$renderPage$2.invokeSuspend(PdfRendererCore.kt:121)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.kt:115)
at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:103)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:793)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:697)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:684)

💬 Additional Context

I tried changing CacheStrategy.MINIMIZE_CACHE to CacheStrategy.MAXIMIZE_PERFORMANCE


@UltraDeep UltraDeep added the bug Something isn't working label Mar 10, 2025
Copy link

Thank you for creating your first issue. We appreciate your help in making this project better. We will look into it, and get back to you soon. Need help or want to discuss this issue? Join our Discord community here to ask questions and discuss this issue live!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant