corona-warn-app/cwa-app-android

Scaling of PDF certificate export

framihoki opened this issue ยท 26 comments

Avoid duplicates

  • [x ] Bug is not mentioned in the FAQ
  • Bug is specific for Android only, for general issues / questions that apply to iOS and Android please raise them in the documentation repository
  • [x ] Bug is not already reported in another issue

Technical details

  • Device name: Samsung Galaxy A52
  • Android version: 12
  • App version: 2.24.2

Describe the bug

When exporting individual or all certificates into a PDF document, the resulting PDF does not seem to be at scale for A4 paper. The booklet marks are not centred and do not reach up to the paper edge. In earlier versions, the scaling was always correct. It seems that in the current version the scaling is about 10% too small and the edges are not compatible with the A4 paper format.

Steps to reproduce the issue

Expected behaviour

Like in the previous versions, the alignment marks should be centred in the PDF and the full A4 paper size should be used.

Possible Fix

Correct PDF scaling.

Additional context


Internal Tracking ID: EXPOSUREAPP-13633 Scaling issue, duplicates
Internal Tracking ID: EXPOSUREAPP-13440

Internal Tracking ID: EXPOSUREAPP-13635 Template issues

@framihoki Thanks for reporting, we are currently trying to reproduce your issue. Thanks.

We suspect that the paper size "letter" is cause of this issue. However, no other option seems to be offered on the Samsung Galaxy device.

image

@dsarkar

I can reproduce this issue on a Samsung Galaxy A52 with 2.24.0 and 2.24.2. It is a regression from 2.23.2.

Steps to reproduce

Tap Certificates
Tap right-arrow
Tap certificate tile
Tap three-dot symbol
Select Display Print Version
Tap print symbol
Print with HP

I am seeing Paper size ISO A4.

Additional issue

Tap share
Select (Google) Drive
View uploaded file on Desktop with Adobe Acrobat DC

fails with error: "There was an error processing a page. There was a problem reading this document (109)."

@MikeMcC399 Thanks for reporting!

@dsarkar

Thanks for reporting!

The root cause may be the same as the scaling issue, but anyway I will submit a separate report about the compatibility issue with Adobe Acrobat DC.

The reported scaling and centering issue is reproducible on a Pixel 3a emulator with Android 12. Whereas on CWA Android 2.23.2 the exported PDF is centered and full size, the exported PDF using CWA Android 2.24.2 is smaller. The folding guide, which is supposed to be in the center of the DIN A4 paper, is shifted down and to the left from the center of the paper page.

Steps to reproduce the issue

On Desktop

  1. Use Android Studio Device File Explorer to transfer vaccination certificate PDF to the emulator

In CWA App

  1. Tap Scan
  2. Tap Open File
  3. Navigate to vaccination certificate in File app and tap on file
  4. Tap three-dot symbol
  5. Select Display Print Version, tap "Next"
  6. Tap Share symbol
  7. Tap Drive symbol
  8. Tap Save

On Desktop

  1. Open Drive https://drive.google.com/drive/my-drive
  2. Open saved PDF with Adobe Acrobat DC
  3. File > Print
  4. Select "Shrink oversized pages" and note that Scale 97% 210,02 x 297,01 mm is shown
  5. Click Print
  6. Note that folding guide cross is not in the center of the page

I haven't been able to reliably reproduce the unreadable PDF. I will look at this again.

@MikeMcC399 Thanks, forwarded to internal ticket.

@dsarkar

There may be a problem with the template being used. I noticed also that there are formatting issues in the text. See below, where there is a gap between Sie and the comma (,) following it.

image

This problem occurs in both CWA 2.24.2 and CovPass 1.27.0.

It is a regression from CWA 2.23.2.

I will see if I can find out if there is an earlier version of CovPass without the formatting issue as well.

@MikeMcC399 Many thanks, will forward your findings.
Internal Tracking ID: EXPOSUREAPP-13635 Template issues

FYI PR #5303

@dsarkar

release/2.25.x improves the PDF formatting, however it does not address the scaling issue, nor does it fix other issues:

  1. The complete certificate is scaled smaller that it used to be in 2.23.2
  2. The folding cross is centered on the page from left to right (105 mm from left and right edge of paper), however it is not centered top to bottom (it should be at 297 mm / 2 = 148.5 mm). The cross is 143 mm from the top and 153 mm from the bottom.
  3. The formatting issue with the gap between "Sie" and "," is still present.

Should we continue in this issue or would it be better to track the remaining problems in one or more separate GitHub issues?

  • The formatting issue I mentioned in #5350 (comment) is a regression from CWA 2.23.2 compared to CWA 2.24.2. Here is a full screen-shot of that section:

