Spaces:
Running
Running
Download scripts/debug_shift.cjs from Sarvesh213/getcert-backend: direct link, hf CLI and curl.
- Browser
- Download file 1.41 kB
-
https://huggingface.co/spaces/Sarvesh213/getcert-backend/resolve/main/scripts/debug_shift.cjs
- Command line
-
hf download hf://spaces/Sarvesh213/getcert-backend/scripts/debug_shift.cjs
-
curl -L -o debug_shift.cjs https://huggingface.co/spaces/Sarvesh213/getcert-backend/resolve/main/scripts/debug_shift.cjs
1.41 kB
| const { chromium } = require('playwright'); | |
| const fs = require('fs'); | |
| (async () => { | |
| const browser = await chromium.launch({ headless: true }); | |
| const page = await browser.newPage({ viewport: { width: 1440, height: 1000 } }); | |
| await page.goto('http://127.0.0.1:5173/preview-certificate'); | |
| await page.waitForTimeout(2000); | |
| // Take screenshot of certEl in page | |
| const certEl = await page.locator('[data-certificate-canvas="true"]'); | |
| await certEl.screenshot({ path: '/home/grim/.gemini/antigravity/brain/780fc6f2-0ee4-4d27-a3c9-d81026488398/direct_element_screenshot.png' }); | |
| console.log('Saved direct_element_screenshot.png'); | |
| // Now trigger PDF download and inspect | |
| const [ download ] = await Promise.all([ | |
| page.waitForEvent('download'), | |
| page.click('#btn-download-pdf') | |
| ]); | |
| const pdfPath = '/home/grim/.gemini/antigravity/brain/780fc6f2-0ee4-4d27-a3c9-d81026488398/debug.pdf'; | |
| await download.saveAs(pdfPath); | |
| const { execSync } = require('child_process'); | |
| execSync(`pdftoppm -png -r 150 "${pdfPath}" "/home/grim/.gemini/antigravity/brain/780fc6f2-0ee4-4d27-a3c9-d81026488398/debug_pdf"`); | |
| fs.renameSync('/home/grim/.gemini/antigravity/brain/780fc6f2-0ee4-4d27-a3c9-d81026488398/debug_pdf-1.png', '/home/grim/.gemini/antigravity/brain/780fc6f2-0ee4-4d27-a3c9-d81026488398/debug_pdf.png'); | |
| console.log('Done rendering debug pdf'); | |
| await browser.close(); | |
| })(); | |