stats4sd / aec_portfolio

A proof of concept for the AEC Consortium Project Management / Assessment System
GNU General Public License v3.0
0 stars 0 forks source link

[BUG] Generate PDF does not generate PDF file, nothing happened #109

Closed dan-tang-ssd closed 1 year ago

dan-tang-ssd commented 1 year ago

Describe the bug Generate PDF does not generate PDF file, nothing happened

To Reproduce Initiatives > Click Expand button > Click Show Initiative Information button > Click Generate PDF button

Expected behavior PDF file generated and triggered file download in browser

Screenshots image

image

image

dan-tang-ssd commented 1 year ago

As discussed, I refer to "Add Browsershot" PR #51 to add a config file ".puppeteerrc.cjs" to specify cache folder for Windows env. It can now generate PDF file.

However, the pdf content looks like 70% transparent, and there is no spider chart in pdf... I tried the printing function in browswer, it has spider chart...

Screen shot:

Click "Generate PDF" button image

The generated pdf, content is 70% transparent, no spider chart here image

Broswer printing function, it has spider chart image

dan-tang-ssd commented 1 year ago

By using ->preventUnsuccessfulResponse() when generaring pdf file, transparency changed from 70% to 50%.

Without ->preventUnsuccessfulResponse(), e.g. $pdf = Browsershot::html($htmlContent)->pdf(); image

With ->preventUnsuccessfulResponse(), e.g. $pdf = Browsershot::html($htmlContent)->preventUnsuccessfulResponse()->pdf(); image

dan-tang-ssd commented 1 year ago

I am struggled now... the generated pdf can have different level of transparency by running same code... I will leave this item here now and work on other items first.

image

image