android / graphics-samples Goto Github PK
View Code? Open in Web Editor NEWMultiple samples showing the best practices in graphics on Android.
License: Apache License 2.0
Multiple samples showing the best practices in graphics on Android.
License: Apache License 2.0
Issue by Gowthaman-Uohamctechnologies
Thursday Jun 15, 2017 at 04:54 GMT
Originally opened as googlearchive/android-PdfRendererBasic#16
I have file path some like this (File pdfFile = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + "/Bosch/" + "/All_files/"+"Week"+position+".pptx");// Instance of get file from assets folder i am fetching file from sd card.how to achieve this..please help me sir.
I know this is the light way to implement and render .pdf, but my problem is required to render like scrollview from top to bottom instead of switching page from left to the right
I am trying to apply Tint using EffectFactory.EFFECT_TINT
below is the code I am using
val hue = effectFactory.createEffect(EffectFactory.EFFECT_TINT)
hue.setParameter("tint", Color.argb(255, 6, 206, 249)))
using the above code, tint is getting applied. but I tried giving alpha(0-255) values as 50, 100, 150, and 200. The intensity of the color is always the same.
Issue by luongdolong
Thursday May 24, 2018 at 03:57 GMT
Originally opened as googlearchive/android-PdfRendererBasic#25
I have a file: pdf.txt. I rename it to: pdf.pdf
Below is my steps:
Issue by abbasiehsan1991
Sunday Nov 20, 2016 at 08:47 GMT
Originally opened as googlearchive/android-PdfRendererBasic#12
Hello
When i use this code with pdf file has less than 10 pages it works correctly, but when i want to show an pdf file with more than 10 pages my app will crash with this errors
I can't find it out , Please help me.
Thank you.
Issue by npvaddoriya
Wednesday Jul 25, 2018 at 12:20 GMT
Originally opened as googlearchive/android-MediaEffects#2
Resolved issue gradle not sync successfully after updating android studio > 3.1
npvaddoriya included the following code: https://github.com/googlesamples/android-MediaEffects/pull/2/commits
Android Studio is complaining about gradle-properties, as it should contain android.useAndroidX=true field. I think it's silly issue, but this repo does not have gradle.properties of it's own. Please ignore if i am wrong or guide me.
Issue by scgopireddy
Tuesday Oct 16, 2018 at 11:21 GMT
Originally opened as googlearchive/android-DisplayingBitmaps#10
org.gradle.api.ProjectConfigurationException: A problem occurred configuring project ':Application'.
at org.gradle.configuration.project.LifecycleProjectEvaluator.addConfigurationFailure(LifecycleProjectEvaluator.java:94)
at org.gradle.configuration.project.LifecycleProjectEvaluator.notifyAfterEvaluate(LifecycleProjectEvaluator.java:89)
at org.gradle.configuration.project.LifecycleProjectEvaluator.doConfigure(LifecycleProjectEvaluator.java:70)
at org.gradle.configuration.project.LifecycleProjectEvaluator.access$100(LifecycleProjectEvaluator.java:34)
at org.gradle.configuration.project.LifecycleProjectEvaluator$ConfigureProject.run(LifecycleProjectEvaluator.java:110)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
at org.gradle.configuration.project.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:50)
at org.gradle.api.internal.project.DefaultProject.evaluate(DefaultProject.java:666)
at org.gradle.api.internal.project.DefaultProject.evaluate(DefaultProject.java:135)
at org.gradle.execution.TaskPathProjectEvaluator.configure(TaskPathProjectEvaluator.java:35)
at org.gradle.execution.TaskPathProjectEvaluator.configureHierarchy(TaskPathProjectEvaluator.java:62)
at org.gradle.configuration.DefaultBuildConfigurer.configure(DefaultBuildConfigurer.java:38)
at org.gradle.initialization.DefaultGradleLauncher$ConfigureBuild.run(DefaultGradleLauncher.java:249)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
at org.gradle.initialization.DefaultGradleLauncher.configureBuild(DefaultGradleLauncher.java:167)
at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:126)
at org.gradle.initialization.DefaultGradleLauncher.getConfiguredBuild(DefaultGradleLauncher.java:104)
at org.gradle.internal.invocation.GradleBuildController$2.call(GradleBuildController.java:87)
at org.gradle.internal.invocation.GradleBuildController$2.call(GradleBuildController.java:84)
at org.gradle.internal.work.DefaultWorkerLeaseService.withLocks(DefaultWorkerLeaseService.java:152)
at org.gradle.internal.invocation.GradleBuildController.doBuild(GradleBuildController.java:100)
at org.gradle.internal.invocation.GradleBuildController.configure(GradleBuildController.java:84)
at org.gradle.tooling.internal.provider.runner.ClientProvidedBuildActionRunner.run(ClientProvidedBuildActionRunner.java:64)
at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
at org.gradle.tooling.internal.provider.ValidatingBuildActionRunner.run(ValidatingBuildActionRunner.java:32)
at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner$1.run(RunAsBuildOperationBuildActionRunner.java:43)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner.run(RunAsBuildOperationBuildActionRunner.java:40)
at org.gradle.tooling.internal.provider.SubscribableBuildActionRunner.run(SubscribableBuildActionRunner.java:51)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:47)
at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:30)
at org.gradle.launcher.exec.BuildTreeScopeBuildActionExecuter.execute(BuildTreeScopeBuildActionExecuter.java:39)
at org.gradle.launcher.exec.BuildTreeScopeBuildActionExecuter.execute(BuildTreeScopeBuildActionExecuter.java:25)
at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:80)
at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:53)
at org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:57)
at org.gradle.tooling.internal.provider.ServicesSetupBuildActionExecuter.execute(ServicesSetupBuildActionExecuter.java:32)
at org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute(GradleThreadBuildActionExecuter.java:36)
at org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute(GradleThreadBuildActionExecuter.java:25)
at org.gradle.tooling.internal.provider.ParallelismConfigurationBuildActionExecuter.execute(ParallelismConfigurationBuildActionExecuter.java:43)
at org.gradle.tooling.internal.provider.ParallelismConfigurationBuildActionExecuter.execute(ParallelismConfigurationBuildActionExecuter.java:29)
at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:69)
at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:30)
at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:59)
at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:44)
at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:45)
at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:30)
at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:67)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:37)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:74)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:72)
at org.gradle.util.Swapper.swap(Swapper.java:38)
at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
at org.gradle.launcher.daemon.server.exec.LogAndCheckHealth.execute(LogAndCheckHealth.java:55)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:62)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:82)
at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:122)
at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50)
at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:295)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.RuntimeException: No toolchains found in the NDK toolchains folder for ABI with prefix: mips64el-linux-android
at com.android.build.gradle.internal.ndk.DefaultNdkInfo.getDefaultToolchainVersion(DefaultNdkInfo.java:441)
at com.android.build.gradle.internal.ndk.DefaultNdkInfo.getToolchainPath(DefaultNdkInfo.java:284)
at com.android.build.gradle.internal.ndk.DefaultNdkInfo.getStripExecutable(DefaultNdkInfo.java:410)
at com.android.build.gradle.internal.ndk.NdkHandler.getStripExecutable(NdkHandler.java:459)
at com.android.build.gradle.internal.transforms.StripDebugSymbolTransform.(StripDebugSymbolTransform.java:89)
at com.android.build.gradle.internal.TaskManager.createStripNativeLibraryTask(TaskManager.java:1718)
at com.android.build.gradle.internal.ApplicationTaskManager.createTasksForVariantScope(ApplicationTaskManager.java:226)
at com.android.build.gradle.internal.VariantManager.createTasksForVariantData(VariantManager.java:545)
at com.android.build.gradle.internal.VariantManager.lambda$createAndroidTasks$1(VariantManager.java:355)
at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:81)
at com.android.build.gradle.internal.VariantManager.createAndroidTasks(VariantManager.java:351)
at com.android.build.gradle.BasePlugin.lambda$createAndroidTasks$5(BasePlugin.java:641)
at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:81)
at com.android.build.gradle.BasePlugin.createAndroidTasks(BasePlugin.java:636)
at com.android.build.gradle.BasePlugin.lambda$null$3(BasePlugin.java:555)
at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:81)
at com.android.build.gradle.BasePlugin.lambda$createTasks$4(BasePlugin.java:551)
at org.gradle.internal.event.BroadcastDispatch$ActionInvocationHandler.dispatch(BroadcastDispatch.java:91)
at org.gradle.internal.event.BroadcastDispatch$ActionInvocationHandler.dispatch(BroadcastDispatch.java:80)
at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:42)
at org.gradle.internal.event.BroadcastDispatch$SingletonDispatch.dispatch(BroadcastDispatch.java:230)
at org.gradle.internal.event.BroadcastDispatch$SingletonDispatch.dispatch(BroadcastDispatch.java:149)
at org.gradle.internal.event.AbstractBroadcastDispatch.dispatch(AbstractBroadcastDispatch.java:58)
at org.gradle.internal.event.BroadcastDispatch$CompositeDispatch.dispatch(BroadcastDispatch.java:324)
at org.gradle.internal.event.BroadcastDispatch$CompositeDispatch.dispatch(BroadcastDispatch.java:234)
at org.gradle.internal.event.ListenerBroadcast.dispatch(ListenerBroadcast.java:140)
at org.gradle.internal.event.ListenerBroadcast.dispatch(ListenerBroadcast.java:37)
at org.gradle.internal.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
at com.sun.proxy.$Proxy31.afterEvaluate(Unknown Source)
at org.gradle.configuration.project.LifecycleProjectEvaluator.notifyAfterEvaluate(LifecycleProjectEvaluator.java:76)
... 85 more
Hi,
I've found a problem with the PdfRenderer, if I try to open a pdf with password I will get the SecurityException, that's alright, but if after that I try to open another pdf but this time the pdf doesn't have password, I still get the SecurityException.
This error occurs with api level <= 27
Do you know a workaround?
Thanks
Issue by 7heaven
Monday Nov 21, 2016 at 17:03 GMT
Originally opened as googlearchive/android-PdfRendererBasic#13
can PdfRenderer handle the embed links in pdf pages(or simply provide the position and url of the link in pdf pages)?
Issue by amaurymedeiros
Thursday Apr 26, 2018 at 10:38 GMT
Originally opened as googlearchive/android-DisplayingBitmaps#8
The min SDK version needs to be updated to 14, otherwise build will fail:
"Manifest merger failed : uses-sdk:minSdkVersion 9 cannot be smaller than version 14 declared in library [com.android.support:support-v4:27.0.2]"
amaurymedeiros included the following code: https://github.com/googlesamples/android-DisplayingBitmaps/pull/8/commits
Issue by cluelin
Friday Jan 06, 2017 at 19:12 GMT
Originally opened as googlearchive/android-PdfRendererBasic#14
It's result is low quality compare than original.
How to improve this?
Issue by abhay222
Thursday Feb 15, 2018 at 14:06 GMT
Originally opened as googlearchive/android-PdfRendererBasic#20
Hi, App goes to crash when I minimize App and then open
The app from minimized state.
Android Version : 7.0
Android Device : MOTO C Plus
FATAL EXCEPTION: main Process: com.example.android.pdfrendererbasic, PID: 32027 java.lang.RuntimeException: Unable to resume activity {com.example.android.pdfrendererbasic/com.example.android.pdfrendererbasic.MainActivity}: java.lang.IllegalStateException: Already closed at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3506) at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3546) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1577) at android.os.Handler.dispatchMessage(Handler.java:110) at android.os.Looper.loop(Looper.java:203) at android.app.ActivityThread.main(ActivityThread.java:6251) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1075) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936) Caused by: java.lang.IllegalStateException: Already closed at android.graphics.pdf.PdfRenderer$Page.throwIfClosed(PdfRenderer.java:423) at android.graphics.pdf.PdfRenderer$Page.close(PdfRenderer.java:398) at com.example.android.pdfrendererbasic.PdfRendererBasicFragment.showPage(PdfRendererBasicFragment.java:197) at com.example.android.pdfrendererbasic.PdfRendererBasicFragment.onStart(PdfRendererBasicFragment.java:122) at android.support.v4.app.Fragment.performStart(Fragment.java:2380) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1458) at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1740) at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1809) at android.support.v4.app.FragmentManagerImpl.dispatchStateChange(FragmentManager.java:3217) at android.support.v4.app.FragmentManagerImpl.dispatchStart(FragmentManager.java:3176) at android.support.v4.app.FragmentController.dispatchStart(FragmentController.java:203) at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:570) at android.support.v7.app.AppCompatActivity.onStart(AppCompatActivity.java:177) at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1248) at android.app.Activity.performStart(Activity.java:6683) at android.app.Activity.performRestart(Activity.java:6757) at android.app.Activity.performResume(Activity.java:6762) at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3477) at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3546) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1577) at android.os.Handler.dispatchMessage(Handler.java:110) at android.os.Looper.loop(Looper.java:203) at android.app.ActivityThread.main(ActivityThread.java:6251) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1075) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
Issue by yglx
Thursday Aug 02, 2018 at 08:42 GMT
Originally opened as googlearchive/android-DisplayingBitmaps#9
when I add an 3M picture url and open the some ImageDetailActivity frequently,log shows
com.example.android.displayingbitmaps E/StrictMode: A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks. java.lang.Throwable: Explicit termination method 'close' not called at dalvik.system.CloseGuard.open(CloseGuard.java:223) at java.io.FileOutputStream.(FileOutputStream.java:224) at java.io.FileOutputStream.(FileOutputStream.java:171) at com.example.android.displayingbitmaps.util.DiskLruCache$Editor.newOutputStream(DiskLruCache.java:819) at com.example.android.displayingbitmaps.util.ImageFetcher.processBitmap(ImageFetcher.java:215) at com.example.android.displayingbitmaps.util.ImageFetcher.processBitmap(ImageFetcher.java:257) at com.example.android.displayingbitmaps.util.ImageWorker$BitmapWorkerTask.doInBackground(ImageWorker.java:312) at com.example.android.displayingbitmaps.util.ImageWorker$BitmapWorkerTask.doInBackground(ImageWorker.java:257) at com.example.android.displayingbitmaps.util.AsyncTask$2.call(AsyncTask.java:313) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636) at java.lang.Thread.run(Thread.java:764)
how it happened
Issue by github2016-yuan
Tuesday Jul 31, 2018 at 03:10 GMT
Originally opened as googlearchive/android-MediaEffects#3
In method of renderResult()
(1)// if no effect is chosen, just render the original bitmap
mTexRenderer.renderTexture(mTextures[1]);
should be
// render the result of applyEffect()
mTexRenderer.renderTexture(mTextures[1]);
(2) // render the result of applyEffect()
mTexRenderer.renderTexture(mTextures[0]);
should be
// if no effect is chosen, just render the original bitmap
mTexRenderer.renderTexture(mTextures[0]);
Issue by ghost
Thursday Sep 13, 2018 at 05:43 GMT
Originally opened as googlearchive/android-DrawableTinting#1
I'm having issues getting this going. It's probably some issue with my Android Studio configuration, but I'm not experienced enough to know. I have a stackoverflow question on it that explains further:
I tried commenting out the offending lines... which I assumed simply setText in a textview... and now the app runs... but it doesn't seem to do what it claims... as the textview is a different color than the button... and neither one changes color or appearance as a result of being focused/clicked, etc.
Issue by yehyatt
Tuesday Jan 31, 2017 at 12:40 GMT
Originally opened as googlearchive/android-PdfRendererBasic#15
When I download the sample and try to run it this is the error I get :
ClassLoader referenced unknown path: /data/app/com.example.android.pdfrendererbasic-1/lib/arm
java.io.IOException: cannot create document. Error: 3
mPdfRenderer = new PdfRenderer(mFileDescriptor);
mPdfRenderer is always null
Issue by rrshaban
Thursday Mar 31, 2016 at 16:11 GMT
Originally opened as googlearchive/android-PdfRendererBasic#7
"This is an odd one; it's probably a variation on Issue #82838, in which when attempting to use PdfRenderer to display Assets, the wrong Asset is used.
What seems to be the problem is that behavior of PdfRenderer to display Assets depends upon the order of entries within the .apk. If the META-INF entries are first in the .apk, then PdfRenderer won't display PDF assets at all."
Issue by 2ndGAB
Wednesday Jan 17, 2018 at 12:33 GMT
Originally opened as googlearchive/android-PdfRendererBasic#19
Hello,
I'm trying to use PDFRenderer to convert a PDF file generated by the Android' PrintManager
Below is this generated pdf file which seems perfectly correct.
TestPrint.pdf
And here is the code I use to convert this file in a bitmap.
mCurrentPage = mPdfRenderer.openPage(index);
int width = (int)(203.0 / 72.0 * mCurrentPage.getWidth() + 0.5);
int height = (int)(203.0 / 72.0 * mCurrentPage.getHeight() + 0.5);
Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
mCurrentPage.render(bitmap, null, null, PdfRenderer.Page.RENDER_MODE_FOR_PRINT);
And below is the generated Bitmap. could you please tell me where does this 80 pixels wide black border comes from?
Issue by RaulVelasco84
Friday Mar 02, 2018 at 13:16 GMT
Originally opened as googlearchive/android-PdfRendererBasic#22
The library is fine but I can not show the annotations that have a pdf file
Issue by cutler
Thursday Sep 28, 2017 at 06:51 GMT
Originally opened as googlearchive/android-PdfRendererBasic#17
I have a PDF vector that has a region of 30 percent white, but when you load PDF into memory, it becomes pure white.
Issue by AhmadullahSaikat
Wednesday May 16, 2018 at 07:10 GMT
Originally opened as googlearchive/android-PdfRendererBasic#24
Did anyone implement this code for recyclerview.
Issue by SurendiranNK
Thursday Aug 02, 2018 at 05:18 GMT
Originally opened as googlearchive/android-PdfRendererBasic#26
08-02 10:39:22.468 6573-6573/com.example.android.pdfrendererbasic E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.android.pdfrendererbasic, PID: 6573
java.lang.IllegalStateException: Already closed
at android.graphics.pdf.PdfRenderer$Page.throwIfClosed(PdfRenderer.java:419)
at android.graphics.pdf.PdfRenderer$Page.close(PdfRenderer.java:394)
at com.example.android.pdfrendererbasic.PdfRendererBasicFragment.showPage(PdfRendererBasicFragment.java:197)
at com.example.android.pdfrendererbasic.PdfRendererBasicFragment.onStart(PdfRendererBasicFragment.java:122)
at android.support.v4.app.Fragment.performStart(Fragment.java:2287)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1458)
at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1750)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1819)
at android.support.v4.app.FragmentManagerImpl.dispatchStateChange(FragmentManager.java:3227)
at android.support.v4.app.FragmentManagerImpl.dispatchStart(FragmentManager.java:3186)
at android.support.v4.app.FragmentController.dispatchStart(FragmentController.java:203)
at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:582)
at android.support.v7.app.AppCompatActivity.onStart(AppCompatActivity.java:177)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1266)
at android.app.Activity.performStart(Activity.java:6943)
at android.app.Activity.performRestart(Activity.java:7002)
at android.app.ActivityThread.handleSleeping(ActivityThread.java:4942)
at android.app.ActivityThread.access$3600(ActivityThread.java:229)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2058)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:7325)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
08-02 10:44:22.738 6573-6573/com.example.android.pdfrendererbasic I/Process: Sending signal. PID: 6573 SIG: 9
2019-09-23 00:51:17.383 24339-24339/? E/drawabletintin: Unknown bits set in runtime_flags: 0x8000
2019-09-23 00:51:17.605 24339-24339/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.android.drawabletinting, PID: 24339
java.util.UnknownFormatConversionException: Conversion = 'End of String'
at java.util.Formatter$FormatSpecifierParser.peek(Formatter.java:2642)
at java.util.Formatter$FormatSpecifierParser.(Formatter.java:2603)
at java.util.Formatter.parse(Formatter.java:2558)
at java.util.Formatter.format(Formatter.java:2505)
at java.util.Formatter.format(Formatter.java:2459)
at java.lang.String.format(String.java:2911)
at android.content.res.Resources.getString(Resources.java:485)
at android.support.v4.app.Fragment.getString(Fragment.java:795)
at com.example.android.drawabletinting.DrawableTintingFragment.updateTint(DrawableTintingFragment.java:272)
at com.example.android.drawabletinting.DrawableTintingFragment.onCreateView(DrawableTintingFragment.java:209)
at android.support.v4.app.Fragment.performCreateView(Fragment.java:2439)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1460)
at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1784)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1852)
at android.support.v4.app.BackStackRecord.executeOps(BackStackRecord.java:802)
at android.support.v4.app.FragmentManagerImpl.executeOps(FragmentManager.java:2625)
at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2411)
at android.support.v4.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManager.java:2366)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2273)
at android.support.v4.app.FragmentManagerImpl.dispatchStateChange(FragmentManager.java:3273)
at android.support.v4.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManager.java:3229)
at android.support.v4.app.FragmentController.dispatchActivityCreated(FragmentController.java:201)
at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:620)
at com.example.android.common.activities.SampleActivityBase.onStart(SampleActivityBase.java:39)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1432)
at android.app.Activity.performStart(Activity.java:7825)
at android.app.ActivityThread.handleStartActivity(ActivityThread.java:3294)
at android.app.servertransaction.TransactionExecutor.performLifecycleSequence(TransactionExecutor.java:221)
at android.app.servertransaction.TransactionExecutor.cycleToPath(TransactionExecutor.java:201)
at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:173)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2016)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
val bitmap = Bitmap.createBitmap(currentPage.width, currentPage.height, Bitmap.Config.ARGB_8888)
currentPage.render(bitmap, null, null, PdfRenderer.Page.RENDER_MODE_FOR_DISPLAY);
in my pdf which opened using PDFRenderer on Zoom in i cannot read the letters while i opened same pdf with other pdf viewer i can read the letters properly. I also debug and check the bitmap object and view bitmap here also on zoom in the bitmap i cannot read the letters properly.
Also in some device i am getting below crash
Issue by ghasem110deh
Tuesday Apr 17, 2018 at 02:07 GMT
Originally opened as googlearchive/android-PdfRendererBasic#23
hi
i use this lib in android 21 (lollipop) an work, how to use in android 17 (api) ?
thank's
Issue by bauer-bao
Tuesday Oct 24, 2017 at 09:42 GMT
Originally opened as googlearchive/android-PdfRendererBasic#18
Hi this is a link which client want to read. PdfRenderer cannot read it.
https://igenbucket.s3.ap-south-1.amazonaws.com/1505737193910_1505737193728History-hin-1A.pdf
Issue by AdityaAnand1
Thursday Mar 01, 2018 at 07:38 GMT
Originally opened as googlearchive/android-PdfRendererBasic#21
Issue by kovarn
Saturday Feb 04, 2017 at 12:27 GMT
Originally opened as googlearchive/android-DisplayingBitmaps#6
The logic here is wrong. inSampleSize
applies scaling to the height and the width of the bitmap,
and so the number of pixels should be scaled by the square of inSampleSize
.
// This offers some additional logic in case the image has a strange
// aspect ratio. For example, a panorama may have a much larger
// width than height. In these cases the total pixels might still
// end up being too large to fit comfortably in memory, so we should
// be more aggressive with sample down the image (=larger inSampleSize).
long totalPixels = width * height / inSampleSize;
// Anything more than 2x the requested pixels we'll sample down further
final long totalReqPixelsCap = reqWidth * reqHeight * 2;
while (totalPixels > totalReqPixelsCap) {
inSampleSize *= 2;
totalPixels /= 2;
}
This causes generated bitmaps to be of much lower size than required.
Issue by zhijiazheng123
Tuesday Jan 05, 2016 at 02:40 GMT
Originally opened as googlearchive/android-PdfRendererBasic#3
I've implemented it, and want to contribute my change, may I?
Issue by CHRehan
Wednesday Aug 24, 2016 at 21:58 GMT
Originally opened as googlearchive/android-PdfRendererBasic#9
i want to know how to enable zoom page rather to double click or tap ??
Issue by wangchauyan
Tuesday Oct 18, 2016 at 00:58 GMT
Originally opened as googlearchive/android-PdfRendererBasic#10
remove deprecated function - onAttach (Activity activity), should not use a deprecated function in code.
move create pdf render / show page functions to onStart
wangchauyan included the following code: https://github.com/googlesamples/android-PdfRendererBasic/pull/10/commits
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.