Hi,
I´m using the nice PDFium wrapper, which really works great.
Unfortunately I get an strange compile Error when trying to create an Bitmap from one PDF page as shown here:
https://www.b4x.com/android/forum/bookmarks/?type=post&id=644677
This is the Sub in question:
Especially surprising is the fact that I can compile the app with line "commented out" and then use HotSwap to uncomment. That way everything works as expected.
Attached you will finde an reduced test.
It would be really great if someone has an idea.
Thanks in advance
Moosi
I´m using the nice PDFium wrapper, which really works great.
Unfortunately I get an strange compile Error when trying to create an Bitmap from one PDF page as shown here:
https://www.b4x.com/android/forum/bookmarks/?type=post&id=644677
B4X:
B4A Version: 9.50
Java Version: 8
Parse den Code. (0.00s)
Building folders structure. (0.01s)
Kompiliere den Code. (0.02s)
Kompiliere Layoutcode. (0.00s)
Organisiere Libraries. (0.00s)
(AndroidX SDK)
Generiere R Datei. (0.00s)
Kompiliere generierten Java Code. Error
B4A line: 50
pdf.renderPageBitmap(glDoc,bmp,page,0,0,600dip,60
javac 1.8.0_202
src\b4a\example\main.java:454: error: cannot find symbol
mostCurrent._pdf.renderPageBitmap((com.shockwave.pdfium.PdfDocument)(_gldoc),(Bitmap)(_bmp.getObject()),_page,(int) (0),(int) (0),anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (600)),anywheresoftware.b4a.keywords.Common.DipToCurrent((int) (600)));
^
symbol: class Bitmap
location: class main
This is the Sub in question:
B4X:
Sub RenderPDFThumbnail(TheFilename As String, page As Int)
Dim bmp As Bitmap
Dim glDoc As Object
glDoc = pdf.newDocument(File.DirInternal,TheFilename, 268435456,"")
bmp.InitializeMutable(600dip,600dip)
pdf.openPage(glDoc,page)
pdf.renderPageBitmap(glDoc,bmp,page,0,0,600dip,600dip) '<-- this line raises the compile error
Dim out As OutputStream = File.OpenOutput(File.DirInternal, "Out.jpg", False)
bmp.WriteToStream(out, 80, "JPEG")
out.Close
End Sub
r
Especially surprising is the fact that I can compile the app with line "commented out" and then use HotSwap to uncomment. That way everything works as expected.
Attached you will finde an reduced test.
It would be really great if someone has an idea.
Thanks in advance
Moosi