Android Question Convert Pdf to JPG

luciano deri

Active Member
Licensed User
Longtime User
Hello, How is possible convert a Pdf file in a image file such as jpg or other format?
 

Star-Dust

Expert
Licensed User
Longtime User
B4X:
 Sub ConvertiPdfImg(nomefile As String)
     Dim Render As PDFRenderer
     Dim img As Bitmap
     Render.Initialize("",Main.pthDOC,nomefile)
     For i = 1 To Render.PageCount
        img = Render.renderPageforDisplay(i)
        ' now save img in a file
        Dim out AsOutputStream
        out = File.OpenOutput(File.DirRootExternal, "page" & i & ".png", False)
        b.WriteToStream(out, 100, "PNG")
        out.Close
     Next
End Sub
 
Upvote 0

luciano deri

Active Member
Licensed User
Longtime User
What different between renderPageforPrint and renderPageforDisplay?
Why converted img file has background black?
 
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
Te lo spiego in italiano, uno serve a fare rendering per apparire sullo schermo il secondo solo per essere stampato e ovviamente sono due cose differenti.

P.S. Apri un nuovo argomento per ogni domanda cosi sarà più facile per gli altri trovare le risposte alle stesse tue domande consultando i titoli degli argomenti
________________________________________
one to make rendering to appear on the screen the second only to be printed and of course there are two different things.

P.S. Open new thread
 
Last edited:
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Please create
What different between renderPageforPrint and renderPageforDisplay?
Why converted img file has background black?
Please create a NEW thread for ANY question you have. This thread is handled. I do not answer anymore. Respect the forum-rules!
 
Upvote 0

luciano deri

Active Member
Licensed User
Longtime User
ok Sorry.
Be careful, because the questions was pertinent with original problem, and it need it to explain pdfRenderer solution.
 
Upvote 0

Star-Dust

Expert
Licensed User
Longtime User
The library was wrapped up by Don Manfred, he can know the problem. If he does not answer you anymore, it seems better to follow his suggestion and open another thread. He'll surely have a better answer from you ;-)
 
Upvote 0

luciano deri

Active Member
Licensed User
Longtime User
I think that the problem was on the creation of pdf. For now i solved with writing a white rect big such as the page before write any others components
Thank everyone
 
Upvote 0
Top