I have just started using PdfDocument, and like TomKluz in Pdf file size, if I write a bitmap to the pdf I get a much bigger size.
In my case it has nothing to do with screen or scale. Simply 170Kb jpg added to blank pdf = 800Kb pdf.
If the source picture is a jpg, 170Kb. When added and saved as a pdf, the resulting pdf file is 800Kb.
Even if I change the DestRect to be much smaller, I end up with a small picture on the page but its still 800Kb.
I thought maybe its to do with the source being a jpg file, with compression, and the target is uncompressed bitmap embedded in the pdf. However if a use a Pdf editing program to create a pdf and insert this picture, it doesn't end up with such a large pdf.
Is there a way to not have the pdf so large using PdfDocument? In that other post, TomKluz said 'PdfCreator used in B4J' didn't have this problem.
In my case it has nothing to do with screen or scale. Simply 170Kb jpg added to blank pdf = 800Kb pdf.
For example, a tweak on the standard sample given by Erel, but adding a picture rather than drawing lines:
Dim pdf As PdfDocument
pdf.Initialize
pdf.StartPage(595, 842) 'A4 size
Dim bmp as BitMap = LoadBitmap(strDir, strFile)
Dim DestRect as Rect
DestRect.Initialize(0, 0, 595, 842)
pdf.Canvas.DrawBitmap(bmp, Null, DestRect)
pdf.FinishPage
Dim out As OutputStream = File.OpenOutput(File.DirInternal, "1.pdf", False)
pdf.WriteToStream(out)
out.Close
pdf.Close
If the source picture is a jpg, 170Kb. When added and saved as a pdf, the resulting pdf file is 800Kb.
Even if I change the DestRect to be much smaller, I end up with a small picture on the page but its still 800Kb.
I thought maybe its to do with the source being a jpg file, with compression, and the target is uncompressed bitmap embedded in the pdf. However if a use a Pdf editing program to create a pdf and insert this picture, it doesn't end up with such a large pdf.
Is there a way to not have the pdf so large using PdfDocument? In that other post, TomKluz said 'PdfCreator used in B4J' didn't have this problem.