Android Question Pdf file size

Status
Not open for further replies.

TomKluz

Active Member
Licensed User
Heelo ,

I trying to achive pdf file using PDFdocument library due to Mr Erel example and following instructions.
(https://www.b4x.com/android/forum/threads/solved-b4a-creation-pdf-file-from-layout.112694/)
This is a file made as a snapshot from existing display layout.

Finally I have got it but next questions has appeared:

1. The size of pdf file (1.pdf) is 10 times bigger then corresponding pdf file done by PdfCreator
used in B4J app to do it.
Is it a way to obtain smoller size of 1.pdf ?
2. I had no idea that my layout is loaded with an animation. Pictures used are simple jpg files.
Is it my foult or is it possible to load it without of animation ?
3. I have a problem to see 1.pdf file via PC (Win 7) after connecting a smartfone by USB cable.
There is no problem to see it using Android file manager.
Is there any trik or something I am missing ?

Kind regards
Tomkluz
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
2. You can disable animation by setting Animation Duration designer property to 0 (Activity property).
3. You can use B4A-Bridge - File Explorer as an alternative. In some cases the file will appear after if you force a media scan. In other cases it will only appear after you reconnect the cable.

1. I haven't tried it, however based on these suggestions: https://stackoverflow.com/questions/22805726/android-pdfdocument-file-size/22810295 you can try to resize the bitmap before you draw it. Make it smaller than the canvas size. A full activity snapshot image will be very large.
 
Upvote 0

TomKluz

Active Member
Licensed User
Hello.
1. I have tryed tu include a simple 4 lines after creating bitmap file from activity snapshot: and something is going on.

AR = 0.6 ' has to be 1 to have native dimensions
Height = bmp.Height * AR
Width = bmp.Width * AR
bmp = bmp.Resize(Width,Height,True)

and exercise it with different values of AR (from 1 to 0.5). Results (sicze and quality of destination pdf file) depends from Android versions.
- Android 5.1 (ZTE Blade) AR= 1 size 3 Mb, AR=0.6 size 1 MB, quality depends from file size (bigger size better quality)
- Android 9.1 (Xiaomi Redmi) AR = 1 size 400 Kb AR=0.6 size = 200 kB, quality not depend from file size (I cannot recognise it)

Is it normal this huge size difference depending from Android version ? Should I do something else ?

2. I fave found an option to swith off animation in B4A IDE. Thank you.
3. I cannot see destination pdf file if am connected to PC by cable and also by IDE Bridge. I don't know how to do it, hovawer there is no problem in this case.
I can send file by email or bluetooth.

TomKluz
 
Last edited:
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Is it normal this huge size difference depending from Android version ?
It is related to the screen scale.

B4X:
Dim xui As XUI
Height = bmp.Height * AR / xui.Scale
    Width = bmp.Width * AR / xui.Scale
    bmp = bmp.Resize(Width,Height,True)

You will see the files with B4A-Bridge - File Explorer if you save in RP.GetSaveDirDefaultExternal.
 
Upvote 0

TomKluz

Active Member
Licensed User
I am really saving in a folder as you point me . I can see all foulders tree but not a file.

I was also exerciseing with bmp.Scale . In my case is the same as xui.Scale.
In case of Android 9 visible quality nearly doasn't depend from file size.
Any way, In both cases file size is reduced. This is a great progress

Thank you
 
Upvote 0
Status
Not open for further replies.
Top