Certificate infos

  • For CovPass I went back to version 1.16.0 and found it was already present in that version. Since the problem still occurs in the current CovPass 1.27.0 version I went ahead and submitted a bug-report Digitaler-Impfnachweis/covpass-android#222 against CovPass.

  • I believe that the certificate templates are shared, so it may be that part of the resolution will need to come from the CovPass team.

@thomasaugsten

I think the correct issue belongs to the template repo
https://github.com/Digitaler-Impfnachweis/certification-apis/tree/master/templates

I noticed when I printed out https://github.com/corona-warn-app/cwa-app-android/blob/release/2.24.x/Corona-Warn-App/src/main/assets/template/vc_v4.1.svg that it looked fine (no scaling issue, no whitespace issue), but I haven't tried to understand how the final PDF is actually built.

Also the templates on https://github.com/Digitaler-Impfnachweis/certification-apis/tree/master/templates haven't changed in almost 12 months, so it would be good to understand why there is suddenly an issue in CWA Android 2.24.2, when the format was correct still on CWA Android 2.23.2.

If an issue needs to be raised against the templates, then it would probably be better for the Open Source Team to do that directly, rather than the community, as I cannot specifically identify any issue with the templates.

Ok we will double check this

@thomasaugsten

There is no documentation on https://github.com/Digitaler-Impfnachweis/certification-apis/tree/master/templates about how to use the templates, however it seems like the svg template files are not scalable, despite the extension (svg for Scalable Vector Graphics). If they are not used at exactly 100% of DIN A4 size 210 x 297 mm then the text portions will have gaps (if the certificate is less than 100% size) or overlap (if more than 100% size) since their position on the page is defined with absolute coordinates.

I believe that CWA needs to somehow revert to using the templates at 100% size to solve the issue.

@dsarkar

  • This issue is only partially resolved in CWA Android 2.25.0.

  • The fold markers in CWA Android 2.25.0 at the edge of the paper are 10 mm (left and right), 13 mm (top) and 18 mm (bottom) from the edge of the paper, whereas in CWA Android 2.23.0 they met the edge of the paper (left and right) or were at a maximum of 1 mm away (top and bottom) from the edge of the paper. Should the certificate be scaled so it looks like the export of CWA Android 2.23.0 or is it intended that the certificate is now smaller?

  • Issue #5369 regarding the centering of the folding cross marker is still open. The folding cross is vertically misaligned. Fixed in branch release/2.26.x through PR #5427.

  • Additionally the related issue #5356 is still open. Fixed in branch release/2.26.x through PR #5420.

  • #5370 is also still open, however it does not concern scaling. Edge case. Will not be fixed.

@dsarkar

Since this issue is not resolved in 2.25.0 (refer to issue description in OP) the label Fix 2.25 Fix is planned for 2.25 should be removed.

There was announcement in the iOS repository regarding the availability of community managers (see corona-warn-app/cwa-app-ios#4602 (comment)). Will anybody else maintain the fix labels here?

@MikeMcC399: Fix label adjusted to 2.26

@sapcoder123

Fix label adjusted to 2.26

This issue is only partially resolved for 2.26. The OP expectations are:

Like in the previous versions, the alignment marks should be centred in the PDF and the full A4 paper size should be used.

  • The alignment marks are centered with PR #5427, however the full A4 paper size is not used. Measured from the ends of the single-line fold-marks: the left and right margins are 10mm, the top margin is 15 mm and the bottom margin is 19 mm. For comparison: an exported certificate from CWA Android 2.23.2 shows the fold-marks touching the edge of the paper or a maximum of 1 mm from the edge of the paper.

The export from 2.26 leaves a blank margin around the margin which holds only the fold markers, so it is not using the full size of the paper:

2 26 export

@MikeMcC399 Thank you for reporting, I forwarded it to the dev team

This is still not fixed in 2.28.3. An exported certificate is scaled down and does not fill the paper.

Same issue in CovPass 1.38.0.

@MikeMcC399 I tried everything I know to remove the extra margins added to the PDF, but no luck so far. See StackOverflow. I have no explanation why this margin is added despite that it is explicitly defined that no margin needed:

and CSS also removes any margins or paddings

<meta name="viewport" content="width=device-width, user-scalable=yes" />
<style type="text/css">
h6 {
font-weight: 500;
margin: 0px;
}
ul {
margin: 0px;
padding: 0px;
}
body {
margin: 0px;
}
</style>

I understand it is not perfect, but it is a minor thing that doesn't affect the exported certificates, therefore I will set this bug to "won't fix"

@mtwalli

Thank you for trying to fix this! I don't think it matters much more as certificates are hardly being used in Germany these days.