MrKim Well-Known Member Licensed User Longtime User Aug 21, 2020 #1 I decide for now the simplest way to get my printing done is to put everything in a CLV and use Dim bmp As B4XBitmap = PrintCLV.sv.ScrollViewInnerPanel.Snapshot DestRect.Initialize(10,10,280, 835) pdf.Canvas.DrawBitmap(bmp, Null, DestRect) pdf.FinishPage Which works fine - EXCEPT if I try to center the text, As I do on the first line, B4X: NameLbl.SetTextAlignment("BOTTOM", "CENTER") Phone1Lbl.SetTextAlignment("BOTTOM", "CENTER") EmailLbl.SetTextAlignment("BOTTOM", "CENTER") the text disappears on the bmp. Here is a screenshot of the CLV on the Page: Here is what the corresponding bmp looks like: If I leave the first line Left Justified it works as expected. I tried this in both debug and release mode with the same results. The text also disappears if RIGHT justified. Attachments 1597979309078.png 91.3 KB · Views: 594 Screenshot_20200821-115013.png 192.3 KB · Views: 608
I decide for now the simplest way to get my printing done is to put everything in a CLV and use Dim bmp As B4XBitmap = PrintCLV.sv.ScrollViewInnerPanel.Snapshot DestRect.Initialize(10,10,280, 835) pdf.Canvas.DrawBitmap(bmp, Null, DestRect) pdf.FinishPage Which works fine - EXCEPT if I try to center the text, As I do on the first line, B4X: NameLbl.SetTextAlignment("BOTTOM", "CENTER") Phone1Lbl.SetTextAlignment("BOTTOM", "CENTER") EmailLbl.SetTextAlignment("BOTTOM", "CENTER") the text disappears on the bmp. Here is a screenshot of the CLV on the Page: Here is what the corresponding bmp looks like: If I leave the first line Left Justified it works as expected. I tried this in both debug and release mode with the same results. The text also disappears if RIGHT justified.
Erel B4X founder Staff member Licensed User Longtime User Aug 23, 2020 #2 First step is to understand where is the problem. Show the bitmap with an ImageView. Are the titles missing? Upvote 0
First step is to understand where is the problem. Show the bitmap with an ImageView. Are the titles missing?
MrKim Well-Known Member Licensed User Longtime User Aug 24, 2020 #3 Erel said: First step is to understand where is the problem. Show the bitmap with an ImageView. Are the titles missing? Click to expand... Sorry if I wasn't clear. That is what the second image above is. The first image is the CLV (PrintCLV). As you can see the data is displayed (circled in Red). The second image is the BMP taken with PrintCLV.sv.ScrollViewInnerPanel.Snapshot displayed in an ImageView. I diddn't mean to include the two attachments. 159759...png is a screenshot of the pdf. I was originally going to just show the pdf and realized I better check the snapashot image first. The other attachment is basically a duplicate of the .bmp. Upvote 0
Erel said: First step is to understand where is the problem. Show the bitmap with an ImageView. Are the titles missing? Click to expand... Sorry if I wasn't clear. That is what the second image above is. The first image is the CLV (PrintCLV). As you can see the data is displayed (circled in Red). The second image is the BMP taken with PrintCLV.sv.ScrollViewInnerPanel.Snapshot displayed in an ImageView. I diddn't mean to include the two attachments. 159759...png is a screenshot of the pdf. I was originally going to just show the pdf and realized I better check the snapashot image first. The other attachment is basically a duplicate of the .bmp.
Erel B4X founder Staff member Licensed User Longtime User Aug 24, 2020 #4 If I understand correctly the problem has nothing to do with the PDF but rather with the snapshot feature. Right? Upvote 0
If I understand correctly the problem has nothing to do with the PDF but rather with the snapshot feature. Right?
MrKim Well-Known Member Licensed User Longtime User Aug 24, 2020 #5 Erel said: If I understand correctly the problem has nothing to do with the PDF but rather with the snapshot feature. Right? Click to expand... Yes, I should have left out the portion about the pdf. When I started this post I was thinking it was a pdf issue since that was all I was looking at. Then I checked the snapshot/ The issue is with the snapshot. Upvote 0
Erel said: If I understand correctly the problem has nothing to do with the PDF but rather with the snapshot feature. Right? Click to expand... Yes, I should have left out the portion about the pdf. When I started this post I was thinking it was a pdf issue since that was all I was looking at. Then I checked the snapshot/ The issue is with the snapshot.
Erel B4X founder Staff member Licensed User Longtime User Aug 24, 2020 #6 Can you reproduce it in a small project? Upvote 0
MrKim Well-Known Member Licensed User Longtime User Aug 25, 2020 #7 Erel said: Can you reproduce it in a small project? Click to expand... Yes. It took a while. It is some sort of timing issue. At first I couldn't duplicate it in a simple program because I was displaying the snapshot with a button. I inadvertently discovered the problem when I put a break-point on the ...ScrollViewInnerPanel.Snapshot line in MY programs's code. When I did that it worked the way it should. The problem only occurs when there is no break in the action between filling the CLV and running the snapshot. Adding Sleep(0) before the snapshot line actually solves the problem. In the code provided when you open PagePrint it will not display correctly. If you then click the button it will. There is a lot of extra code in the sample, (including the extra page) because, as I said, at first I couldn't duplicate the problem so I added the Drawer menu and the extra page, etc. thinking something else in my program must be affecting it. I love working with pages. So simple. Thank you for all of your work. Attachments SnapshotError.zip SnapshotError.zip 15.8 KB · Views: 502 Last edited: Aug 25, 2020 Upvote 0
Erel said: Can you reproduce it in a small project? Click to expand... Yes. It took a while. It is some sort of timing issue. At first I couldn't duplicate it in a simple program because I was displaying the snapshot with a button. I inadvertently discovered the problem when I put a break-point on the ...ScrollViewInnerPanel.Snapshot line in MY programs's code. When I did that it worked the way it should. The problem only occurs when there is no break in the action between filling the CLV and running the snapshot. Adding Sleep(0) before the snapshot line actually solves the problem. In the code provided when you open PagePrint it will not display correctly. If you then click the button it will. There is a lot of extra code in the sample, (including the extra page) because, as I said, at first I couldn't duplicate the problem so I added the Drawer menu and the extra page, etc. thinking something else in my program must be affecting it. I love working with pages. So simple. Thank you for all of your work.